Page MenuHomePhabricator

Styled nowiki added
Closed, ResolvedPublic8 Estimated Story Points

Description

There has to be an existing task about this but I can't seem to find it.

In https://en.wikipedia.org/w/index.php?diff=662007607, the following line was added:
* [[Proton beam writing|'''Proton beam writing''']] '''<nowiki/>'''uses a focused beam of high energy…

This issue us similar to T98887 in that it resulted in an empty styled nowiki, but the cause seems to be different (there weren't any pre-existing unbalanced quotes in this case).

Event Timeline

gpaumier raised the priority of this task from to Needs Triage.
gpaumier updated the task description. (Show Details)
gpaumier added a subscriber: gpaumier.

This is newly inserted content. Parsoid received empty <b> content, i.e .<b></b> and the only way to serialize that would be to insert a <nowiki/> there. So, this is more an issue of VE generating an empty bold annotation.

This is newly inserted content. Parsoid received empty <b> content, i.e .<b></b> and the only way to serialize that would be to insert a <nowiki/> there. So, this is more an issue of VE generating an empty bold annotation.

Certainly that would cause Parsoid to emit this, but VE doesn't have a way to apply <b> annotations to a zero-length string, so I'm not sure that was what happened? @Esanders, thoughts?

I encountered this bug in my volunteer editing, and after literally two hours I have now figured out how to consistently reproduce it (in both Firefox and Chrome)! I use bolding in my instructions below, but it works with italics as well. Doing it with other types of annotations will produce empty style tags (e.g. <sub></sub>), but not, of course, a <nowiki/>.

Instructions

  1. Create a VE document consisting of two words (let's call them A and B) with a space in between, all bold (equivalent to a wikitext of '''A B''').
  2. Select A (but not the space following it) and unbold it.
  3. Move your cursor directly before B (not directly after A) and add a space.
  4. Select that space (the second one between A and B, not the first) and hit bold.

And voilà! This gives us the linear model data

0. paragraph
1. A
2.   [{"type":"textStyle/bold"}]
3.  
4. B [{"type":"textStyle/bold"}]
5. /paragraph

which parses into wikitext as A '''<nowiki/>''' '''B'''.

This was probably caused by 8dc8b266761dd424e386968f8c8f171d4eaa4461. The linmod conceptually means <p>A<b> </b> <b>B</b></p> but the code introduced in that change evacuates leading and trailing whitespace from annotation tags, so we end up with <p>A <b></b> <b>B</b></p> instead. We could address this by dropping annotation tags that are left empty by the whitespace evacuation code.

Change 218111 had a related patch set uploaded (by Catrope):
Follow-up 8dc8b266761d: if whitespace stripping empties an annotation node, drop it

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

Change 218111 merged by jenkins-bot:
Follow-up 8dc8b266761d: if whitespace stripping empties an annotation node, drop it

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

Jdforrester-WMF assigned this task to Catrope.
Jdforrester-WMF edited a custom field.

It appears that this is fixed.