Modulus:utilities/doc
This is the documentation page for Modulus:utilities
Subpagina haec est documentatio de Modulus:utilities. Hic legitur quomodo uti, ac categoriae, nexus invervici et cetera continentur qui modulus in origine non continet. |
Purpose
[+/-]This module is exports various general utility functions, which can be used by other modules.
pattern_escape
[+/-]pattern_escape(text)
Escapes the magic characters used in Regular Expression patterns. For example, "^$()%.[]*+-?|" becomes "%^%$%(%)%%%.%[%]%*%+%-%?%|".
format_categories
[+/-]format_categories(categories, lang, sort_key)
Formats a list (table) of category names. The output is a string consisting of all categories with [[Category:...]] applied to each one, and the given sort key added. If the namespace is not the main or Appendix namespace, the output will be an empty string. If no sort key is given:
- A default one is generated by using the current subpage name, and by removing hyphens from the beginning (so that suffixes can be sorted without a key).
- If a sort key is available for the given language, it is then used to create a sort key that follows the rules for that language.
- If the final sort key ends up being identical to PAGENAME (which is the default key used by the software), then it is omitted entirely, so that it can be used in combination with DEFAULTSORT.
template_categorize
[+/-]{{#invoke:utilities|template_categorize}}
This function is used by the {{categorize}}
, {{catlangname}}
and {{catlangcode}}
templates.