Template:Magic word: Difference between revisions
More actions
3 revisions imported from mw:Template:Magic word |
2 revisions imported from mw:Template:Magic word |
||
| Line 2: | Line 2: | ||
-->{{#ifexpr:<!-- | -->{{#ifexpr:<!-- | ||
-->{{yesno|{{{code|}}}|yes=1|no=0}}<!-- | -->{{yesno|{{{code|}}}|yes=1|no=0}}<!-- | ||
-->or{{yesno|{{{mono|}}}|yes=1|no=0}}<!-- | |||
-->or{{yesno|{{{nowrap|}}}|yes=1|no=0}}<!-- | -->or{{yesno|{{{nowrap|}}}|yes=1|no=0}}<!-- | ||
-->|<!-- | -->|<!-- | ||
-->{{#if:{{yesno|{{{mono|}}}}}|<templatestyles src="Template:Mono/styles.css"/>}}<!-- | |||
-->{{#if:{{yesno|{{{nowrap|}}}}}|<templatestyles src="Template:Nowrap/styles.css"/>}}<!-- | -->{{#if:{{yesno|{{{nowrap|}}}}}|<templatestyles src="Template:Nowrap/styles.css"/>}}<!-- | ||
--><{{#if:{{yesno|{{{code|}}}}}|code|span}} {{# | --><{{#if:{{yesno|{{{code|}}}}}|code|span}} {{#ifexpr:<!-- | ||
-->{{yesno|{{{mono|}}}|yes=1|no=0}}<!-- | |||
-->or{{yesno|{{{nowrap|}}}|yes=1|no=0}}<!-- | |||
-->|<!-- | |||
-->class="{{yesno|{{{mono|}}}|yes=monospaced|no=}} {{yesno|{{{nowrap|}}}|yes=nowrap|no=}}"<!-- | |||
-->}}><!-- | |||
-->}}<!-- | -->}}<!-- | ||
-->{{<!-- | -->{{<!-- | ||
| Line 16: | Line 23: | ||
-->|ParserFunctions=Help:Extension:ParserFunctions<!-- | -->|ParserFunctions=Help:Extension:ParserFunctions<!-- | ||
Extensions with documentation in subpages of the “Extension:” namespace: | |||
-->|Page Forms=Extension:Page Forms<!-- | |||
-->{{#switch:{{{1}}}<!-- | |||
-->|#arraymap<!-- | |||
-->|#arraymaptemplate<!-- | |||
-->|#template_display<!-- | |||
-->|#template_params<!-- | |||
-->=/Page Forms and templates<!-- | |||
-->|#autoedit<!-- | |||
-->|#forminput<!-- | |||
-->|#formlink<!-- | |||
-->|#formredlink<!-- | |||
-->=/Linking to forms<!-- | |||
-->|#queryformlink<!-- | |||
-->=/Creating query forms<!-- | |||
-->|#default_form<!-- | |||
-->=/The "edit with form" tab<!-- | |||
-->}}<!-- | |||
Default page when `ext` is specified: | Default page when `ext` is specified: | ||
| Line 35: | Line 64: | ||
-->{{#ifexpr:<!-- | -->{{#ifexpr:<!-- | ||
-->{{yesno|{{{code|}}}|yes=1|no=0}}<!-- | -->{{yesno|{{{code|}}}|yes=1|no=0}}<!-- | ||
-->or{{yesno|{{{mono|}}}|yes=1|no=0}}<!-- | |||
-->or{{yesno|{{{nowrap|}}}|yes=1|no=0}}<!-- | -->or{{yesno|{{{nowrap|}}}|yes=1|no=0}}<!-- | ||
-->|</{{#if:{{yesno|{{{code|}}}}}|code|span}}><!-- | -->|</{{#if:{{yesno|{{{code|}}}}}|code|span}}><!-- | ||
Revision as of 20:43, 14 July 2021
{{magic word}}
Creates a formatted link to the documentation of a magic word.
Usage
{{Magic word}}
Template parameters
- TemplateData
TemplateData is a way to store information about template parameters (the description of those and of the whole template) for both humans and machines. It is used by VisualEditor and possibly other tools like Upload Wizard.
Existing template documentation
At Wikimedia Commons, it is recommended to use {{TemplateBox}} with either useTemplateData=1 or useTemplateData=only on the /doc subpage and transcluding it with {{Documentation}} into the template. <nowiki>-tags can be wrapped around the arguments, if required, to avoid templates being expanded.
Newly created template documentation and imports
Another option, especially for imported templates, or for users with JSON experience, is placing raw <templatedata>-tags into the Wikitext of the template, as described in various Wikipediae.
Wikipedia's help about TemplateData • Commons-specific information
Creates a formatted link to the documentation of a magic word.
| Parameter | Description | Type | Status | |
|---|---|---|---|---|
| Magic Word | 1 | The name of the magic word or parser function. | String | required |
| Parameter 0 | 2 | The parameter passed immediately after the colon. | Content | optional |
| Extension | ext | The name of the extension that adds the parser function (without the “Extension:” namespace prefix) | String | optional |
| Code? | code | Whether to use <code> styling.
| Boolean | optional |
| Monospaced? | mono | Whether to use `style="font-family:monospace"`.
| Boolean | optional |
| Nowrap? | nowrap | Whether to use `style="white-space:nowrap"`.
| Boolean | optional |
Additional information
The template is intended to be used in the following namespaces: all namespaces
The template is intended to be used by the following user groups: all users
Examples
{{Magic word|nowrap=1|ext=Translate|#translation}}
renders as:
{{#translation:}}
{{Magic word|mono=1|nowrap=1|ext=Scribunto|#invoke|Example}}
renders as:
{{#invoke:Example}}
{{Magic word|code=1|#language|{{Magic word|PAGELANGUAGE}}}}
renders as:
{{#language:{{PAGELANGUAGE}}}}
See also
Localization
This template is not intended to be localized.