Page MenuHomePhabricator

Parse template parameters to DOM or other non-wikitext types where possible
Closed, ResolvedPublic

Description

To do this, we will need knowledge of which template parameters can be parsed to DOM or other types and which need to remain wikitext. A start tag parameter should probably not be parsed to DOM for example (as a passed-in start tag would be balanced in the process), while most content parameters can. Apart from wikitext string vs. DOM we could also eventually refine parsing further for things like dates, numbers etc. Our DOM spec for templates [1] is already prepared to represent DOM and other representations of individual parameters.

The main thing that we'll need for the next step is information on where it is safe to do so. This information can come from something like TemplateData or DBPedia.

[1]: http://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Template_content


Version: unspecified
Severity: enhancement

Details

Reference
bz50587

Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 22 2014, 2:02 AM
bzimport added a project: Parsoid.
bzimport set Reference to bz50587.

My current patch (WIP at https://gerrit.wikimedia.org/r/#/c/110381/ ) crashes on parser test "Templates: Indent-Pre: 1e. Wrapping should be based on expanded content" when testing "{{echo|{{echo| }}bar}}", although the same wt works when using parse.js.

Investigating…

Change 121421 had a related patch set uploaded by Marcoil:
Bug 50587: Parse template parameters to DOM or other non-wikitext types where possible

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

Change 121421 merged by jenkins-bot:
Bug 50587: Parse template parameters to DOM or other non-wikitext types where possible

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

Change 123347 had a related patch set uploaded by Marcoil:
Bug 50587: Serialize DOM template parameters back to wikitext

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

Change 126725 had a related patch set uploaded by Marcoil:
Bug 50587: Parse template parameters to DOM or other non-wikitext types where possible

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

Change 126725 merged by jenkins-bot:
Bug 50587: Parse template parameters to DOM or other non-wikitext types where possible

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

Change 126730 had a related patch set uploaded by Marcoil:
Bug 50587: Serialize DOM template parameters back to wikitext

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

Change 123347 abandoned by Marcoil:
Bug 50587: Serialize DOM template parameters back to wikitext

Reason:
Rebased in https://gerrit.wikimedia.org/r/126730 .

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

Change 126730 merged by jenkins-bot:
Bug 50587: Serialize DOM template parameters back to wikitext

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

Change 131729 had a related patch set uploaded by Marcoil:
Bug 50587: Parse template parameters to DOM or other non-wikitext types where possible

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

Change 131730 had a related patch set uploaded by Marcoil:
Bug 50587: Serialize DOM template parameters back to wikitext

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

Change 131729 merged by jenkins-bot:
Bug 50587: Parse template parameters to DOM or other non-wikitext types where possible

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

Change 131730 merged by jenkins-bot:
Bug 50587: Serialize DOM template parameters back to wikitext

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

This has been merged into master, but it's not enabled by default. To test it out, add

parsoidConfig.addHTMLTemplateParameters = true;

to localsettings.js, or use the option --addHTMLTemplateParameters=true with command line tools.

Current status: This is not yet enabled in production while we are investigating the performance impact.