Clean up Phabricator interface to syntax highlighting
Summary: Reduce the amount of code duplication here and allow for an override configuration on the filename.map stuff. Test Plan: Checked paste, diffusion and differential syntax highlighting and everything appeared reasonable. Reviewed By: codeblock Reviewers: tuomaspelkonen, codeblock, jungejason, aran CC: aran, codeblock, epriestley Differential Revision: 601
This commit is contained in:
@@ -179,16 +179,11 @@ class DiffusionBrowseFileController extends DiffusionController {
|
||||
|
||||
list($text_list, $rev_list, $blame_dict) = $file_query->getBlameData();
|
||||
|
||||
$highlight_engine = new PhutilDefaultSyntaxHighlighterEngine();
|
||||
$highlight_engine->setConfig(
|
||||
'pygments.enabled',
|
||||
PhabricatorEnv::getEnvConfig('pygments.enabled'));
|
||||
|
||||
$text_list = explode(
|
||||
"\n",
|
||||
$highlight_engine->highlightSource(
|
||||
$highlight_engine->getLanguageFromFilename($path),
|
||||
implode("\n", $text_list)));
|
||||
$text_list = implode("\n", $text_list);
|
||||
$text_list = PhabricatorSyntaxHighlighter::highlightWithFilename(
|
||||
$path,
|
||||
$text_list);
|
||||
$text_list = explode("\n", $text_list);
|
||||
|
||||
$rows = $this->buildDisplayRows($text_list, $rev_list, $blame_dict,
|
||||
$needs_blame, $drequest, $file_query, $selected);
|
||||
|
||||
@@ -8,13 +8,12 @@
|
||||
|
||||
phutil_require_module('phabricator', 'applications/diffusion/controller/base');
|
||||
phutil_require_module('phabricator', 'applications/diffusion/query/filecontent/base');
|
||||
phutil_require_module('phabricator', 'applications/markup/syntax');
|
||||
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');
|
||||
|
||||
phutil_require_module('phutil', 'markup');
|
||||
phutil_require_module('phutil', 'markup/syntax/engine/default');
|
||||
phutil_require_module('phutil', 'utils');
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user