Allow whitespace between indent and table start tag
authorArlo Breault <abreault@wikimedia.org>
Wed, 8 Jul 2015 21:17:59 +0000 (14:17 -0700)
committerUmherirrender <umherirrender_de.wp@web.de>
Sat, 18 Jul 2015 20:41:33 +0000 (20:41 +0000)
 * \s matches the trim on the line.

 * Since leading space is ok for table start tags, and you can use them
   in ":" context, you should be able to compose the two together.

Bug: T105238
Change-Id: Id08e24e5dd2bb8ca09453adec87b21225df4a840

includes/parser/Parser.php
tests/parser/parserTests.txt

index 83c2b0c..65d8182 100644 (file)
@@ -1026,7 +1026,7 @@ class Parser {
                        $first_two = substr( $line, 0, 2 );
                        $matches = array();
 
-                       if ( preg_match( '/^(:*)\{\|(.*)$/', $line, $matches ) ) {
+                       if ( preg_match( '/^(:*)\s*\{\|(.*)$/', $line, $matches ) ) {
                                # First check if we are starting a new table
                                $indent_level = strlen( $matches[1] );
 
index 766db1e..ab33d89 100644 (file)
@@ -3677,20 +3677,26 @@ Definition Lists: Hacky use to indent tables, with comment before table
 </tr></table></dd></dl></dd></dl>
 !! end
 
-# Bug 52473
+# The trailing whitespace in this test is to catch a regression in
+# Parsoid after T54473.
 !! test
 Definition Lists: Hacky use to indent tables (WS-insensitive)
-!! options
-parsoid
 !! wikitext
 : {|
 |a
 |} 
-!! html
-<dl>
-<dd> <table><tr><td>a</td></tr></table> </dd>
-</dl>
+!! html/php
+<dl><dd><table>
+<tr>
+<td>a
+</td></tr></table></dd></dl>
+
+!! html/parsoid
+<dl><dd> <table>
+<tbody><tr><td>a</td></tr>
+</tbody></table> </dd></dl>
 !! end
+
 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
 ## as an empty dt item.  It also ignores all but the last ";" when followed
 ## by ":" later on.  So, ";" are not ignored in ";;;t3" but are ignored  in