Page MenuHomePhabricator

Template Handling Error in Parsoid data-mw
Closed, ResolvedPublic

Description

Hi Parsoid developers,

I'm trying to use Parsoid "data-mw" output when dealing with wikitext templates. On Help:Expansion it's said that:

If double opening braces are followed by triple closing braces or conversely, this is taken as delimiting a template, with one left-over brace outside it taken as plain text.

So when the input is "{{{ zoos }}" I'm expecting something like

<p about="#mwt1" typeof="mw:Transclusion" id="mwAQ" data-mw="{"parts":[{"template":{"target":{"wt":" zoos ","href":"./Template:Zoos"},"params":{},"i":0}}]}">{</p>

but instead I get

<p about="#mwt1" typeof="mw:Transclusion" id="mwAQ" data-mw="{"parts":[{"template":{"target":{"wt":"{ zoos ","href":"./Template:{_zoos"},"params":{},"i":0}}]}">{</p>

Is this a bug in Parsoid template parsing?

Thanks,

Event Timeline

Renxiaoyi raised the priority of this task from to Needs Triage.
Renxiaoyi updated the task description. (Show Details)
Renxiaoyi added a project: Parsoid.
Renxiaoyi subscribed.

Change 239842 had a related patch set uploaded (by Arlolra):
T112631: Attempt to match tpl(arg) brace precedence

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

Arlolra triaged this task as Medium priority.Sep 21 2015, 2:27 PM
Arlolra subscribed.

Is this a bug in Parsoid template parsing?

Yup, thanks for reporting.

Change 239842 merged by jenkins-bot:
T112631: Attempt to match tpl(arg) brace precedence

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

The specific case mentioned here should now be handled and an effort was made to come closer to the php parser. However, in general, there will still be cases where we don't match due to the discrepancy in tokenizing strategies.

Thanks for debugging! However when trying on http://rest.wikimedia.org/en.wikipedia.org/v1/?doc#!/Transforms/post_transform_wikitext_to_html_title_revision I'm still seeing

"target":{"wt":"{ zoos ","href":"./Template:{_zoos"},"params":{},"i":0} for my input "{{{ zoos }}". So I'm wondering when will the new results be available?

Thanks for debugging! However when trying on http://rest.wikimedia.org/en.wikipedia.org/v1/?doc#!/Transforms/post_transform_wikitext_to_html_title_revision I'm still seeing

"target":{"wt":"{ zoos ","href":"./Template:{_zoos"},"params":{},"i":0} for my input "{{{ zoos }}". So I'm wondering when will the new results be available?

This is not yet deployed. Will go out tomorrow or Monday.