Page MenuHomePhabricator

D8052.id18217.diff
No OneTemporary

D8052.id18217.diff

Index: src/__phutil_library_map__.php
===================================================================
--- src/__phutil_library_map__.php
+++ src/__phutil_library_map__.php
@@ -242,6 +242,7 @@
'PhutilRemarkupBlockStorage' => 'markup/engine/remarkup/PhutilRemarkupBlockStorage.php',
'PhutilRemarkupEngine' => 'markup/engine/PhutilRemarkupEngine.php',
'PhutilRemarkupEngineBlockRule' => 'markup/engine/remarkup/blockrule/PhutilRemarkupEngineBlockRule.php',
+ 'PhutilRemarkupEngineRemarkupBubbleBlockRule' => 'markup/engine/remarkup/blockrule/PhutilRemarkupEngineRemarkupBubbleBlockRule.php',
'PhutilRemarkupEngineRemarkupCodeBlockRule' => 'markup/engine/remarkup/blockrule/PhutilRemarkupEngineRemarkupCodeBlockRule.php',
'PhutilRemarkupEngineRemarkupDefaultBlockRule' => 'markup/engine/remarkup/blockrule/PhutilRemarkupEngineRemarkupDefaultBlockRule.php',
'PhutilRemarkupEngineRemarkupHeaderBlockRule' => 'markup/engine/remarkup/blockrule/PhutilRemarkupEngineRemarkupHeaderBlockRule.php',
@@ -602,6 +603,7 @@
'PhutilReadableSerializerTestCase' => 'PhutilTestCase',
'PhutilRealnameContextFreeGrammar' => 'PhutilContextFreeGrammar',
'PhutilRemarkupEngine' => 'PhutilMarkupEngine',
+ 'PhutilRemarkupEngineRemarkupBubbleBlockRule' => 'PhutilRemarkupEngineBlockRule',
'PhutilRemarkupEngineRemarkupCodeBlockRule' => 'PhutilRemarkupEngineBlockRule',
'PhutilRemarkupEngineRemarkupDefaultBlockRule' => 'PhutilRemarkupEngineBlockRule',
'PhutilRemarkupEngineRemarkupHeaderBlockRule' => 'PhutilRemarkupEngineBlockRule',
Index: src/markup/engine/__tests__/PhutilRemarkupEngineTestCase.php
===================================================================
--- src/markup/engine/__tests__/PhutilRemarkupEngineTestCase.php
+++ src/markup/engine/__tests__/PhutilRemarkupEngineTestCase.php
@@ -94,6 +94,7 @@
$blocks[] = new PhutilRemarkupEngineRemarkupCodeBlockRule();
$blocks[] = new PhutilRemarkupEngineRemarkupLiteralBlockRule();
$blocks[] = new PhutilRemarkupEngineRemarkupNoteBlockRule();
+ $blocks[] = new PhutilRemarkupEngineRemarkupBubbleBlockRule();
$blocks[] = new PhutilRemarkupEngineRemarkupTableBlockRule();
$blocks[] = new PhutilRemarkupEngineRemarkupSimpleTableBlockRule();
$blocks[] = new PhutilRemarkupEngineRemarkupDefaultBlockRule();
Index: src/markup/engine/__tests__/remarkup/bubble.txt
===================================================================
--- /dev/null
+++ src/markup/engine/__tests__/remarkup/bubble.txt
@@ -0,0 +1,5 @@
+BUBBLE: interesting **stuff**
+~~~~~~~~~~
+<div class="remarkup-bubble">interesting <strong>stuff</strong></div>
+~~~~~~~~~~
+interesting **stuff**
Index: src/markup/engine/remarkup/blockrule/PhutilRemarkupEngineRemarkupBubbleBlockRule.php
===================================================================
--- /dev/null
+++ src/markup/engine/remarkup/blockrule/PhutilRemarkupEngineRemarkupBubbleBlockRule.php
@@ -0,0 +1,42 @@
+<?php
+
+final class PhutilRemarkupEngineRemarkupBubbleBlockRule
+ extends PhutilRemarkupEngineBlockRule {
+
+ public function getMatchingLineCount(array $lines, $cursor) {
+ $num_lines = 0;
+
+ if (preg_match("/^BUBBLE: /", $lines[$cursor])) {
+ $num_lines++;
+ $cursor++;
+
+ while (isset($lines[$cursor])) {
+ if (trim($lines[$cursor])) {
+ $num_lines++;
+ $cursor++;
+ continue;
+ }
+ break;
+ }
+ }
+
+ return $num_lines;
+ }
+
+ public function markupText($text) {
+ // eat "BUBBLE: ", all 8 characters worth
+ $text = substr($text, 8);
+ $text = $this->applyRules(rtrim($text));
+
+ if ($this->getEngine()->isTextMode()) {
+ return $text;
+ }
+
+ return phutil_tag(
+ 'div',
+ array(
+ 'class' => 'remarkup-bubble',
+ ),
+ $text);
+ }
+}
Index: src/parser/xhpast/parser_nodes.php
===================================================================
--- src/parser/xhpast/parser_nodes.php
+++ src/parser/xhpast/parser_nodes.php
@@ -117,5 +117,6 @@
9110 => 'n_TRAIT_METHOD_REFERENCE',
9111 => 'n_TRAIT_AS',
9112 => 'n_YIELD',
+ 9113 => 'n_FINALLY',
);
}

File Metadata

Mime Type
text/plain
Expires
Fri, Mar 21, 7:10 PM (1 d, 7 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7715910
Default Alt Text
D8052.id18217.diff (4 KB)

Event Timeline