Followup to r86064 (List with double line-breaks inside tables). Also contains patch...
authorLeo Koppelkamm <diebuche@users.mediawiki.org>
Thu, 14 Apr 2011 19:28:45 +0000 (19:28 +0000)
committerLeo Koppelkamm <diebuche@users.mediawiki.org>
Thu, 14 Apr 2011 19:28:45 +0000 (19:28 +0000)
includes/parser/Parser.php
includes/parser/Preprocessor_DOM.php
includes/parser/Preprocessor_Hash.php
tests/parser/parserTests.txt

index 6cf1e2b..822c966 100644 (file)
@@ -831,11 +831,8 @@ class Parser {
 
                        # empty line, go to next line,
                        # but only append \n if outside of table
-                       if ( $line === '' ) { 
-                               $out .= $outLine;
-                               if ( !isset( $tables[0] ) ) {
-                                       $out .= "\n";
-                               }
+                       if ( $line === '') { 
+                               $output .= $outLine . "\n";
                                continue;
                        }
                        $firstChars = $line[0];
index af16ff4..2587510 100644 (file)
@@ -521,7 +521,7 @@ class Preprocessor_DOM implements Preprocessor {
                                                'open' => $curChar,
                                                'close' => $rule['end'],
                                                'count' => $count,
-                                               'lineStart' => ($i > 0 && $text[$i-1] == "\n"),
+                                               'lineStart' => ($i == 0 || $text[$i-1] == "\n"),
                                        );
 
                                        $stack->push( $piece );
index baea681..fbbc218 100644 (file)
@@ -493,7 +493,7 @@ class Preprocessor_Hash implements Preprocessor {
                                                'open' => $curChar,
                                                'close' => $rule['end'],
                                                'count' => $count,
-                                               'lineStart' => ($i > 0 && $text[$i-1] == "\n"),
+                                               'lineStart' => ($i == 0 || $text[$i-1] == "\n"),
                                        );
 
                                        $stack->push( $piece );
index af62b25..6f5b343 100644 (file)
@@ -1433,6 +1433,37 @@ Table with list inside
 </tr>
 </table>
 
+!! end
+!! test
+Table with broken up list inside
+!! input
+{|
+|style="width: 5em; text-align: center"| gives
+|style="border: 1px dashed #2F6FAB; padding: 0.5em; margin: 0.5em"|
+# Some
+# list
+# Lorem
+
+# ipsum
+# dolor
+|}
+!! result
+<table>
+<tr>
+<td style="width: 5em; text-align: center">gives
+</td>
+<td style="border: 1px dashed #2F6FAB; padding: 0.5em; margin: 0.5em">
+<ol><li> Some
+</li><li> list
+</li><li> Lorem
+</li></ol>
+<ol><li> ipsum
+</li><li> dolor
+</li></ol>
+</td>
+</tr>
+</table>
+
 !! end
 !! test
 Simple paragraph
@@ -1780,6 +1811,8 @@ Arbitrary whitespace should not be prepended
 <td>1
 </td>
 <td>2
+<p><br />
+</p>
 </td>
 </tr>
 <tr>
@@ -3373,6 +3406,35 @@ section=1
 ==Section 1==
 !! result
 ==Section 1==
+!! end
+!! article
+Template:Top-level template
+!! text
+{{Nested template}}
+!! endarticle
+
+!! article
+Template:Nested template
+!! text
+*Item 1
+*Item 2
+!! endarticle
+
+!! test
+Line-start flag in a nested template call
+!! input
+*Item A
+*Item B
+
+{{Top-level template}}
+!! result
+<ul><li>Item A
+</li><li>Item B
+</li></ul>
+<ul><li>Item 1
+</li><li>Item 2
+</li></ul>
+
 !! end
 
 ###
@@ -5928,6 +5990,7 @@ http://===r:::https://b
 
 !!result
 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
+</p><p><br />
 </p>
 !! end
 
@@ -5966,7 +6029,7 @@ MOVE YOUR MOUSE CURSOR OVER THIS TEXT
 <p>{{{|
 <u class="&#124;">}}}} &gt;
 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
-MOVE YOUR MOUSE CURSOR OVER THIS TEXT
+</p><p>MOVE YOUR MOUSE CURSOR OVER THIS TEXT
 </p>
 <table>
 <tr>