Page MenuHomePhabricator

Line breaks changes behavior of "#" inside of tables: it generates bulleted lists instead of an ordered one
Closed, InvalidPublic

Description

Parser bug

See the link above and/or the attached screenshot.

The second example is converted correctly by Parsoid, but the first is still broken:
http://parsoid.wmflabs.org/_rt/pt/Project:P%C3%A1gina_de_testes/1?oldid=32235099


Version: unspecified
Severity: normal
URL: https://pt.wikipedia.org/wiki/Project:P%C3%A1gina_de_testes/1?oldid=32235034&uselang=en

Attached:

Parser_bug.png (742×297 px, 30 KB)

Details

Reference
bz40274

Event Timeline

bzimport raised the priority of this task from to Low.Nov 22 2014, 12:55 AM
bzimport set Reference to bz40274.
bzimport added a subscriber: Unknown Object (MLST).

For the record, I found this while I was trying to fix the rendering of the second and third groups of a navbox:
https://pt.wikipedia.org/w/index.php?title=Wikip%C3%A9dia:P%C3%A1gina_de_testes/1&oldid=32234126&action=edit&preview=yes

richardg_uk wrote:

Raised by [[User:Edokter]] at [[Wikipedia:Village pump (technical)#Old_parser_bug.3F]], with a navbox example showing the parser use a single <ol>...</ol> container for adjacent * and # lists even though are in different div elements within different cells or different rows of a wikitable.

Where block elements have closing tags that are not at the start of a separate line, the parser wrongly treats list items within different containers as part of a single list.

Consequently, the browser sees tag soup and assumes there are separate lists, treating the second or subsequent block of <li> elements as contained by an implicit <ul>...</ul>. (Equivalently, if HTML Tidy is active, it attempts to correct the inconsistency by closing the first list, inserting <ul>...</ul> tags around the second and subsequent lists and removing any trailing </ol> tag.)

As a side effect, any ordered lists that are not in the first block are rendered as unordered lists, because their list items have no explicit <ol> tags.

The parser needs to learn that list items within different block-level elements are separate lists, and insert container list tags in the appropriate places accordingly.

I fixed navbox so that list items always ocupy there own line, that fixes the problem.

For reference:

Incorrect:
<div>

  1. list item 1
  2. list item 2</div>

Correct:
<div>

  1. list item 1
  2. list item 2

</div>

It it essentially bad wiki formatting to include closing tags on the same line as wiki list items. So I'm closing this.