Page MenuHomePhabricator

Bug parsing wikilink-like construct
Open, MediumPublic

Description

[subbu@earth:~/work/wmf/mediawiki] echo "[[<div></div>]]" | parse.js --trace peg --normalize
0-[peg]        | ---->   [{"type":"SelfclosingTagTk","name":"wikilink","attribs":[{"k":"href","v":["<div></div>"],"vsrc":"<div></div>"}],"dataAttribs":{"tsr":[0,15],"src":"[[<div></div>]]"}}]
0-[peg]        | ---->   [{"type":"NlTk","dataAttribs":{"tsr":[15,16]}}]
0-[peg]        | ---->   [{"type":"EOFTk"}]

<p>[[&lt;div>&lt;/div>]]</p>

[subbu@earth:~/work/wmf/mediawiki] echo "[[<div></div>]]" | php maintenance/parse.php 

<div class="mw-parser-output">[[<div></div>]]
</div>

< is not a valid title char so [[<div></div>]] could never be a wikilink.

So, either a TSP or a wikilink handler issue, if not a tokenizer precedence issue.

Found in https://en.wikipedia.org/api/rest_v1/page/html/Vitamin_D, specifically {{VitaminDSynthesis_WP1531|highlight=Calcifediol}}

Event Timeline

ssastry created this task.Sep 20 2018, 3:34 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptSep 20 2018, 3:34 PM
ssastry triaged this task as Medium priority.Sep 20 2018, 3:34 PM
Kelson added a subscriber: Kelson.Sep 20 2018, 3:44 PM

Detected using MWoffliner and reported here too https://github.com/openzim/mwoffliner/issues/185

ssastry edited projects, added Parsoid-Read-Views; removed Parsoid.Sep 20 2018, 3:56 PM
ssastry moved this task from Backlog to Edge cases? on the Parsoid-Read-Views board.