Module:Template parameter value/doc explained

Implements and, and can be used from other modules.

Module functions

getParameter

getParameter takes 4 arguments: The page name (string), the template/s (string or table of strings), the parameter (string), and an optional options table. It will return either true and the contents of the requested parameter or false and a reason for failure.

The following options are available:

getTemplate

getTemplate takes 3 arguments: The page name (string), the template/s (string or table of strings), and an optional options table. It will return either true and the text of the requested template or false and a reason for failure.

getTemplate supports the options template_index and treat_as_regex options from getParameter.

Helper functions

The module exposes some of the helper functions used (matchAllTemplates, getParameters, and getAllParameters) for convenience. Each function has some comments above it in the code explaining its rough purpose.

Template functions

main implements and acts as a template wrapper for getParameter.

hasTemplate implements and somewhat acts as a wrapper for getTemplate (it only provides if the template was found, not the template text itself).

Testcases

Testcases are available at