On Tue, May 13, 2014 at 11:37 AM, Daniel Kinzler daniel@brightbyte.dewrote:
As Brion pointed out in a comment to my original, there is another caveat: what should the expandtemplates module do when expanding non-wikitext templates? I decided to just wrap the HTML in <html>...</html> tags instead of using a strip mark in this case. The resulting wikitext is however only "correct" if $wgRawHtml is enabled, otherwise, the HTML will get mangled/escaped by wikitext parsing. This seems acceptable to me, but please let me know if you have a better idea.
Just brainstorming:
To avoid the wikitext mangling, you could wrap it in some tag that works like <html> if $wgRawHtml is set and <pre> otherwise.
Or one step further, maybe a tag <foo wikitext="{{P}}">html goes here</foo> that parses just as {{P}} does (and ignores "html goes here" entirely), which preserves the property that the output of expandtemplates will mostly work when passed back to the parser.