Jump to content
Wikipedia The Free Encyclopedia

Module:Wikitext Parsing/doc

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Aidan9382 (talk | contribs) at 18:50, 26 March 2023 (ParseTemplates: change). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision .Revision as of 18:50, 26 March 2023 by Aidan9382 (talk | contribs) (ParseTemplates: change)
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.


This module provides some functions to help with the rare processing error involved in modules like Module:Transcluder's getParameters() or Module:Template parameter value, which intend to parse the raw wikitext of a page. This module is not to be used in #invoke: calls, as there's no use in doing so. All text will be handled by MediaWiki before reaching the module anyways, and there will likely be no meaningful output.

PrepareText

PrepareText(text, keepComments) will run any content within certain tags (<nowiki>, <pre>, <syntaxhighlight>, <source>, <math>) that disable processing through mw.text.nowiki and remove HTML comments and <includeonly>...</includeonly> text to avoid irrelevant text being processed by modules, allowing tricky syntax to be parsed through more basic means such as %b{}.

If the second parameter, keepComments, is set to true, the content of HTML comments will be passed through mw.text.nowiki instead of being removing entirely.

Any code using this function directly should consider using mw.text.decode to correct their output at the end, though this will also decode any input that was encoded but not inside a no-processing tag, which likely isn't a significant issue but still something worth considering.

ParseTemplates

ParseTemplates(InputText, dontEscape) isn't ready for proper use in its current state for speed reasons, although functionally it works perfectly. Usage is highly discouraged.


AltStyle によって変換されたページ (->オリジナル) /