Page MenuHomePhabricator

Parsoid can break rendering for templated attributes of HTML tags if T2529 kicks in for these template invocations
Closed, ResolvedPublic

Description

Consider this wikitext: <div style=”{{1x|#123456}}”>foo</div>. That renders as <div style=”#123456”>foo</div> with the legacy parser and <div style=”\n123456”>foo</div> in Parsoid. Parsoid’s output is clearly broken.

This Parsoid behavior is a result of the combination of Parsoid's use of a decoupled parsing model where it uses the core preprocessor to expand templates, and T2529 that requires additional of newlines for templates that start with "#" (among other chars). Parsoid right now just goes bonkers from there since it also expands all complex (anything that isn't a simple string in source) attribute values to HTML in the AttributeExpander and then uses the Sanitizer to convert it back to a string.

T212798: Parsoid chokes on parser functions outputting special characters inside an attribute, replaces all quotes with &quot; is another manifestation of this behavior.

Event Timeline

ssastry renamed this task from Parsoid can break rendering for templated attributes of HTML tags if T2529 behavior is involved to Parsoid can break rendering for templated attributes of HTML tags if T2529 kicks in for these template invocations.Aug 8 2022, 10:14 PM
ssastry triaged this task as Medium priority.

Even though T212798 is older, I am going to merge that into this since that is primarily a different manifestation of this problem.

MSantos lowered the priority of this task from Medium to Low.Sep 19 2023, 3:59 PM

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

[mediawiki/services/parsoid@master] Fix gaps in handling templates & parser functions in attributes

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

Change 979412 merged by jenkins-bot:

[mediawiki/services/parsoid@master] Fix gaps in handling templates & parser functions in attributes

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

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

[mediawiki/vendor@master] Bump wikimedia/parsoid to 0.19.0-a8

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

Change 982166 merged by jenkins-bot:

[mediawiki/vendor@master] Bump wikimedia/parsoid to 0.19.0-a8

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