Modul:Wikitext Parsing/belge
Ev belgekirin binrûpela ji bo Modul:Wikitext Parsing e. Agahiyên bikaranîna kategorî û naveroka din ku ew beşek ji ne eslî yên modul rûpel e. |
Ev modul teqrîben li ser 78.000 rûpelan tê bikaranîn û dibe ku guhartin bi berfirehî were dîtin. Guhartinên xwe li ser binrûpelên modulê yên /ceribandinê yan /testcases, yan jî ceribandina modulê biceribîne. Berî ku guhartinên xwe bi cih binî li ser rûpela gotûbêjê ramana xwe bibêje. |
This module provides some functions to help with the rare processing mistake involved in modules like 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
biguhêreThis module is rated as ready for general use. It has reached a mature form and is thought to be bug-free and ready for use wherever appropriate. It is ready to mention on help pages and other Wikipedia resources as an option for new users to learn. To reduce server load and bad output, it should be improved by sandbox testing rather than repeated trial-and-error editing. |
PrepareText(text, keepComments)
will run any content within certain tags that disable processing (<nowiki>
, <pre>
, <syntaxhighlight>
, <source>
, <math>
) through mw.text.nowiki and remove HTML comments 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 the output at the end if part of the processed text is returned, 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
biguhêreThis module is rated as beta, and is ready for widespread use. It is still new and should be used with some caution to ensure the results are as expected. |
ParseTemplates(InputText, dontEscape)
will attempt to parse all {{Templates}}
on a page, handling multiple factors such as [[Wikilinks]]
and {{{Variables}}}
among other complex syntax. Due to the complexity of the function, it is considerably slow, and should be used carefully. The function returns a list of template objects in chronological order, which have the following properties:
- Args: A key-value set of arguments, not in chronological order
- ArgOrder: A list of keys in the chronological order they appear in the template
- Children: A list of template objects in chronological order that are contained within the existing template. Only immediate children are listed
- Name: The name of the template
- Text: The raw text of the template
If the second parameter, dontEscape
, is set to true, the inputted text won't be ran through the PrepareText
function.