Module:Wikitext Parsing/doc: Difference between revisions
Appearance
m 1 revision imported |
No edit summary |
||
| Line 1: | Line 1: | ||
== ParseTemplates == | == ParseTemplates == | ||
{{Module rating|alpha}} | {{Module rating|alpha}} | ||
<code>ParseTemplates(InputText, dontEscape)</code> will attempt to parse all <code><nowiki>{{Templates}}</nowiki></code> on a page, handling multiple factors such as <code><nowiki> | <code>ParseTemplates(InputText, dontEscape)</code> will attempt to parse all <code><nowiki>{{Templates}}</nowiki></code> on a page, handling multiple factors such as <code><nowiki></nowiki></code> and <code><nowiki>{{{Variables}}}</nowiki></code> 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 order of appearance, which have the following properties: | ||
* '''Args''': A key-value set of arguments, not in order | * '''Args''': A key-value set of arguments, not in order | ||
* '''ArgOrder''': A list of keys in the order they appear in the template | * '''ArgOrder''': A list of keys in the order they appear in the template | ||
Latest revision as of 02:17, 5 February 2026
ParseTemplates
[edit source]| File:Greek lc alpha icon.svg | This module is rated as alpha. It is ready for limited use and third-party feedback. It may be used on a small number of pages, but should be monitored closely. Suggestions for new features or adjustments to input and output are welcome. |
Lua error in Module:Effective_protection_level at line 64: attempt to index field 'TitleBlacklist' (a nil value).
-->
ParseTemplates(InputText, dontEscape) will attempt to parse all {{Templates}} on a page, handling multiple factors such as 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 order of appearance, which have the following properties:
- Args: A key-value set of arguments, not in order
- ArgOrder: A list of keys in the order they appear in the template
- Children: A list of template objects that are contained within the existing template, in order of appearance. 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.