Page MenuHomePhabricator

#arrayprint behaves differently in normal wikioutput vs. parsoid output
Open, LowPublic

Description

Somehow an array definition made in a template is not available to parsoid outside the template.

Best to explain with example: The page text is something like:

* {{: array definition and print }}
* Print outside template:  {{#arrayprint:some_arr}}

The template text is:

{{#arraydefine:some_arr|a,b,c }}
Print from within template: {{#arrayprint:some_arr}}

On the wikipage (http://oer.educ.cam.ac.uk/wiki/User:Bjoern/arrayinclusion) the arrayprint shows the array twice, as expected. However, output of parsoid (http://oer.educ.cam.ac.uk:8000/oer/User:Bjoern/arrayinclusion) the array only prints when arrayprint is called inside the template.

(Sorry that this is a bit hazy - first bug report on parsoid.)

Thanks!
Bjoern

Event Timeline

Bjohas raised the priority of this task from to Needs Triage.
Bjohas updated the task description. (Show Details)
Bjohas added a project: Parsoid.
Bjohas subscribed.
Bjohas renamed this task from #arrayprint behaved differently in normal wikioutput vs. parsoid output to #arrayprint behaves differently in normal wikioutput vs. parsoid output.Jan 18 2015, 11:09 PM
Bjohas updated the task description. (Show Details)
Bjohas set Security to None.

Parsoid doesn't support stateful extensions / parser functions at this time. In this case, it looks like your extension relies on state that has been setup earlier in the page.

Parsoid calls into the mediawiki API to expand parser functions and templates, and there is no page state available at that time. That is why the #arrayprint call inside the template works as expected (because PHP parser sees the array setup and that state is accessible to the following #arrayprint function). But, the second #arrayprint in the page doesn't have access to page state since it is a fresh call into the API.

The existing stateful extensions (like Cite) are supported by having native implementations inside Parsoid (as special cases that are used very widely). LST is another one that will be implemented.

We do have plans for native Parsoid extensions and being able to register them. But, we haven't implemented that yet.

Once we get the extension registration mechanism (T55874) in place, individual Parsoid installs could choose to do what they wish with their extensions, but, Parsoid itself will not have support for stateful extensions. There are plans to allow for page-level metadata to be attached to DOM nodes (citations are essentially meta-data attached to DOM nodes), but that is some ways off.

The lack of the registration mechanism is causing us a huge amount of problems, particularly with SemanticMediaWIki and the array extension. It essentially means that Parsoid produces messed up output for us, which means we can't use it effectively.