From e8744e7eeb5528b3d817fa7fcafb40d40d4b3d16 Mon Sep 17 00:00:00 2001 From: jungejason Date: Tue, 10 May 2011 15:54:11 -0700 Subject: [PATCH] Enable pygment highlighting for diffusion Summary: set the config for the diffusion highlighter. In D202 we enabled it for differential already. Test Plan: opened a python file in diffusion and verified it is highlighted. Reviewed By: epriestley Reviewers: epriestley, tuomaspelkonen CC: aran, epriestley Differential Revision: 260 --- .../controller/file/DiffusionBrowseFileController.php | 3 +++ src/applications/diffusion/controller/file/__init__.php | 1 + 2 files changed, 4 insertions(+) diff --git a/src/applications/diffusion/controller/file/DiffusionBrowseFileController.php b/src/applications/diffusion/controller/file/DiffusionBrowseFileController.php index 6ea62608a0..6ced8bf77b 100644 --- a/src/applications/diffusion/controller/file/DiffusionBrowseFileController.php +++ b/src/applications/diffusion/controller/file/DiffusionBrowseFileController.php @@ -178,6 +178,9 @@ class DiffusionBrowseFileController extends DiffusionController { list($text_list, $rev_list, $blame_dict) = $file_query->getBlameData(); $highlightEngine = new PhutilDefaultSyntaxHighlighterEngine(); + $highlightEngine->setConfig( + 'pygments.enabled', + PhabricatorEnv::getEnvConfig('pygments.enabled')); $text_list = explode("\n", $highlightEngine->highlightSource($path, implode("\n", $text_list))); diff --git a/src/applications/diffusion/controller/file/__init__.php b/src/applications/diffusion/controller/file/__init__.php index 529bf8288a..8b61c73968 100644 --- a/src/applications/diffusion/controller/file/__init__.php +++ b/src/applications/diffusion/controller/file/__init__.php @@ -9,6 +9,7 @@ phutil_require_module('phabricator', 'applications/diffusion/controller/base'); phutil_require_module('phabricator', 'applications/diffusion/query/filecontent/base'); phutil_require_module('phabricator', 'infrastructure/celerity/api'); +phutil_require_module('phabricator', 'infrastructure/env'); phutil_require_module('phabricator', 'infrastructure/javelin/api'); phutil_require_module('phabricator', 'view/layout/panel');