Module:Wikitext Parsing/doc
It may contain usage information, categories and other content that is not part of the original module page.
Usage
This module is a Proof-Of-Content module to do with the rare processing error involved in functions like Module:Transcluder's getParameters()
. The primary function, EscapeEscapedText
, will run any content within certain tags (<nowiki>
, <pre>
, <syntaxhighlight>
, <source>
) through mw.text.nowiki and remove HTML comments to avoid text that shouldn't be processed being processed by modules, allowing even the most absurd syntax to be parsed through more basic means.
The function has a second parameter, keepComments
, which will pass the content of HTML comments through mw.text.nowiki instead of removing them entirely if set to true. Only exists in case that would be wanted, for whatever reason.
This currently isn't used in any real modules as it's not fully tested, possibly[a] expensive, and definitely excessive, hence the page title (if a multi-line oddly-formatted nowiki tag is causing you issues, maybe it's the target page's problem, not the module's). Chances are a simpler version, which wouldn't try match every valid occurance of a tag and just the regular <tagname>...</tagname>
format, might be a reasonable idea for mainspace modules, but I'm undecided.
Shortfalls: Currently unsure about the situation of <includeonly>...</includeonly>
and how it's handled during processing, so it isn't considered by the module yet, though this isn't likely to matter much... I hope. Also, any module using this for whatever reason should consider using mw.text.decode in certain situations to correct their output, though this will also decode any input that was encoded but not inside a no-processing tag, which likely isn't the biggest issue but still something to consider.
References
- ^ When testing it by integrating it into Module:Template parameter value/sandbox, it was initially stupidly expensive (0.72s -> 2.8s) thanks to me not understanding what optimisation is, however after some fixes to TFNWT and EET, there is now virtually no difference in performance (infact, it may be a little faster in this specific case due to the removed basic %b<> check). Still needs to be tested in situations where a large amount of nowiki tags or comments are present