Page MenuHomePhabricator

D15466.id.diff
No OneTemporary

D15466.id.diff

diff --git a/src/markup/engine/__tests__/remarkup/simple-table-with-leading-space.txt b/src/markup/engine/__tests__/remarkup/simple-table-with-leading-space.txt
new file mode 100644
--- /dev/null
+++ b/src/markup/engine/__tests__/remarkup/simple-table-with-leading-space.txt
@@ -0,0 +1,7 @@
+ |a|b|
+~~~~~~~~~~
+<div class="remarkup-table-wrap"><table class="remarkup-table">
+<tr><td>a</td><td>b</td></tr>
+</table></div>
+~~~~~~~~~~
+| a | b |
diff --git a/src/markup/engine/__tests__/remarkup/table-with-leading-space.txt b/src/markup/engine/__tests__/remarkup/table-with-leading-space.txt
new file mode 100644
--- /dev/null
+++ b/src/markup/engine/__tests__/remarkup/table-with-leading-space.txt
@@ -0,0 +1,7 @@
+ <table><tr><td>cell</td></tr></table>
+~~~~~~~~~~
+<div class="remarkup-table-wrap"><table class="remarkup-table">
+<tr><td>cell</td></tr>
+</table></div>
+~~~~~~~~~~
+| cell |
diff --git a/src/markup/engine/remarkup/blockrule/PhutilRemarkupSimpleTableBlockRule.php b/src/markup/engine/remarkup/blockrule/PhutilRemarkupSimpleTableBlockRule.php
--- a/src/markup/engine/remarkup/blockrule/PhutilRemarkupSimpleTableBlockRule.php
+++ b/src/markup/engine/remarkup/blockrule/PhutilRemarkupSimpleTableBlockRule.php
@@ -5,7 +5,7 @@
public function getMatchingLineCount(array $lines, $cursor) {
$num_lines = 0;
while (isset($lines[$cursor])) {
- if (preg_match('/^(\|.*+\n?)+$/', $lines[$cursor])) {
+ if (preg_match('/^(\s*\|.*+\n?)+$/', $lines[$cursor])) {
$num_lines++;
$cursor++;
} else {
diff --git a/src/markup/engine/remarkup/blockrule/PhutilRemarkupTableBlockRule.php b/src/markup/engine/remarkup/blockrule/PhutilRemarkupTableBlockRule.php
--- a/src/markup/engine/remarkup/blockrule/PhutilRemarkupTableBlockRule.php
+++ b/src/markup/engine/remarkup/blockrule/PhutilRemarkupTableBlockRule.php
@@ -5,7 +5,7 @@
public function getMatchingLineCount(array $lines, $cursor) {
$num_lines = 0;
- if (preg_match('/^<table>/i', $lines[$cursor])) {
+ if (preg_match('/^\s*<table>/i', $lines[$cursor])) {
$num_lines++;
$cursor++;
@@ -24,7 +24,7 @@
public function markupText($text, $children) {
$matches = array();
- if (!preg_match('@^<table>(.*)</table>$@si', $text, $matches)) {
+ if (!preg_match('@^\s*<table>(.*)</table>$@si', $text, $matches)) {
return $this->fail(
$text,
pht('Bad table (expected %s)', '<table>...</table>'));

File Metadata

Mime Type
text/plain
Expires
Sat, Mar 29, 9:14 AM (1 w, 11 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7384074
Default Alt Text
D15466.id.diff (2 KB)

Event Timeline