Page MenuHomePhabricator

Parsoid inserts unnecessary nowiki
Closed, InvalidPublic

Event Timeline

Tgr created this task.Feb 21 2016, 8:52 AM
Restricted Application added subscribers: StudiesWorld, Aklapper. · View Herald TranscriptFeb 21 2016, 8:52 AM

Now VisualEditor can do two outputs:

  1. [[Hatvan|Hatvanban]] – good display, but wrong wikitext. I can achieve this only by inserting the link to Hatvan, writing nban before the last character, and finally deleting the last n; this is not very user-friedly…
  2. [[Hatvan]]<nowiki />ban – bad display, even wronger wikitext. It can be achieved easily by inserting the link to Hatvan, and then writing ban after it.

That's not an unbalanced tag, it's a self-closing tag, documented at https://www.mediawiki.org/wiki/Help:Formatting#Text_formatting_markup.

JulesWinnfield-hu renamed this task from Parsoid inserts unbalanced nowiki to Parsoid inserts unnecessary nowiki.Feb 21 2016, 1:12 PM

This is not a Parsoid issue. Parsoid preserves the semantics of the HTML it received.

[subbu@earth bin] echo '[[Hatvan]]ban' | node parse --prefix huwiki --normalize
<p><a href="Hatvan" title="Hatvan">Hatvanban</a></p>
[subbu@earth bin] echo '[[Hatvan]]<nowiki/>ban' | node parse --prefix huwiki --normalize
<p><a href="Hatvan" title="Hatvan">Hatvan</a>ban</p>

So, Parsoid adds the <nowiki/> so that the wikitext parses to the HTML that it encountered. Without the nowiki, as you can see above, on rendering, the 'ban' also becomes part of the link because of linktrail behavior that is part of wikitext.

So, if in VE, you saw 'Hatvan' linked and ban immediately followed it without any whitespace (or other huwiki-specific chars that prevent linktrail behavior), then the nowiki insertion is the only solution to preserve that rendering.

ssastry closed this task as Invalid.Feb 21 2016, 4:16 PM

I am closing this as invalid. Please reopen (or reassign to VE) based on what the expectations are about desired output and whether the VE UI misled the editor in terms of those expectations.