1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-19 03:50:54 +01:00

Enable use of remarkup literal block

Summary:
D1293 adds support for a literal block in remarkup.  This diff enables
it in phabricator with a few basic rules (for line breaks, escaping HTML,
and linkifying URLs).

Test Plan: Tested in sandbox

Reviewers: epriestley, jungejason

Reviewed By: epriestley

CC: aran, epriestley

Differential Revision: https://secure.phabricator.com/D1297
This commit is contained in:
Andrew Gallagher 2012-01-03 16:17:40 -08:00
parent 7a9be605ae
commit 48f72b57b2
2 changed files with 12 additions and 2 deletions

View file

@ -1,7 +1,7 @@
<?php
/*
* Copyright 2011 Facebook, Inc.
* Copyright 2012 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -141,6 +141,7 @@ class PhabricatorMarkupEngine {
$blocks = array();
$blocks[] = new PhutilRemarkupEngineRemarkupQuotesBlockRule();
$blocks[] = new PhutilRemarkupEngineRemarkupLiteralBlockRule();
$blocks[] = new PhutilRemarkupEngineRemarkupHeaderBlockRule();
$blocks[] = new PhutilRemarkupEngineRemarkupListBlockRule();
$blocks[] = new PhutilRemarkupEngineRemarkupCodeBlockRule();
@ -156,7 +157,14 @@ class PhabricatorMarkupEngine {
}
foreach ($blocks as $block) {
if (!($block instanceof PhutilRemarkupEngineRemarkupCodeBlockRule)) {
if ($block instanceof PhutilRemarkupEngineRemarkupLiteralBlockRule) {
$literal_rules = array();
$literal_rules[] = new PhutilRemarkupRuleHyperlink();
$literal_rules[] = new PhutilRemarkupRuleEscapeHTML();
$literal_rules[] = new PhutilRemarkupRuleLinebreaks();
$block->setMarkupRules($literal_rules);
} else if (
!($block instanceof PhutilRemarkupEngineRemarkupCodeBlockRule)) {
$block->setMarkupRules($rules);
}
}

View file

@ -25,6 +25,7 @@ phutil_require_module('phutil', 'markup/engine/remarkup/blockrule/remarkupcode')
phutil_require_module('phutil', 'markup/engine/remarkup/blockrule/remarkupdefault');
phutil_require_module('phutil', 'markup/engine/remarkup/blockrule/remarkupheader');
phutil_require_module('phutil', 'markup/engine/remarkup/blockrule/remarkuplist');
phutil_require_module('phutil', 'markup/engine/remarkup/blockrule/remarkupliteral');
phutil_require_module('phutil', 'markup/engine/remarkup/blockrule/remarkupnote');
phutil_require_module('phutil', 'markup/engine/remarkup/blockrule/remarkupquotes');
phutil_require_module('phutil', 'markup/engine/remarkup/markuprule/bold');
@ -32,6 +33,7 @@ phutil_require_module('phutil', 'markup/engine/remarkup/markuprule/escapehtml');
phutil_require_module('phutil', 'markup/engine/remarkup/markuprule/escaperemarkup');
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/linebreaks');
phutil_require_module('phutil', 'markup/engine/remarkup/markuprule/monospace');
phutil_require_module('phutil', 'symbols');
phutil_require_module('phutil', 'utils');