Page MenuHomePhabricator

D10972.id26348.diff
No OneTemporary

D10972.id26348.diff

diff --git a/src/markup/engine/__tests__/remarkup/horizonal-rule.txt b/src/markup/engine/__tests__/remarkup/horizonal-rule.txt
--- a/src/markup/engine/__tests__/remarkup/horizonal-rule.txt
+++ b/src/markup/engine/__tests__/remarkup/horizonal-rule.txt
@@ -9,6 +9,8 @@
---
- - - - - - -
+
+ ---
~~~~~~~~~~
<hr class="remarkup-hr" />
@@ -21,15 +23,19 @@
<hr class="remarkup-hr" />
<hr class="remarkup-hr" />
-~~~~~~~~~~
-<hr class="remarkup-hr" />
<hr class="remarkup-hr" />
+~~~~~~~~~~
+___
-<hr class="remarkup-hr" />
+_____
-<hr class="remarkup-hr" />
+***
-<hr class="remarkup-hr" />
+* * * * * * *
-<hr class="remarkup-hr" />
+---
+
+- - - - - - -
+
+ ---
diff --git a/src/markup/engine/__tests__/remarkup/percent-block-oneline.txt b/src/markup/engine/__tests__/remarkup/percent-block-oneline.txt
--- a/src/markup/engine/__tests__/remarkup/percent-block-oneline.txt
+++ b/src/markup/engine/__tests__/remarkup/percent-block-oneline.txt
@@ -1,5 +1,11 @@
%%%[[http://hello | world]] **bold**%%%
+
+ %%%[[http://hello | world]] **bold**%%%
~~~~~~~~~~
[[http://hello | world]] **bold**
+
+[[http://hello | world]] **bold**
~~~~~~~~~~
[[http://hello | world]] **bold**
+
+[[http://hello | world]] **bold**
diff --git a/src/markup/engine/remarkup/blockrule/PhutilRemarkupHorizontalRuleBlockRule.php b/src/markup/engine/remarkup/blockrule/PhutilRemarkupHorizontalRuleBlockRule.php
--- a/src/markup/engine/remarkup/blockrule/PhutilRemarkupHorizontalRuleBlockRule.php
+++ b/src/markup/engine/remarkup/blockrule/PhutilRemarkupHorizontalRuleBlockRule.php
@@ -13,7 +13,7 @@
public function getMatchingLineCount(array $lines, $cursor) {
$num_lines = 0;
- $pattern = '/^_{3,}$|^\*\s?\*\s?\*(\s|\*)*$|^\-\s?\-\s?\-(\s|\-)*$/';
+ $pattern = '/^\s*(?:_{3,}|\*\s?\*\s?\*(\s|\*)*|\-\s?\-\s?\-(\s|\-)*)$/';
if (preg_match($pattern, rtrim($lines[$cursor], "\n\r"))) {
$num_lines++;
$cursor++;
@@ -27,6 +27,10 @@
}
public function markupText($text, $children) {
+ if ($this->getEngine()->isTextMode()) {
+ return rtrim($text);
+ }
+
return phutil_tag('hr', array('class' => 'remarkup-hr'));
}
diff --git a/src/markup/engine/remarkup/blockrule/PhutilRemarkupLiteralBlockRule.php b/src/markup/engine/remarkup/blockrule/PhutilRemarkupLiteralBlockRule.php
--- a/src/markup/engine/remarkup/blockrule/PhutilRemarkupLiteralBlockRule.php
+++ b/src/markup/engine/remarkup/blockrule/PhutilRemarkupLiteralBlockRule.php
@@ -4,7 +4,7 @@
public function getMatchingLineCount(array $lines, $cursor) {
$num_lines = 0;
- if (preg_match('/^%%%/', $lines[$cursor])) {
+ if (preg_match('/^\s*%%%/', $lines[$cursor])) {
$num_lines++;
while (isset($lines[$cursor])) {
@@ -15,13 +15,25 @@
}
break;
}
+
+ $cursor++;
+
+ while (isset($lines[$cursor])) {
+ if (!strlen(trim($lines[$cursor]))) {
+ $num_lines++;
+ $cursor++;
+ continue;
+ }
+ break;
+ }
+
}
return $num_lines;
}
public function markupText($text, $children) {
- $text = preg_replace('/%%%\s*$/', '', substr($text, 3));
+ $text = preg_replace('/^\s*%%%(.*)%%%\s*\z/s', '\1', $text);
if ($this->getEngine()->isTextMode()) {
return $text;
}

File Metadata

Mime Type
text/plain
Expires
Tue, Mar 25, 10:04 PM (1 w, 3 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7475830
Default Alt Text
D10972.id26348.diff (3 KB)

Event Timeline