When we use either the XML-like syntax, or the #tag syntax, we have a problem to embed source code which is NOT using the wiki markup language (i.e. the source language is NOT "html")
Some characters in the embedded source code will cause
- either the XML-like syntax to be terminated if the source code contains any occurence `</source>` or `</syntaxhighlight>`
- or the #tag: syntax will break if the source code contains any vertical bar (`|`).
The temporary solution (if the source code is in the same page and not transcluded) is then to:
- for the XML-like syntax, HTML-escape the problematic characters `<` or `&` by a numeric character entity `<` or `&`; however the syntax highliter, when called with the XML-like syntax, does not properly unescape them to get the raw character.
- for the #tag: syntax, escape the problematic characters `|` by an HTML-escape like `&124;`.
The problem is that this does not work: the extension still does not unescape the source code given.
It is then impossible to properly transclude the source code from another page (using `{{msgnw:Full:Pagename}}` which generates lot of numeric character entities, that are still not decoded.
We should have either a parameter for the syntax highlight extension, instructing it to unescape all character entities present in the given source code, or another variant of the tag, where this instruction is explicit.
Without proper HTML-unescaping, this extension does not work properly: some source code will break either the parser, or will cause the MediaWiki parser to interpret and modify the source code (when using the #tag: syntax instead).
Can such option be added to this extension tag, as an optional parameter like `|unescape=yes` (when using it with the `#tag:` syntax, notably when the source code is transcluded by msgnw from another page) or `unescape="yes"` (when using it with the XML-like syntax)?
Useful examples of use (with safe transclusion of source code from another page, using msgnw):
{{#tag:source|{{msgnw:Full:Pagename}}|lang=html|unescape=yes}}
{{#tag:source|{{msgnw:Template:Templatename}}|lang=html<!--or mediawiki?-->|unescape=yes}}
{{#tag:source|{{msgnw:User:Someone/foo.c}}|lang=C|unescape=yes}}
{{#tag:source|{{msgnw:Module:Pagename}}|lang=lua|unescape=yes}}
Alternative (or addition): don't embed the source code in the content of the tag, pass the name of a page to transclude (it would be more efficient as there's then no need to first HTML-encode the transcluded source code with msgnw, then unescape it in #tag:source; instead #tag:source will just read the raw content of the page, without passing it throught the wiki parser):
{{#tag:source||page=Full:Pagename|lang=html}}
, or
<source page="Full:Pagename" as="html"/>
with the XML/HTML like syntax{{#tag:source||page=Template:Templatename|lang=html<!--or mediawiki?-->}}
{{#tag:source||page=User:Someone/foo.c|lang=C}}
{{#tag:source||page=Module:Pagename|lang=lua}}