Page MenuHomePhabricator

Improve nowiki escaping of template arguments by using global context
Open, MediumPublic

Description

When an unmatched literal square bracket is used in the title of a reference, Parsoid or VisualEditor encloses it in a nowiki tag.

Example on the live wiki: https://en.wikipedia.org/w/index.php?title=Wikipedia&diff=566045928&oldid=566042453#cite_ref-209 (line 360)
Examples in testing: https://en.wikipedia.org/w/index.php?title=User%3AThryduulf%2Fsandbox&diff=566402676&oldid=566401436

It is possible this is a reappearance of or related to T45067


Version: unspecified
Severity: normal
See Also:
T45067: Parsoid: Square brackets sometimes (but not always) get escaped with <nowiki>s when PHP parser wouldn't
T52331: VisualEditor throws <nowiki> next to any square bracket [

Details

Reference
bz52268

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 2:03 AM
bzimport set Reference to bz52268.

Yes, this is a known problem. There are two different forms of nowiki escaping that goes on in Parsoid. One is applied to text strings (the common kind that appears around [[foo]] when typed literally).

The one in this bug report is applied to transclusion parameters to prevent literal characters messing up transclusion parse.

Ex: If {{tpl|foo|bar}} is editd to {{tpl|[[foo|bar]]}}, then the "[[foo" and "bar]]" have to be wrapped in nowikis to prevent "[[foo|bar]]" from being parsed as a wikilink.

The current limitation of this second form of nowiki escaping is that it only checks arguments one at a time. So, it conservatively escapes "[foo" in one argument right now without looking at the global context of all arguments which is why you see the nowiki escapes there.

To be fixed.

Arlolra added a project: Parsoid.
Arlolra set Security to None.