On 05/20/2014 02:46 AM, Daniel Kinzler wrote:
My main reason for recycling the <html> tag was to not introduce a new tag extension. <domparse> may occur verbatim in existing wikitext, and would break when the tag is introduces.
The only existing mentions of this are probably us discussing it ;) In any case, it's easy to grep for it & nowikify existing uses.
Other than that, I'm find with outputting whatever tag you like for the transclusion.
Great!
Implementing the tag is something else, though - I could implement it so it will work for HTML transclusion, but I'm not sure I understand the original domparse stuff well enough to get that right. Would domparse be in core, btw?
Yes, it should be in core. I believe that a very simple implementation (without actual DOM balancing, using Parser::recursiveTagParse()) would not be too hard. The guts of it are described in [1]. The limitations of recursiveTagParse should not matter much for this use case.
Now back to the syntax. Encoding complex transclusions in a HTML parameter would be rather cumbersome, and would entail a lot of attribute-specific escaping.
Why would it involve any escaping? It should be handled as a tag extension, like any other.
Transclusions can contain quotes, which need to be escaped in attribute values to make sure that the attribute is in fact an attribute. Since quotes tend to be more common than <domparse> tags this means that there's going to be more escaping. I also find it harder to scan for quotes ending a long attribute value. Tags are easier to spot.
$wgRawHtml is disabled in all wikis we are currently interested in. MediaWiki does properly report the <html> extension tag from siteinfo when $wgRawHtml is enabled, so it ought to work with Parsoid for private wikis. It will be harder to support the <html transclusion="<transclusions>"></html> exception.
I should try what expandtemplates does with <html> with $wgRawHtml enabled. Nothing, probably. It will just come back containing raw HTML. Which would be fine, I think.
Yes, that case will work. But $wgRawHtml enabled is the exception, and not something I'd like to encourage.
By the way: once we agree on a mechanism, it would be trivial to use the same mechanism for special page transclusion. My patch actually already covers that. Do you agree that this is the Right Thing? It's just transclusion of HTML content, after all.
Yes, that sounds good to me.
Gabriel
[1]: https://www.mediawiki.org/wiki/Manual:Tag_extensions#How_do_I_render_wikitex...