Parsoid/domparse

See bug 55524. Transclusions can currently affect arbitrary parts of the page by producing unbalanced HTML. This makes both WYSIWYG editing and efficient updates difficult. We would thus like to move towards properly nested templates as much as possible. For existing multi-transclusion content we would like to enforce nesting as a unit using a extension-like tag wrapping such a content block.

The other use case is support for non-wikitext content. Daniel Kinzler is working on this patch. The issue here is that HTML transclusions can be nested deep inside of normal wikitext transclusions. The idea is for the PHP preprocessor to not expand those when they are nested, and instead wrap them into a tag. Consumers like Parsoid will then pick up the tag & expand it with a separate request to the PHP API.

The PHP action=expandtemplates end point will add a top-level content type to each expansion result (as a property in JSON & an attribute in XML). Consumers will use this to determine how to further process the returned content. The normal case would be to return something like 'text/x-wiki;expanded', which means that it's wikitext which might or might not contain tags. The expansion of a single HTML-only transclusion will be marked as 'text/html', so that consumers can process it as fully processed HTML.