Page MenuHomePhabricator

Simple Wikilinks with templated targets is missing information in data-mw to distinguish it from Piped Wikilinks with templated targets
Open, LowPublic

Description

See output below

[subbu@earth:~/work/wmf/parsoid] echo -e "[[{{1x|Foobar}}]]\n\n[[{{1x|Foobar}}|Foobar]]" | php bin/parse.php
<p data-parsoid='{"dsr":[0,17,0,0]}'><a typeof="mw:ExpandedAttrs" about="#mwt2" rel="mw:WikiLink" href="./Foobar" title="Foobar" data-parsoid='{"stx":"simple","a":{"href":"./Foobar"},"sa":{"href":"{{1x|Foobar}}"},"dsr":[0,17,null,null]}' data-mw='{"attribs":[[{"txt":"href"},{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&apos;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[2,15,null,null]}&apos; data-mw=&apos;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"1x\",\"href\":\"./Template:1x\"},\"params\":{\"1\":{\"wt\":\"Foobar\"}},\"i\":0}}]}&apos;>Foobar&lt;/span>"}]]}'>Foobar</a></p>

<p data-parsoid='{"dsr":[19,43,0,0]}'><a typeof="mw:ExpandedAttrs" about="#mwt4" rel="mw:WikiLink" href="./Foobar" title="Foobar" data-parsoid='{"stx":"piped","a":{"href":"./Foobar"},"sa":{"href":"{{1x|Foobar}}"},"dsr":[19,43,null,null]}' data-mw='{"attribs":[[{"txt":"href"},{"html":"&lt;span about=\"#mwt3\" typeof=\"mw:Transclusion\" data-parsoid=&apos;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[21,34,null,null]}&apos; data-mw=&apos;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"1x\",\"href\":\"./Template:1x\"},\"params\":{\"1\":{\"wt\":\"Foobar\"}},\"i\":0}}]}&apos;>Foobar&lt;/span>"}]]}'>Foobar</a></p>

The HTML output for both is identical (modulo DSR offsets and data-parsoid info) that doesn't let Parsoid clients distinguish between the two cases since data-parsoid is private info. The first example seems to be missing information that indicates that the link text is also template-generated.