From 0b4208e645b7945bebe3faa480f8b67eaa764b9c Mon Sep 17 00:00:00 2001 From: Arlo Breault Date: Wed, 8 Jul 2015 14:17:59 -0700 Subject: [PATCH] Allow whitespace between indent and table start tag * \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 | 2 +- tests/parser/parserTests.txt | 20 +++++++++++++------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php index 83c2b0c253..65d8182151 100644 --- a/includes/parser/Parser.php +++ b/includes/parser/Parser.php @@ -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] ); diff --git a/tests/parser/parserTests.txt b/tests/parser/parserTests.txt index 766db1ea96..ab33d89fff 100644 --- a/tests/parser/parserTests.txt +++ b/tests/parser/parserTests.txt @@ -3677,20 +3677,26 @@ Definition Lists: Hacky use to indent tables, with comment before table !! 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 -
-
a
-
+!! html/php +
+ +
a +
+ +!! html/parsoid +
+ +
a
!! 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 -- 2.20.1