From: Platonides
Date: Mon, 26 Jul 2010 22:29:20 +0000 (+0000)
Subject: Insert a new line in between when adding in tables.
X-Git-Tag: 1.31.0-rc.0~35899
X-Git-Url: https://git.heureux-cyclage.org/?a=commitdiff_plain;h=c7e85a5e04b4bba68222e79fbca67878af164b5d;p=lhc%2Fweb%2Fwiklou.git
Insert a new line in between when adding | in tables.
This is html neutral, but helps the parser to realise that things should be broken there.
Fixes the tag nesting issues of the [ftp://|x||]] parser test.
Parser16 test still has its own tag bug.
---
diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php
index 4d16393125..c160e72775 100644
--- a/includes/parser/Parser.php
+++ b/includes/parser/Parser.php
@@ -945,7 +945,7 @@ class Parser {
$last_tag = array_pop( $last_tag_history );
if ( array_pop( $td_history ) ) {
- $previous = "{$last_tag}>{$previous}";
+ $previous = "{$last_tag}>\n{$previous}";
}
if ( $first_character === '|' ) {
diff --git a/maintenance/parserTests.txt b/maintenance/parserTests.txt
index f651e38c6b..bd08eddf3c 100644
--- a/maintenance/parserTests.txt
+++ b/maintenance/parserTests.txt
@@ -1133,10 +1133,12 @@ Simple table
!! result
- 1 | 2
+ | 1 |
+ 2
|
- 3 | 4
+ | 3 |
+ 4
|
!! end
@@ -1169,27 +1171,45 @@ Multiplication table
Multiplication table
|
- × | 1 | 2 | 3
+ | × |
+ 1 |
+ 2 |
+ 3
|
1
- | 1 | 2 | 3
+
+ | 1 |
+ 2 |
+ 3
|
2
- | 2 | 4 | 6
+
+ | 2 |
+ 4 |
+ 6
|
3
- | 3 | 6 | 9
+
+ | 3 |
+ 6 |
+ 9
|
4
- | 4 | 8 | 12
+
+ | 4 |
+ 8 |
+ 12
|
5
- | 5 | 10 | 15
+
+ | 5 |
+ 10 |
+ 15
|
!! end
@@ -1209,12 +1229,15 @@ Table rowspan
Cell 1, row 1
- | Cell 2, row 1 (and 2)
- | Cell 3, row 1
+ |
+ Cell 2, row 1 (and 2)
+ |
+ Cell 3, row 1
|
Cell 1, row 2
- | Cell 3, row 2
+ |
+ Cell 3, row 2
|
!! end
@@ -1236,7 +1259,8 @@ Nested table
α
- |
+ |
+
nested
@@ -1244,7 +1268,8 @@ Nested table
|
table
|
- | the original table again
+ |
+the original table again
|
!! end
@@ -1264,20 +1289,16 @@ Invalid attributes in table cell (bug 1830)
!! end
-# FIXME: It's not clear at all that this is the result we want, but the actual
-# output right now is invalid XML, so clearly something is wrong. The result
-# specified here is now valid XML, which is an improvement . . .
!! test
Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
-!! options
-disabled
!! input
{|
| |[ftp://|x||]" onmouseover="alert(document.cookie)">test
!! result
-ftp://%7Cx | " onmouseover="alert(document.cookie)">test
+ | [ftp://%7Cx |
+]" onmouseover="alert(document.cookie)">test
|
@@ -2567,10 +2588,12 @@ foo {{table}}
- 1 | 2
+ | 1 |
+ 2
|
- 3 | 4
+ | 3 |
+ 4
|
!! end
@@ -2585,10 +2608,12 @@ foo
- 1 | 2
+ | 1 |
+ 2
|
- 3 | 4
+ | 3 |
+ 4
|
!! end
@@ -5180,7 +5205,10 @@ noxml
!! result
-https:// | | |
+ | https:// |
+ |
+ |
+
|
@@ -5197,7 +5225,8 @@ Fuzz testing: Parser21
@@ -7347,10 +7376,12 @@ y
- 1 | 2
+ | 1 |
+ 2
|
- 3 | 4
+ | 3 |
+ 4
|
y