mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-09 16:32:39 +01:00
Added custom remarkup.
Summary: Vendor specific markups are now possible. Test Plan: Tested with the Facebook specific tasks markup. Reviewed By: jungejason Reviewers: epriestley, jungejason CC: aran, jungejason Differential Revision: 349
This commit is contained in:
parent
19e10b2b5d
commit
f076956f32
3 changed files with 27 additions and 0 deletions
|
@ -334,6 +334,13 @@ return array(
|
|||
|
||||
'differential.revision-custom-detail-renderer' => null,
|
||||
|
||||
// Array for custom remarkup rules. The array should have a list of
|
||||
// class names of classes that extend PhutilRemarkupRule
|
||||
'differential.custom-remarkup-rules' => null,
|
||||
|
||||
// Array for custom remarkup block rules. The array should have a list of
|
||||
// class names of classes that extend PhutilRemarkupEngineBlockRule
|
||||
'differential.custom-remarkup-block-rules' => null,
|
||||
|
||||
// -- Maniphest ------------------------------------------------------------- //
|
||||
|
||||
|
|
|
@ -48,6 +48,15 @@ class DifferentialMarkupEngineFactory {
|
|||
$rules[] = new PhutilRemarkupRuleBold();
|
||||
$rules[] = new PhutilRemarkupRuleItalic();
|
||||
|
||||
$custom_rule_classes =
|
||||
PhabricatorEnv::getEnvConfig('differential.custom-remarkup-rules');
|
||||
if ($custom_rule_classes) {
|
||||
foreach ($custom_rule_classes as $custom_rule_class) {
|
||||
PhutilSymbolLoader::loadClass($custom_rule_class);
|
||||
$rules[] = newv($custom_rule_class, array());
|
||||
}
|
||||
}
|
||||
|
||||
$blocks = array();
|
||||
$blocks[] = new PhutilRemarkupEngineRemarkupQuotesBlockRule();
|
||||
$blocks[] = new PhutilRemarkupEngineRemarkupHeaderBlockRule();
|
||||
|
@ -55,6 +64,15 @@ class DifferentialMarkupEngineFactory {
|
|||
$blocks[] = new PhutilRemarkupEngineRemarkupCodeBlockRule();
|
||||
$blocks[] = new PhutilRemarkupEngineRemarkupDefaultBlockRule();
|
||||
|
||||
$custom_block_rule_classes =
|
||||
PhabricatorEnv::getEnvConfig('differential.custom-remarkup-block-rules');
|
||||
if ($custom_block_rule_classes) {
|
||||
foreach ($custom_block_rule_classes as $custom_block_rule_class) {
|
||||
PhutilSymbolLoader::loadClass($custom_block_rule_class);
|
||||
$blocks[] = newv($custom_block_rule_class, array());
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($blocks as $block) {
|
||||
if (!($block instanceof PhutilRemarkupEngineRemarkupCodeBlockRule)) {
|
||||
$block->setMarkupRules($rules);
|
||||
|
|
|
@ -26,6 +26,8 @@ phutil_require_module('phutil', 'markup/engine/remarkup/markuprule/escaperemarku
|
|||
phutil_require_module('phutil', 'markup/engine/remarkup/markuprule/hyperlink');
|
||||
phutil_require_module('phutil', 'markup/engine/remarkup/markuprule/italics');
|
||||
phutil_require_module('phutil', 'markup/engine/remarkup/markuprule/monospace');
|
||||
phutil_require_module('phutil', 'symbols');
|
||||
phutil_require_module('phutil', 'utils');
|
||||
|
||||
|
||||
phutil_require_source('DifferentialMarkupEngineFactory.php');
|
||||
|
|
Loading…
Reference in a new issue