This is a clarification of what already happens in practice for lists
generated from wikitext syntax, since that parsing happens
simultaneously.
Parsoid, for its part, does list handling prior to paragraph wrapping,
so must make use of these definitions.
Further, this helps reduce paragraph wrapping in interstitial spacing of
lists from HTML syntax, as spec'd in the tests, though the possibility
isn't eliminated entirely.
The TOC generation code is altered to reduce the number of newlines
emitted in between list items, since those are now left intact.
Change-Id: I6888b6e8e6768b0737565b87924fefa5a06ebd18
* @return string
*/
public static function tocIndent() {
* @return string
*/
public static function tocIndent() {
$classes .= " tocsection-$sectionIndex";
}
$classes .= " tocsection-$sectionIndex";
}
- // \n<li class="$classes"><a href="#$anchor"><span class="tocnumber">
+ // <li class="$classes"><a href="#$anchor"><span class="tocnumber">
// $tocnumber</span> <span class="toctext">$tocline</span></a>
// $tocnumber</span> <span class="toctext">$tocline</span></a>
- return "\n" . Html::openElement( 'li', [ 'class' => $classes ] )
+ return Html::openElement( 'li', [ 'class' => $classes ] )
. Html::rawElement( 'a',
[ 'href' => "#$anchor" ],
Html::element( 'span', [ 'class' => 'tocnumber' ], $tocnumber )
. Html::rawElement( 'a',
[ 'href' => "#$anchor" ],
Html::element( 'span', [ 'class' => 'tocnumber' ], $tocnumber )
# @todo consider using a stack for nestable elements like span, table and div
// P-wrapping and indent-pre are suppressed inside, not outside
# @todo consider using a stack for nestable elements like span, table and div
// P-wrapping and indent-pre are suppressed inside, not outside
- $blockElems = 'table|h1|h2|h3|h4|h5|h6|pre|p|ul|ol|dl|li';
+ $blockElems = 'table|h1|h2|h3|h4|h5|h6|pre|p|ul|ol|dl';
// P-wrapping and indent-pre are suppressed outside, not inside
$antiBlockElems = 'td|th';
// P-wrapping and indent-pre are suppressed outside, not inside
$antiBlockElems = 'td|th';
'/<('
. "({$blockElems})|\\/({$antiBlockElems})|"
// Always suppresses
'/<('
. "({$blockElems})|\\/({$antiBlockElems})|"
// Always suppresses
Multiple list tags generated by templates
!! wikitext
{{echo|<li>}}a
Multiple list tags generated by templates
!! wikitext
{{echo|<li>}}a
!! html+tidy
<li>a
</li><li>b
!! html+tidy
<li>a
</li><li>b
<li about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","autoInsertedEnd":true,"dsr":[0,44,null,null],"pi":[[{"k":"1"}],[{"k":"1"}],[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<li>"}},"i":0}},"a\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<li>"}},"i":1}},"b\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<li>"}},"i":2}},"c"]}'>a
</li><li about="#mwt1">b
</li><li about="#mwt1" data-parsoid='{"stx":"html","autoInsertedEnd":true,"dsr":[null,44,null,0]}'>c</li>
<li about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","autoInsertedEnd":true,"dsr":[0,44,null,null],"pi":[[{"k":"1"}],[{"k":"1"}],[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<li>"}},"i":0}},"a\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<li>"}},"i":1}},"b\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<li>"}},"i":2}},"c"]}'>a
</li><li about="#mwt1">b
</li><li about="#mwt1" data-parsoid='{"stx":"html","autoInsertedEnd":true,"dsr":[null,44,null,0]}'>c</li>
+!! end
+
+!! test
+Multiple newlines in between HTML list items don't induce paragraph wrapping
+!! wikitext
+<ul>
+<li>hi</li>
+
+
+
+
+<li>ho</li>
+</ul>
+
+<dl>
+<dt>hi</dt>
+<dd>ho<div>123</div>
+</dd>
+
+
+</dl>
+!! html/php+tidy
+<ul>
+<li>hi</li>
+
+
+
+
+<li>ho</li>
+</ul>
+<dl>
+<dt>hi</dt>
+<dd>ho<div>123</div>
+</dd>
+
+
+</dl>
+!! end
!!test
Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
!!test
Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines