Module:ScriptUtil/doc

Lua metamodule for use in Lua scripts.

Template
For handling and parsing MediaWiki templates.

Template.new(title, templateArgs)
Creates and returns a Lua object representation of a template.
 * : The title of the template.
 * : An argument table in the same form as the one used in frame:expandTemplate.

Template.newFromWikitext(wikitext)
Creates and returns a Lua object representation of a template from a wikitext string such as

template:getArgs
Returns the arguments table for the template in the same form as the one used in frame:expandTemplate. All parameters are strings.

template:getOrderedArgs
Returns a list that contains arguments in key-value pairs. Every element e in the list is a table with e[1] being the parameter name and e[2] being the value. The list is ordered by the order the arguments were added to the template object. Arguments entered through the constructor  have an undefined order, while arguments added through   or   follow the order they were read or set in.

template:toWikitext(useBlockFormatting)
Converts the template object to a wikitext string representation. If  is true, the wikitext returned will use block formatting instead of inline formatting.