Followup to r86064 (List with double line-breaks inside tables). Also contains patch for Bug 16700 by Mormegil (Additional linebreak though nested templates). Parsertests for both

This commit is contained in:
Leo Koppelkamm 2011-04-14 19:28:45 +00:00
parent 2f9fe25709
commit b4ec34def9
4 changed files with 68 additions and 8 deletions

View 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];

View 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 );

View 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 );

View 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>