Page MenuHomePhabricator

Parsoid creates broken wikitext for link inside square brackets
Closed, ResolvedPublic

Description

Rarely, one wants to put a link inside square brackets, e.g. when you insert a "[sic]" inside a quote and want to link "sic" for further information. Trying to do so in VE creates broken wikitext:

  1. Open a page for editing in VE.
  2. Create a link inside square brackets, e.g. by first creating (or re-using) a link and putting square brackets before and after, or by creating a word inside square brackets and linking it then.
  3. Save the page (or just switch to source code).

Actual:
The created wikitext is something like [[[foo]]], which will not be rendered as link, but just display verbatim.

Expected:
The wikitext created should be valid, e.g. [<nowiki />[[foo]]], which will be rendered as desired.

Event Timeline

Esanders renamed this task from VE/Parsoid creates broken wikitext for link inside square brackets to Parsoid creates broken wikitext for link inside square brackets.Nov 8 2017, 1:59 PM
Esanders removed a project: VisualEditor.

This is a pure Parsoid bug. The HTML>WT>HTML round trip is:

[<a rel="mw:WikiLink" href="./Foo">Foo</a>] -> [[[foo]]] -> [[[foo]]]

cc'ing @ssastry

This is a pure Parsoid bug. The HTML>WT>HTML round trip is:

[<a rel="mw:WikiLink" href="./Foo">Foo</a>] -> [[[foo]]] -> [[[foo]]]

Ah, looks like we need to add a <nowiki/> during html2wt between the [ and the [[.

Arlolra triaged this task as Medium priority.

Oooh, interesting. Probably a ConstrainedText issue?

Change 390045 had a related patch set uploaded (by Arlolra; owner: Arlolra):
[mediawiki/services/parsoid@master] T180010: Broken wikitext for link inside square brackets

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

Change 390045 merged by jenkins-bot:
[mediawiki/services/parsoid@master] T180010: Broken wikitext for link inside square brackets

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