[go: up one dir, main page]

Page MenuHomePhabricator

Parsoid should improve its detection of empty-lines and suppress their interference in token handllers
Open, Needs TriagePublic

Description

Parsoid already detects "empty lines" (lines that would get stripped in the legacy parser and hence change the wikitext that is actually processed). But, parsoid only detects comment-only empty lines, but doesn't expand it to when a line only has a category (or other rendering-transparent magic words). This can then lead to rendering difs.

See this example below:

$ echo "the trail is {{Mi|5}} long and it's a {{Mi|5|on}} trail" | php bin/parse.php --domain shn.wikivoyage.org --dump tplsrc                                                                              1 ↵
[dump] ============================ template source ============================
TEMPLATE:ထႅမ်းပလဵတ်ႉ:MiTRANSCLUSION:"{{Mi|5}}"
--------------------------------------------------------------------------------
5 mi (8.0 km)
[[en:Template:Mile]]
--------------------------------------------------------------------------------

[dump] ============================ template source ============================
TEMPLATE:ထႅမ်းပလဵတ်ႉ:MiTRANSCLUSION:"{{Mi|5|on}}"
--------------------------------------------------------------------------------
5-mile (8.0 km)
[[en:Template:Mile]]
--------------------------------------------------------------------------------

<p about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"dsr":[0,21,0,0],"firstWikitextNode":"P","pi":[[{"k":"1"}]]}' data-mw='{"parts":["the trail is ",{"template":{"target":{"wt":"Mi","href":"./ထႅမ်းပလဵတ်ႉ:Mi"},"params":{"1":{"wt":"5"}},"i":0}}]}'>the trail is 5<span typeof="mw:Entity"> </span>mi (8.0<span typeof="mw:Entity"> </span>km)</p><span about="#mwt1">
</span><link rel="mw:PageProp/Language" href="https://en.wikivoyage.org/wiki/Template:Mile" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"https://en.wikivoyage.org/wiki/Template:Mile"},"sa":{"href":"en:Template:Mile"}}'/><pre data-parsoid='{"dsr":[21,55,1,0]}'>long and it's a <span about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"},{"k":"2"}]],"dsr":[38,49,null,null]}' data-mw='{"parts":[{"template":{"target":{"wt":"Mi","href":"./ထႅမ်းပလဵတ်ႉ:Mi"},"params":{"1":{"wt":"5"},"2":{"wt":"on"}},"i":0}}]}'>5-mile (8.0</span><span typeof="mw:Entity" about="#mwt2"> </span><span about="#mwt2">km)
</span><link rel="mw:PageProp/Language" href="https://en.wikivoyage.org/wiki/Template:Mile" about="#mwt2" data-parsoid='{"stx":"simple","a":{"href":"https://en.wikivoyage.org/wiki/Template:Mile"},"sa":{"href":"en:Template:Mile"}}'/>trail</pre>

This renders as a single line without line breaks or pres with the legacy parser. But, the [[en:Template:Mile]]\n doesn't get stripped in Parsoid and introduces a linebreak during token processing that leads to Parsoid's rendering with a <pre>..</pre> etc.

This shows up on this shnwikivoyage page

Event Timeline

ssastry renamed this task from Parsoid should improves its detection of empty-lines and suppress their interference in token handllers to Parsoid should improve its detection of empty-lines and suppress their interference in token handllers.Wed, Sep 4, 2:05 PM