Modul:Wikitext Parsing/dok
![]() | To je dokumentacijska podstran za glavno stran Modul:Wikitext Parsing. Namenjena je shranjevanju navodil, kategorizaciji in drugi vsebini, ki ni del glavne strani. |
![]() | Predloga se uporablja na številnih straneh. Z urejanjem te predloge lahko zelo obremenite strežnike, zato pred uvedbo vse spremembe, ki jih želite uvesti, preizkusite na njenih podstraneh (/peskovnik oziroma /testniprimeri) ali na svojih lastnih podstraneh. Preizkusite jih lahko tudi v posebnem peskovniku za predloge. Preizkušene spremembe se lahko v predlogo dodajo z enim samim urejanjem. Preden predlogo spremenite, se o spremembah rajši pogovorite na njeni pogovorni strani. |
Predloga:Cascade-protected template This module provides some functions to help with the potential complex situation involved in modules like Module:Template parameter value, which intend to process the raw wikitext of a page and want to respect nowiki tags or similar reliably. This module is designed only to be called by other modules.
PrepareText
[uredi kodo]![]() | Ta modul je ocenjen kot pripravljen za splošno uporabo. Dosegel je zrelo obliko in naj bi bil razmeroma brez napak ter pripravljen za uporabo, kjer je to primerno. Lahko ga omenite na straneh pomoči in v drugih virih o Wikipediji kot možnost za učenje novih uporabnikov. Da bi zmanjšali obremenitev strežnikov in slab izhod, ga je treba izboljšati s testiranjem v peskovniku, namesto ponavljajočega se urejanja poskusov in napak. |
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 removed 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
[uredi kodo]![]() | Ta modul je ocenjen kot beta in je pripravljen za široko uporabo. Še vedno je nov in ga je treba uporabljati previdno, da se zagotovijo pričakovani rezultati. |
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 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.