From: Arlo Breault Date: Thu, 12 Jul 2018 18:41:20 +0000 (-0400) Subject: Put
/
/
  • in the always-suppressing category of doBlockLevels X-Git-Tag: 1.34.0-rc.0~4786^2 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/banques/%22http:/wikimediafoundation.org/fundraising/%7B%7B%20url_for%28%27user_settings%27%2C%20userid=session.userid%29%20%7D%7D?a=commitdiff_plain;h=ce9f5c2546ffe3fe2f44d3990c1aadb30d52f42c;p=lhc%2Fweb%2Fwiklou.git Put
    /
    /
  • in the always-suppressing category of doBlockLevels 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 --- diff --git a/includes/Linker.php b/includes/Linker.php index e625a02578..3f0ecf6fb6 100644 --- a/includes/Linker.php +++ b/includes/Linker.php @@ -1496,7 +1496,7 @@ class Linker { * @return string */ public static function tocIndent() { - return "\n
      "; + return "\n
        \n"; } /** @@ -1527,9 +1527,9 @@ class Linker { $classes .= " tocsection-$sectionIndex"; } - // \n
      • + //
      • // $tocnumber $tocline - return "\n" . Html::openElement( 'li', [ 'class' => $classes ] ) + return Html::openElement( 'li', [ 'class' => $classes ] ) . Html::rawElement( 'a', [ 'href' => "#$anchor" ], Html::element( 'span', [ 'class' => 'tocnumber' ], $tocnumber ) diff --git a/includes/parser/BlockLevelPass.php b/includes/parser/BlockLevelPass.php index c3669032d3..0553db9ea6 100644 --- a/includes/parser/BlockLevelPass.php +++ b/includes/parser/BlockLevelPass.php @@ -293,7 +293,7 @@ class BlockLevelPass { # @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'; @@ -301,7 +301,7 @@ class BlockLevelPass { '/<(' . "({$blockElems})|\\/({$antiBlockElems})|" // Always suppresses - . '\\/?(tr)' + . '\\/?(tr|dt|dd|li)' . ')\\b/iS', $t ); diff --git a/tests/parser/parserTests.txt b/tests/parser/parserTests.txt index 43b4572732..925af6f8b4 100644 --- a/tests/parser/parserTests.txt +++ b/tests/parser/parserTests.txt @@ -9932,7 +9932,7 @@ List interrupted by empty line or heading !!end -!!test +!! test Multiple list tags generated by templates !! wikitext {{echo|
      • }}a @@ -9945,6 +9945,7 @@ Multiple list tags generated by templates
      • + !! html+tidy
      • a
      • b @@ -9954,7 +9955,44 @@ Multiple list tags generated by templates
      • a
      • b
      • c
      • -!!end +!! end + +!! test +Multiple newlines in between HTML list items don't induce paragraph wrapping +!! wikitext +
          +
        • hi
        • + + + + +
        • ho
        • +
        + +
        +
        hi
        +
        ho
        123
        +
        + + +
        +!! html/php+tidy +
          +
        • hi
        • + + + + +
        • ho
        • +
        +
        +
        hi
        +
        ho
        123
        +
        + + +
        +!! end !!test Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines