Module:data/magic words/documentation
Appearance
This module contains data relating to the MediaWiki magic words which are enabled on the English Wiktionary.
There are three types of magic word:
- Parser variables, which cannot take arguments (e.g.
{{PAGENAME}}
). - Parser functions, which take argument 0 after a colon (e.g.
{{#IF:foo|bar|baz}}
), and can take further arguments. - Transclusion modifiers, which are used as colon-separated prefixes to templates or other magic words (e.g.
{{SUBST:foo}}
). These can be stacked with each other (but see thepriority
key below.
Many magic words can act as a parser variable or parser function, but others can only be one or the other.
Keys
[edit]parser_variable
- Specifies that the magic word can be used as a parser variable. The value is a wikilink target to a documentation page.
parser_function
- Specifies that the magic word can be used as a parser function. In most cases, the value is a wikilink target to a documentation page; in a small number of cases, the value is a table, because the most suitable link depends on whether argument 1 (i.e. the first argument after a pipe) has been given. In such cases, the table has two keys: key
[0]
is the link target when argument 1 has not been given, and key[1]
is the link target when it has. For example, compare thePROTECTIONEXPIRY
link targets for{{PROTECTIONEXPIRY:foo}}
and{{PROTECTIONEXPIRY:foo|bar}}
. transclusion_modifier
- Specifies that the magic word can be used as a transclusion modifier. The value is a wikilink target to a documentation page.
name
- The canonical name for the magic word. In most cases, this will be the same as the key. Note that this should not be specified in the data directly, as it is generated automatically. Instead, the key
aliases
can be used to give a table of aliases for the magic word, which are automatically converted into table keys with the same data as the canonical name when the table is returned. Thealiases
key is not present in the returned data, however. case_sensitive
- Specifies that the magic word is case-sensitive. Case-sensitive magic words must be given in their canonical form (which is usually uppercase), and any aliases have the same case-sensitivity as the canonical name. If
case_sensitive = false
, the magic word must be given in uppercase. The distribution of case-sensitive and case-insensitive magic words is essentially random, with the split being close to 50/50. priority
- Only used with transclusion modifiers. Specifies the order they must be given in when stacked together. For instance, a magic word with priority 2 can only be stacked after one with priority 1 and stacked before one with priority 3; compare
{{SUBST:MSG:foo}}
(both modifiers applied to Template:foo), and{{MSG:SUBST:foo}}
(MSG
applied to Template:SUBST:foo).