Empty list items goes missing in the PHP parser when tidy is enabled
Open, NormalPublic

Description

Take a look at the URL.

When you see the output page, the list has three items. If you edit it in the source editor, you'll see that there's an extra empty item in the end of the list. If you edit it in the VisualEditor, you'll see it rendered.

The VisualEditor behavior actually makes more sense to me. Gabriel Wicke suggested on IRC to open this issue at the PHP parser.


Version: 1.22.0
Severity: normal
URL: https://www.mediawiki.org/wiki/VisualEditor:Empty_list_item

bzimport set Reference to bz47673.
bzimport added a subscriber: Unknown Object (MLST).
Amire80 created this task.Apr 25 2013, 10:17 PM
  • Bug 52374 has been marked as a duplicate of this bug. ***

I'm going to introduce a migration tool to fix this bug, roughly following @cscott's suggestion, which is to preserve empty <li> tags through Tidy, but to add a class to those preserved elements which will be styled with display:none. It is believed that there are some templates which are producing empty list items because it is convenient for them as a way of omitting the list item for empty input. After the display:none hack is introduced, a user script would allow the expected changes to be visible to template maintainers. There is also a proposed change to log affected templates: https://gerrit.wikimedia.org/r/#/c/246106

After a suitable migration period, the display:none rule would be removed, and list items would be visible as is desired by the multiple reporters of this bug.

The empty <li> tags would be preserved through tidy by adding a datafld attribute, exploiting special case behaviour in Tidy's CanPrune() which was intended to fix http://sourceforge.net/p/tidy/bugs/337/

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptOct 14 2015, 3:12 AM

Change 246148 had a related patch set uploaded (by Tim Starling):
Client-side migration for empty li preservaton

https://gerrit.wikimedia.org/r/246148

Change 246148 merged by jenkins-bot:
Client-side migration for empty li preservation

https://gerrit.wikimedia.org/r/246148

He7d3r added a subscriber: He7d3r.Oct 30 2015, 12:53 PM
Ltrlg added a subscriber: Ltrlg.Nov 1 2015, 12:12 AM

I don't have the gerrit skills to parse the code to understand whether this change will allow a page to emit a tracking category specific to monitor articles and templates that need to be updated. If it will, some instruction would be helpful. If it currently will not, please make whatever code modification is necessary to allow a page to emit such a tracking category. Thank you.

Jarekt added a subscriber: Jarekt.Nov 10 2015, 1:11 PM

This tasks seems to be related to a lot of odd looking [[Template:Authority control]] templates that use hlists which suddenly started showing rows of dots between entries

  1. Commons issues and the fix was discussed at https://www.mediawiki.org/wiki/Talk:Snippets/Horizontal_lists
  2. Czech Wiki opted for rewriting the template https://cs.wikipedia.org/wiki/%C5%A0ablona:Autoritn%C3%AD_data?diff=13027629&oldid=12931367
  3. Other wikis were spared because they already rewrote the template in Lua
Beta16 added a subscriber: Beta16.Nov 16 2015, 10:28 AM

The CSS trick for do not display element with mw-empty-li class works only for Desktop, not in mobile version.

It's possible in this transitory period hide the empty list elements also in mobile site? Thanks

See discussion (in italian) and example.

Change 253514 had a related patch set uploaded (by Legoktm):
Add 'mobile' target to 'mediawiki.raggett' module

https://gerrit.wikimedia.org/r/253514

Change 253514 merged by jenkins-bot:
Add 'mobile' target to 'mediawiki.raggett' module

https://gerrit.wikimedia.org/r/253514

I don't have the gerrit skills to parse the code to understand whether this change will allow a page to emit a tracking category specific to monitor articles and templates that need to be updated. If it will, some instruction would be helpful. If it currently will not, please make whatever code modification is necessary to allow a page to emit such a tracking category. Thank you.

There's no tracking category at the moment. I wanted to assess it myself, to determine the size of the problem, before creating task lists for others to work through.

Here is a log sample from parsoid listing some supposedly empty <li> elements. I have analysed some of them.

Here is a notable example of a template which depends on empty li removal. This navbox template allows the removal of countries from Europe depending on parameters. For example if you consider Germany to not be part of Europe, you can use {{Europe topic|DE=}} to make a navbox which omits the relevant list item. Note that you can't just take the asterisk inside the #if, because that would create paragraph breaks between adjacent list items. It could be done by taking the line break inside the #if, or by removing all the line breaks and using HTML-style <li> input.

tstarling added a comment.EditedNov 24 2015, 6:30 AM

It would be easier to fix such templates if we finally got around to allowing blank lines between list items without breaking the list. This has been requested very often, although unfortunately the narrower, more sensible proposals on the subject (e.g. T11342, T35918, T15223) have been closed as duplicates in favour of the more aggressive proposal T3115.

ssastry moved this task from Backlog to In Progress on the MediaWiki-Parser board.Dec 17 2015, 5:56 PM
Danny_B removed a subscriber: wikibugs-l-list.

Add Comment