Page MenuHomePhabricator

Parsoid trips up on "[[ .. ]]" in parser function args in some cases
Closed, ResolvedPublic

Description

This command-line session illustrates the issue:

$  cat /tmp/pf.wt
{{#ifexist:xyz | [[1],[2]] | abc | def }}
{{#ifexist:xyz | [ [1],[2] ] | abc | def }}

$  php bin/parse.php < /tmp/pf.wt
<pre data-parsoid='{"dsr":[0,87,1,0]}'>{{#ifexist:xyz | [[1],[2]] | abc | def }}
<span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"},{"k":"2"},{"k":"3"}]],"dsr":[44,87,null,null]}' data-mw='{"parts":[{"template":{"target":{"wt":"#ifexist:xyz ","function":"ifexist"},"params":{"1":{"wt":" [ [1],[2] ] "},"2":{"wt":" abc "},"3":{"wt":" def "}},"i":0}}]}'>[ [1],[2] ]</span></pre>

This was found while investigating ruwkivoyage rendering failures. On ruwikivoyage, this edit eliminated this tokenization / parse failure at least.

Event Timeline

This comment was removed by ssastry.

I posted on the wrong ticket! :-) I meant to post the above comment on T374445 instead!

Change #1130780 had a related patch set uploaded (by Subramanya Sastry; author: Subramanya Sastry):

[mediawiki/services/parsoid@master] WIP: Fix incorrect broken-wikilink handling

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

No, the two are unrelated. T389623 isn't fixed by the patch above. Just some edge cases in matching of broken wikilink syntax and broken template syntax.

Or maybe I need to tweak that patch further to handle this case -- it does look very much related.

Change #1134104 had a related patch set uploaded (by C. Scott Ananian; author: C. Scott Ananian):

[mediawiki/services/parsoid@master] Fix incorrect broken-wikilink handling (alternative)

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

Change #1134104 merged by jenkins-bot:

[mediawiki/services/parsoid@master] Fix incorrect broken-wikilink handling (alternative)

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

Change #1134766 had a related patch set uploaded (by C. Scott Ananian; author: C. Scott Ananian):

[mediawiki/vendor@master] Bump wikimedia/parsoid to 0.21.0-a25

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

Change #1130780 abandoned by Arlolra:

[mediawiki/services/parsoid@master] Fix incorrect broken-wikilink handling

Reason:

In favour of I511a3aa946d1ddca3f38701e8fd32353e8622bb7

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

Change #1134766 merged by jenkins-bot:

[mediawiki/vendor@master] Bump wikimedia/parsoid to 0.21.0-a25

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