Page MenuHomePhabricator

Clean up single vs. multi-part data-mw
Open, MediumPublic

Description

We currently use { target: {}, params: {} } for single-transclusion content, and {parts: [{template:{target: {}, params: {}, i: 0}}]} for multi-part transclusions and extensions. This creates special cases and makes it necessary to know all keys to convert the single-transclusion format into the parts bit.

The missing namespacing also makes it harder than necessary to add additional information to data-mw.

To clean this up, we should consider moving to always using an array format like this:

parts: [{"@type":"mw:Transclusion", target: {}, params: {}}]

The change to always use an array is already supported by VisualEditor. Flattening the nested object and using a JSON-LDish @type key makes the parts structure more regular and easier to extend. It also moves it closer to the RDFa names. Both us and VE can support both formats as an input for a while to avoid caching issues, but should start by only emitting the new format.

See also:
http://json-ld.org/playground/index.html -- some example JSON-LD


Version: unspecified
Severity: normal

Details

Reference
bz53135

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 2:05 AM
bzimport added a project: Parsoid-DOM.
bzimport set Reference to bz53135.

Change 81143 had a related patch set uploaded by Subramanya Sastry:
(Bug 53135) Step 1: Always use parts array for transclusion data-mw

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

Change 81143 merged by jenkins-bot:
(Bug 53135) Step 1: Always use parts array for transclusion data-mw

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

The other changes in this ticket will require co-ordination with VE since it will break existing code.

This will also require the cached HTML versioning to be implemented to prevent weird editing errors between when parsoid is deployed and varnish caches or cleared. Alternatively, VE and Parsoid serializer would have to handle old and new formats of data-mw temporarily.

ssastry renamed this task from Clean up single vs. multi-part data-mw to Technical Debt: Clean up single vs. multi-part data-mw.May 26 2015, 12:28 PM
ssastry moved this task from In Progress to Needs Triage on the Parsoid board.
Arlolra renamed this task from Technical Debt: Clean up single vs. multi-part data-mw to Clean up single vs. multi-part data-mw.Jun 3 2015, 6:57 PM