File tree 4 files changed +17
-3
lines changed
4 files changed +17
-3
lines changed Original file line number Diff line number Diff line change
1
+ |a|b|
2
+ ~~~~~~~~~~
3
+ <div class="remarkup-table-wrap"><table class="remarkup-table">
4
+ <tr><td>a</td><td>b</td></tr>
5
+ </table></div>
6
+ ~~~~~~~~~~
7
+ | a | b |
Original file line number Diff line number Diff line change
1
+ <table><tr><td>cell</td></tr></table>
2
+ ~~~~~~~~~~
3
+ <div class="remarkup-table-wrap"><table class="remarkup-table">
4
+ <tr><td>cell</td></tr>
5
+ </table></div>
6
+ ~~~~~~~~~~
7
+ | cell |
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ final class PhutilRemarkupSimpleTableBlockRule extends PhutilRemarkupBlockRule {
5
5
public function getMatchingLineCount (array $ lines , $ cursor ) {
6
6
$ num_lines = 0 ;
7
7
while (isset ($ lines [$ cursor ])) {
8
- if (preg_match ('/^(\|.*+\n?)+$/ ' , $ lines [$ cursor ])) {
8
+ if (preg_match ('/^(\s*\ |.*+\n?)+$/ ' , $ lines [$ cursor ])) {
9
9
$ num_lines ++;
10
10
$ cursor ++;
11
11
} else {
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ final class PhutilRemarkupTableBlockRule extends PhutilRemarkupBlockRule {
5
5
public function getMatchingLineCount (array $ lines , $ cursor ) {
6
6
$ num_lines = 0 ;
7
7
8
- if (preg_match ('/^<table>/i ' , $ lines [$ cursor ])) {
8
+ if (preg_match ('/^\s* <table>/i ' , $ lines [$ cursor ])) {
9
9
$ num_lines ++;
10
10
$ cursor ++;
11
11
@@ -24,7 +24,7 @@ public function getMatchingLineCount(array $lines, $cursor) {
24
24
public function markupText ($ text , $ children ) {
25
25
$ matches = array ();
26
26
27
- if (!preg_match ('@^<table>(.*)</table>$@si ' , $ text , $ matches )) {
27
+ if (!preg_match ('@^\s* <table>(.*)</table>$@si ' , $ text , $ matches )) {
28
28
return $ this ->fail (
29
29
$ text ,
30
30
pht ('Bad table (expected %s) ' , '<table>...</table> ' ));
You can’t perform that action at this time.
0 commit comments