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}}