Page MenuHomePhabricator

Parsoid treats [[[[Foo]]]] as plain text, but the PHP parser treats it as [[<a href="Foo">Foo</a>]]
Closed, ResolvedPublic

Description

(Where the word is the actual working part of the element).
Probably not a real bug, since it is triggered by a user mistake (who should remove the brackets), but since it's easily reproduceable, here are the steps:
take any <nowiki>[[link]]</nowiki> created like this (by ignoring the markup warning).
VEdit the page and use the linking tool on the word inside the brackets.
Save, you now have [[[[link]]]], and of course the nowiki tags are gone.

https://www.mediawiki.org/w/index.php?title=User:Elitre_(WMF)/SandboxVE&diff=prev&oldid=794483

https://www.mediawiki.org/w/index.php?title=User%3AFram%2FSandbox&diff=794473&oldid=794472

Just interested in understanding whether VE wants or can do something about it.

(Note that it is absolutely possible to get the same result with the traditional editor as well, https://sl.wikipedia.org/w/index.php?title=Klerofa%C5%A1izem&diff=next&oldid=4101482 ).


Version: unspecified
Severity: normal

Details

Reference
bz54877

Event Timeline

bzimport raised the priority of this task from to Lowest.Nov 22 2014, 2:33 AM
bzimport added a project: Parsoid.
bzimport set Reference to bz54877.

This is probably a bug in Parsoid, not VisualEditor.

Given a page containing:

[[[[Sandbox]]]]

Which contains no <nowiki>, this is parsed as [[<a href=Sandbox>Sandbox</a>]] by the PHP parser and renders accordingly.

When editing that page in VisualEditor, the initial rendering is wrong (it renders as a text node "[[[[Sandbox]]]]", no anchor link).

If I add text to that line or change the word to something else, the serialisation from Parsoid is still the same (no <nowiki> is inserted, so Parsoid is unaware of it being a link both in parsing and serialising).

Given a page containing:

<nowiki>[[[[Sandbox]]]]</nowiki>

When editing that in VisualEditor, the initial rendering is correct (1 text node containing "[[[[Sandbox]]]]").

If I add text to that line or change the word to something else, the serialisation from Parsoid is no longer the same. It dropped the <nowiki>, thus effectively (according to the PHP parser) turning it into a link after saving.

Rephrasing bug. A user would not have a goal to generate 4 brackets in wikitext, but the use case of typing (or editing existing pages that do have) [[ around a link, that is genuine content that VisualEditor should be able to create and edit.

Re-re-phrasing the title (and yes, this appears to be a Parsoid bug, but a very low priority one).

Change 104695 had a related patch set uploaded by Subramanya Sastry:
WIP (Bug 54877) Tokenize [[[[Foo]]]] correctly

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

Change 104695 merged by jenkins-bot:
(Bug 54877) Tokenize [[[[Foo]]]] correctly

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