Page MenuHomePhabricator

Serialise empty list items into a blank line(?)
Open, MediumPublic

Description

VE should be smart enough not to produce empty list items (lines with only a * at the beginning of the line) in the end result.
It results in unnecessary complex wikitext and poor syntax.

Example:
https://fr.wikipedia.org/w/index.php?title=Bruno_Geneste&diff=113727662&oldid=112848475 (ligne 29 in the result)

Event Timeline

NicoV raised the priority of this task from to Needs Triage.
NicoV updated the task description. (Show Details)
NicoV subscribed.
Jdforrester-WMF renamed this task from Prevent VE from creating empty list items to Serialise empty list items into a blank line(?).Apr 15 2015, 6:56 PM
Jdforrester-WMF edited projects, added Parsoid; removed VisualEditor.
Jdforrester-WMF set Security to None.

I am not convinced that this is a Parsoid thing. We have an unrelated bug where empty list items show up in wikitext and Parsoid loses them (https://www.mediawiki.org/wiki/Parsoid/Round-trip_testing/Diffs#Empty_list_items_lost_in_RTing). So, if empty list items are supposed to be converted to empty lines, why do empty list items exist in wikitext? Are they to be considered markup errors that bots and other AWB tools should clean up?

But, all that said, a html2html-unsafe normalization mode is almost ready in Parsoid. We can include all these cleanup tasks that VE wants which would be enabled via an API flag to html2wt serialization.

The eat-empty-list-items thing is really a tidy bug that everybody has started to rely on. Tidy is hopefully going away, so I'd recommend to not emulate its behavior.

@NicoV, why do you think VE or Parsoid should be doing anything with this at all? There are pages out there right now that have empty list items in wikitext. Is this a wikitext style issue? Is it currently enforced on wikis? Is it specific to frwiki or is it a pan-wiki standard? In that context, see https://lists.wikimedia.org/pipermail/wikitech-l/2015-April/081453.html .. would appreciate your input to my questions there as well.

Hi, I opened this task only because this seems to be quite frequent with VE edit, a lot more than with wikitext editing.

I don't think this is currently enforced, at least not on frwiki, but this is something that is probably fixed when someone edits the page.
I doubt any of them is correct (in terms of the article layout), I don't see why an empty list item is desirable in any case.

To answer the question, I tried for the first time VE to edit list items to understand why this happens so frequently.
One thing that would probably help a lot is to have VE behave more smartly (like MS Word or Open Office) : when you hit Enter on a empty list item, instead of keeping the list item and creating a second empty list item, just replace the empty list item by an empty line. That's what MS Word or Open Office do, and it seems a good way of dealing with empty list items, and greatly helps in avoiding to get many empty list items one after an other...

I'm not too favorable for Parsoid removing on its own empty list items in places not edited by user, and empty list items are needed when editing (that's the first step of creating a list item with something...)
In fact, in most of this kind of issues, I do believe that it's not a Parsoid problem, but rather a problem of VE not behaving smartly.

ssastry triaged this task as Medium priority.Apr 16 2015, 3:00 PM

The eat-empty-list-items thing is really a tidy bug that everybody has started to rely on. Tidy is hopefully going away, so I'd recommend to not emulate its behavior.

Flash forward to today's CSS3 and the pseudo-class :empty (info)

Applying...

li:empty {
	display: none;
}

... "strips" (more-accurately: hides) empty LI tags rather than rendering them, while...

li:empty {
	display: list-item !important;
}

... forces empty LI tags to render.

Add other css3 attributes like nth-of-type &/or nth-child into the mix and one can easily see its now possible to isolate any empty tags in question and set them to render (or not) on a case by case basis.

Why not just define this/these nuance(s) in CSS and stop Tidy (and Parsoid?) from meddling with this once and for all?

The eat-empty-list-items thing is really a tidy bug that everybody has started to rely on. Tidy is hopefully going away, so I'd recommend to not emulate its behavior.

Flash forward to today's CSS3 and the pseudo-class :empty (info)
...
Why not just define this/these nuance(s) in CSS and stop Tidy (and Parsoid?) from meddling with this once and for all?

Yes, I think that makes sense as well. Related: T89331#1554679

The problem with empty lines with only a * at the beginning, is not just the display, but also the ease of wikitext editing : CSS will only help with the display, not the underlying problem, that is unnecessary complex wikitext.