12,782
edits
No edit summary |
|||
| Line 85: | Line 85: | ||
|Parsoid output does not deal with arrays defined in templates. | |Parsoid output does not deal with arrays defined in templates. | ||
|Example: [[User:Bjoern/arrayinclusion]] . From https://phabricator.wikimedia.org/T87157: | |Example: [[User:Bjoern/arrayinclusion]] . From https://phabricator.wikimedia.org/T87157: | ||
* 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. | |||
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. | * 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. | |||
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. | |||
A possible work around in our case is to re-call the array in the main body of the page, which then makes it available. | A possible work around in our case is to re-call the array in the main body of the page, which then makes it available. | ||