Last modified: 2013-08-26 23:14:20 UTC
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
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.