Module:Wikitext Parsing/doc
![]() | This is a documentation subpage for Module:Wikitext Parsing. 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 and probably 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). However, since this doesn't significantly use gsub and instead takes a text-scanning approach, the module in its whole isn't significantly expensive, and therefore could be viable in real modules if really required.[a]
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
- ^ In terms of just how expensive it is