|
|
(9 intermediate revisions by one user not shown) |
Line 1: |
Line 1: |
| + | {{see also|[[Help:Magic words for beginners]]}} |
| {{TOC right}} | | {{TOC right}} |
| + | '''Magic words''' (which include '''parser functions''', '''variables''' and '''behavior switches''') are features of [[wikipedia:Help:Wiki markup|wiki markup]] that enable various instructions to be given to the [[wikipedia:Help:MediaWiki namespace|MediaWiki]] software. For example, the magic words may be used to suppress or position the table of contents, or to produce other variable outputs, as is often required in [[GP:Templates|templates]]. |
| | | |
− | '''Magic words''' are strings of text that MediaWiki associates with a return value or function, such as time, site details, or page names. This page is about usage of standard magic words; for a technical reference, see [https://www.mediawiki.org/wiki/Manual:Magic_words this page]. | + | A quick reference for magic words can be found on this page. For more complete documentation, see the following pages on the MediaWiki site: |
| + | * '''[[mw:Help:Magic words]]''' for all standard magic words, including the "standard" parser functions |
| + | * '''[[mw:Help:Extension:ParserFunctions]]''' for some additional parser functions, including conditional expressions |
| | | |
− | There are three general types of magic words:
| + | == General information == |
| | | |
− | * '''Behavior switches''': these are uppercase words surrounded by double underscores, ''e.g.'' '''__FOO__'''.
| + | There are three types of magic words: |
| + | :# '''Behavior switches''': uppercase words surrounded by double underscores, e.g., <code><nowiki>__NOTOC__</nowiki></code> or other keywords using parser function syntax |
| + | :# '''Variables''': uppercase words surrounded by double braces (thus resembling [[Help:Template|templates]]), e.g. <code><nowiki>{{PAGENAME}}</nowiki></code> |
| + | :# '''Parser functions''': keywords in double braces with parameters after a colon (some beginning with #), e.g. <code><nowiki>{{#expr:2+2}}</nowiki></code> |
| | | |
− | * '''Variables''': these are uppercase words surrounded by double braces, ''e.g.'' '''<code><nowiki>{{FOO}}</nowiki></code>'''. As such, they look a lot like [[Help:Templates|templates]].
| + | Some magic words are case-insensitive, but not all. White space is stripped from the start and end of keywords and parameters, as in template syntax. |
| | | |
− | * '''Parser functions''': these take parameters and are either of the form '''<code><nowiki>{{foo:...}}</nowiki></code>''' or '''<code><nowiki>{{#foo:...}}</nowiki></code>'''. See also [https://www.mediawiki.org/wiki/Help:Extension:ParserFunctions Help:Extension:ParserFunctions] in the Mediawiki manual.
| + | Page-dependent magic words will affect or return data about the ''current'' page, even if the word is added through a [[help:Transclusion|transcluded]] template or included system message. |
| | | |
− | Variables and parser functions can use [https://www.mediawiki.org/wiki/Manual:Substitution subst:] (substitution), just like templates. Page-dependent magic words will affect or return data about the ''current'' page (by default), even if the word is added through a transcluded template or included system message.
| + | It is possible to [[Help:Substitution|substitute]] parser functions and most variables in the same way that templates are substituted (using the <code>subst:</code> keyword). This causes their current value (as evaluated at the time of substitution) to be written into the wikitext. |
| | | |
− | == Behavior switches == | + | == Behavior switches == |
− | | + | : ''For documentation, see the [[mw:Help:Magic words#Behavior switches|Behavior switches]] section of the MediaWiki page, unless otherwise stated.'' |
− | A behavior switch controls the layout or behavior of the page and can often be used to specify desired omissions and inclusions in the content.
| + | |
| | | |
| {| class="wikitable" | | {| class="wikitable" |
| + | ! Code |
| + | ! Notes |
| |- | | |- |
− | ! width="20%" | <!--T:9-->
| + | | <code><nowiki> __TOC__ </nowiki></code> |
− | Word
| + | | Places the page's [[Help:Table of contents|table of contents (TOC)]] at the word's position. |
− | ! <!--T:10-->
| + | |
− | Description
| + | |
− | ! width="15%" | <!--T:11-->
| + | |
− | Versions
| + | |
| |- | | |- |
− | ! colspan="3" style="background-color: #DDDDDD;"| <!--T:257-->
| + | | <code><nowiki> __FORCETOC__ </nowiki></code> |
− | [[<tvar|manual-toc>Special:MyLanguage/Manual:Table of contents</>|Table of contents]]
| + | | Forces the TOC to appear in its default position immediately before the page's first section (first heading). Can be used anywhere on a page. |
| |- | | |- |
− | | <code><nowiki>__NOTOC__</nowiki></code> | + | | <code><nowiki> __NOTOC__ </nowiki></code> |
− | | <!--T:12--> | + | | Suppresses the appearance of the page's TOC. Can be used anywhere on a page. |
− | Hides the [[<tvar|manual-toc>Special:MyLanguage/table of contents</>|table of contents]] (TOC).
| + | |
− | |
| + | |
| |- | | |- |
− | | <code><nowiki>__FORCETOC__</nowiki></code> | + | | <code><nowiki> __NOEDITSECTION__ </nowiki></code> |
− | | <!--T:13--> | + | | Hides the "edit" links normally beside all headings on the page. To hide the edit link beside a particular heading, specify the heading using e.g. an HTML tag such as '''<nowiki><h2>[Heading]</h2></nowiki>''' rather than with the usual wiki equals-signs syntax (e.g. '''== [Heading] =='''). |
− | Forces the table of contents to appear at its normal position (before the first header, overriding <tvar|notoc><code><nowiki>__NOTOC__</nowiki></code></>).
| + | |
− | |
| + | |
| |- | | |- |
− | | <code><nowiki>__TOC__</nowiki></code> | + | | <code><nowiki> __NEWSECTIONLINK__ </nowiki></code> |
− | | <!--T:14--> | + | | On non-talk pages, adds a "{{int:vector-action-addsection}}" link as a means to add a new section to the page. |
− | Places a table of contents at the word's current position (overriding <tvar|notoc><code><nowiki>__NOTOC__</nowiki></code></>). If this is used multiple times, the table of contents will appear at the first word's position.
| + | |
− | |
| + | |
| |- | | |- |
− | ! colspan="3" style="background-color: #DDDDDD;"| <!--T:15-->
| + | | <code><nowiki> __NONEWSECTIONLINK__ </nowiki></code> |
− | Editing
| + | | Removes the "{{int:vector-action-addsection}}" link (the add-new-section link) on talk pages. |
| |- | | |- |
− | | <code><nowiki>__NOEDITSECTION__</nowiki></code> | + | | <code><nowiki> __NOGALLERY__ </nowiki></code> |
− | | | + | | Replaces thumbnails on a category page with normal links. |
− | Hides the section edit links beside headings. This is especially useful, where a heading is created from within a template: the normal wiki section-edit would in this case edit the template code, which is normally counterintuitive to the user. If a template contains multiple headings, it may be necessary to add "<tvar|noeditsection><code><nowiki>__NOEDITSECTION__</nowiki></code></>" after each heading.
| + | |
− | |
| + | |
| |- | | |- |
− | | <code><nowiki>__NEWSECTIONLINK__</nowiki></code> | + | | <code><nowiki> __HIDDENCAT__ </nowiki></code> |
− | | | + | | Makes a category [[Categorization#Hiding_categories|hidden]] when included on that category's page. |
− | Adds a link beside the "edit" tab for adding a new section on a non-talk page (see {{mediawiki|<tvar|meta-help-section>m:Special:MyLanguage/Help:Section#Adding a section at the end</>|Adding a section to the end}}).
| + | |
− | | {{ {{TNTN|MW version}} |version=1.7|compact=y|comment=and after}}
| + | |
| |- | | |- |
− | | <code><nowiki>__NONEWSECTIONLINK__</nowiki></code> | + | | <code><nowiki> __INDEX__ </nowiki></code> |
− | | <!--T:18--> | + | | Instructs search engines to index the page. |
− | Removes the link beside the "edit" tab on pages in talk namespaces.
| + | |
− | | {{ {{TNTN|MW version}} |version=1.15|compact=y|comment=and after|r=47522}}
| + | |
| |- | | |- |
− | ! colspan="3"| <!--T:19-->
| + | | <code><nowiki> __NOINDEX__ </nowiki></code> |
− | Categories
| + | | Instructs search engines not to index the page. See [[Wikipedia:Controlling search engine indexing]]. |
| |- | | |- |
− | | <code><nowiki>__NOGALLERY__</nowiki></code> | + | | <code><nowiki> __STATICREDIRECT__ </nowiki></code> |
− | | <!--T:20--> | + | | Prevents the link on a [[Help:Redirect|redirection]] page from being updated automatically when the page to which it redirects is moved (and "Update any redirects that point to the original title" is selected). Also instructs [[Help:Interwiki linking|interwiki]] [[Wikipedia:Bots|bots]] to treat the page as if an article. |
− | Used on a category page, replaces thumbnails in the category view with normal links.
| + | |
− | | {{ {{TNTN|MW version}} |version=1.7|compact=y|comment=and after}} | + | |
| |- | | |- |
− | | <code><nowiki>__HIDDENCAT__</nowiki></code> | + | | <code><nowiki> __DISAMBIG__ </nowiki></code> |
− | | <!--T:21--> | + | | Marks a page as a [[help:disambiguation|disambiguation page]], adds it to [[Special:DisambiguationPages]] and places inward links in [[Special:DisambiguationPageLinks]]. (See [[mw:Extension:Disambiguator]].) |
− | Used on a category page, hides the category from the lists of categories in its members and parent categories (there is an option in the [[<tvar|help-preferences>Special:MyLanguage/Help:Preferences</>|user preferences]] to show them).<!-- hiddencategory hiddencat hide category categories -->
| + | |
− | | {{ {{TNTN|MW version}} |version=1.13|compact=y|comment=and after}}
| + | |
| |- | | |- |
− | ! colspan="3" style="background-color: #DDDDDD;"| <!--T:22-->
| + | | <code><nowiki>{{DEFAULTSORT:</nowiki></code>''sortkey''<code><nowiki>}}</nowiki></code> |
− | Language conversion
| + | | Sets the default sort key (the index) under which the page is categorised. |
− | |-
| + | |
− | | <code><nowiki>__NOCONTENTCONVERT__</nowiki></code> <br /> <code><nowiki>__NOCC__</nowiki></code> | + | |
− | | <!--T:23-->
| + | |
− | On wikis with language variants, don't perform any content language conversion (character and phase) in article display; for example, only show Chinese (zh) instead of variants like zh_cn, zh_tw, zh_sg, or zh_hk.
| + | |
− | |
| + | |
− | |-
| + | |
− | | <code><nowiki>__NOTITLECONVERT__</nowiki></code> <br /> <code><nowiki>__NOTC__</nowiki></code>
| + | |
− | | <!--T:24-->
| + | |
− | On wikis with language variants, don't perform language conversion on the title (all other content is converted).
| + | |
− | |
| + | |
− | |-
| + | |
− | ! colspan="3" style="background-color: #DDDDDD;"| <!--T:25-->
| + | |
− | Other
| + | |
− | |-
| + | |
− | | <code><nowiki>__START__</nowiki></code>
| + | |
− | | <!--T:26-->
| + | |
− | No effect. <small>Removed in [[Special:Code/MediaWiki/1695|r1695]] and completly removed in [[Special:Code/MediaWiki/24784|r24784]]</small>
| + | |
− | | {{ {{TNTN|MW version}} |version=1.10|compact=y|comment=and before|r=1610}}
| + | |
− | |-
| + | |
− | | <code><nowiki>__END__</nowiki></code>
| + | |
− | | <!--T:27--> | + | |
− | Explicitly marks the end of the article, to prevent MediaWiki from removing trailing whitespace. Removed in {{mediawiki|rev:19213|19213}}.
| + | |
− | | {{ {{TNTN|MW version}} |version=1.1|compact=y|version2=1.8}}
| + | |
− | |-
| + | |
− | | <code><nowiki>__INDEX__</nowiki></code>
| + | |
− | | <!--T:28-->
| + | |
− | Tell search engines to index the page (overrides <tvar|manual-wg-bot-policy>{{mediawiki|Special:MyLanguage/Manual:$wgArticleRobotPolicies|$wgArticleRobotPolicies}}</>, but not robots.txt). It obeys <tvar|manual-wg-exempt-from-bot>[[Special:MyLanguage/Manual:$wgExemptFromUserRobotsControl|$wgExemptFromUserRobotsControl]]</> variable.
| + | |
− | | {{ {{TNTN|MW version}} |version=1.14|compact=y|comment=and after}}
| + | |
− | |-
| + | |
− | | <code><nowiki>__NOINDEX__</nowiki></code>
| + | |
− | | <!--T:29-->
| + | |
− | Tell search engines not to index the page (i.e. do not list in search engines' results). It obeys <tvar|manual-wg-exempt-from-bot>[[Special:MyLanguage/Manual:$wgExemptFromUserRobotsControl|$wgExemptFromUserRobotsControl]]</> variable.
| + | |
− | | {{ {{TNTN|MW version}} |version=1.14|compact=y|comment=and after|r=37973}}
| + | |
− | |-
| + | |
− | | <code><nowiki>__STATICREDIRECT__</nowiki></code>
| + | |
− | | <!--T:30-->
| + | |
− | On redirect pages, don't allow MediaWiki to automatically update the link when someone moves a page and checks "<tvar|fixDoubleRedirects>{{int:Fix-double-redirects}}</>" (which requires [[<tvar|var>Special:MyLanguage/Manual:$wgFixDoubleRedirects</>|$wgFixDoubleRedirects]]).
| + | |
− | | {{ {{TNTN|MW version}} |version=1.13|compact=y|comment=and after|r=37928}}
| + | |
− | |-
| + | |
− | | <code><nowiki>__DISAMBIG__</nowiki></code>
| + | |
− | | <!--T:31-->
| + | |
− | Marks a page as a disambiguation page and places it in [[Special:DisambiguationPages]], and places inward links in [[Special:DisambiguationPageLinks]]. See <tvar|ext-disambiguator>{{ll|Extension:Disambiguator}}</>.
| + | |
− | | <!--T:32-->
| + | |
− | requires <tvar|ext-disambiguator>{{ll|Extension:Disambiguator}}</>
| + | |
| |} | | |} |
| | | |
− | {{anchor|Variables}}
| + | == Variables == |
| + | : ''For more documentation, see [[mw:Help:Magic words#Variables|this Wikipedia page]]. |
| | | |
| + | The example outputs in the following table are those that would be produced on the page "{{FULLPAGENAME}}/subpage". |
| | | |
− | == Variables == <!--T:33--> | + | {| class="wikitable sortable" style="clear:right" |
− | | + | ! Variable |
− | <!--T:34-->
| + | ! Example output |
− | Variables return information about the current page, wiki, or date. Their syntax is similar to [[<tvar|help-templates>Special:MyLanguage/Help:Templates</>|templates]]. Variables marked as "<span style="background: #FED;">'''[expensive]'''</span>" are tracked by the software, and the number that can be included on a page is limited.
| + | ! Notes |
− | | + | |
− | <!--T:35-->
| + | |
− | If a template name conflicts with a variable, the variable will be used (so to transclude the template [[{{ns:10}}:PAGENAME]] you would need to write <tvar|code><code><nowiki>{{</nowiki>{{ns:10}}:</>PAGENAME<tvar|code-end><nowiki>}}</nowiki></code></>). In some cases, adding parameters will force the parser to invoke a template; for example, <tvar|tpl-currentdayname-code><code><nowiki>{{CURRENTDAYNAME|x}}</nowiki></code></> transcludes <tvar|tpl-currentdayname-result>[[{{ns:10}}:CURRENTDAYNAME]]</>, ''not'' the variable.
| + | |
− | | + | |
− | | + | |
− | {{anchor|Date and time}}
| + | |
− | | + | |
− | === Date and time === <!--T:36-->
| + | |
− | | + | |
− | <!--T:37-->
| + | |
− | The following variables return the current date and time in [[w:UTC|UTC]].
| + | |
− | | + | |
− | <!--T:38-->
| + | |
− | Due to MediaWiki and browser caching, these variables frequently show when the page was ''cached'' rather than the current time.
| + | |
− | | + | |
− | <!--T:39-->
| + | |
− | The date and time magic words are formatted in the wiki content language. Since {{r|94680|1.19}}, they depend on the [[<tvar|manual-pagelang>Special:MyLanguage/Manual:Language#page-content-lang</>|page content language]].
| + | |
− | | + | |
− | {| class="wikitable"
| + | |
| |- | | |- |
− | ! <!--T:40-->
| + | | {{wikivar|PAGENAME}} |
− | Variable
| + | | {{PAGENAME:{{FULLPAGENAME}}/subpage}} |
− | ! <!--T:41-->
| + | | Current [[Help:Page name|page's name]] excluding [[Wikipedia:Namespaces|namespace]]. |
− | Output
| + | |
− | ! <!--T:42-->
| + | |
− | Description
| + | |
− | ! <!--T:43-->
| + | |
− | Versions
| + | |
| |- | | |- |
− | ! colspan="4" style="background-color: #DDDDDD;"| <!--T:44-->
| + | | {{wikivar|NAMESPACE}} |
− | Year{{Anchor|CURRENTYEAR}}
| + | | {{NAMESPACE:{{FULLPAGENAME}}/subpage}} |
| + | | Current page's namespace. |
| |- | | |- |
− | | <code><nowiki>{{CURRENTYEAR}}</nowiki></code> | + | | {{wikivar|NAMESPACENUMBER}} |
− | | {{CURRENTYEAR}} | + | | {{NAMESPACENUMBER:{{FULLPAGENAME}}/subpage}} |
− | | <!--T:45--> | + | | The namespace number of the current page. |
− | Year
| + | |
− | |
| + | |
| |- | | |- |
− | ! colspan="4" style="background-color: #DDDDDD;"| <!--T:46-->
| + | | {{wikivar|FULLPAGENAME}} |
− | Month{{Anchor|CURRENTMONTH|CURRENTMONTH1|CURRENTMONTHNAME|CURRENTMONTHNAMEGEN|CURRENTMONTHABBREV}}
| + | | {{FULLPAGENAME:{{FULLPAGENAME}}/subpage}} |
| + | | Current page's name including namespace (i.e. FULLPAGENAME = NAMESPACE''':'''PAGENAME). |
| |- | | |- |
− | | <code><nowiki>{{CURRENTMONTH}}</nowiki></code> | + | | {{wikivar|BASEPAGENAME}} |
− | | {{CURRENTMONTH}} | + | | {{BASEPAGENAME:{{FULLPAGENAME}}/subpage}} |
− | | <!--T:47--> | + | | Current page's name excluding namespace and any subpage element or elements (i.e. the first forward-slash ("/") and anything following; in effect, a subpage's parent's name less its namespace). |
− | Month (zero-padded number)
| + | |
− | |
| + | |
| |- | | |- |
− | | <code><nowiki>{{CURRENTMONTH1}}</nowiki></code> | + | | {{wikivar|SUBPAGENAME}} |
− | | {{CURRENTMONTH1}}
| + | | {{SUBPAGENAME:{{FULLPAGENAME}}/subpage}} |
− | | <!--T:304-->
| + | | Returns either the [[Help:Subpages|subpage]] part of the page's name – i.e. whatever follows the last forward-slash ("/") in the page's name – or, if the page is not a subpage (i.e. its name contains no forward-slashes), <code><nowiki>{{BASEPAGENAME}}</nowiki></code> (PAGENAME = BASEPAGENAME/SUBPAGENAME). |
− | Month (non-zero-padded number)
| + | |
− | |
| + | |
| |- | | |- |
− | | <code><nowiki>{{CURRENTMONTHNAME}}</nowiki></code> | + | | {{wikivar|ARTICLEPAGENAME}}<br/>{{wikivar|SUBJECTPAGENAME}} |
− | | {{CURRENTMONTHNAME}}
| + | | {{ARTICLEPAGENAME:{{FULLPAGENAME}}/subpage}}<br/>{{SUBJECTPAGENAME:{{FULLPAGENAME}}/subpage}} |
− | | <!--T:48--> | + | | Current page's associated non-talk page. |
− | Month (name)
| + | |
− | | | + | |
| |- | | |- |
− | | <code><nowiki>{{CURRENTMONTHNAMEGEN}}</nowiki></code> | + | | {{wikivar|ARTICLESPACE}}<br/>{{wikivar|SUBJECTSPACE}} |
− | | {{CURRENTMONTHNAMEGEN}}
| + | | {{ARTICLESPACE:{{FULLPAGENAME}}/subpage}}<br/>{{SUBJECTSPACE:{{FULLPAGENAME}}/subpage}} |
− | | <!--T:49--> | + | | Current page's associated non-talk namespace. |
− | Month ([[wikipedia:genitive|genitive form]])
| + | |
− | | | + | |
| |- | | |- |
− | | <code><nowiki>{{CURRENTMONTHABBREV}}</nowiki></code> | + | | {{wikivar|TALKPAGENAME}} |
− | | {{CURRENTMONTHABBREV}} | + | | {{TALKPAGENAME:{{FULLPAGENAME}}/subpage}} |
− | | <!--T:50-->
| + | | Name of talk page associated with current page. |
− | Month (abbreviation)
| + | |
− | | {{ {{TNTN|MW version}} |version=1.5|compact=y|comment=and after}}
| + | |
| |- | | |- |
− | ! colspan="4" style="background-color: #DDDDDD;"| <!--T:51-->
| + | | {{wikivar|TALKSPACE}} |
− | Day{{Anchor|CURRENTDAY|CURRENTDAY2|CURRENTDOW|CURRENTDAYNAME}}
| + | | {{TALKSPACE:{{FULLPAGENAME}}/subpage}} |
| + | | Associated talk page's namespace. |
| |- | | |- |
− | | <code><nowiki>{{CURRENTDAY}}</nowiki></code> | + | | {{wikivar|FULLPAGENAMEE}},<br/>{{wikivar|PAGENAMEE}},<br/> (etc.) |
− | | {{CURRENTDAY}}
| + | | {{FULLPAGENAMEE:{{FULLPAGENAME}}/subpage}},<br/>{{PAGENAMEE:{{FULLPAGENAME}}/subpage}},<br/>(etc.) |
− | | <!--T:52--> | + | | Adding an E to the end of the above variables, renders the above encoded for use in MediaWiki URLs (i.e. with underscores replacing spaces). |
− | Day of the month (unpadded number)
| + | |}<!-- |
− | |
| + | |
− | |-
| + | |
− | | <code><nowiki>{{CURRENTDAY2}}</nowiki></code>
| + | |
− | | {{CURRENTDAY2}}
| + | |
− | | <!--T:53-->
| + | |
− | Day of the month (zero-padded number)
| + | |
− | | {{ {{TNTN|MW version}} |version=1.6|compact=y|comment=and after}} | + | |
− | |-
| + | |
− | | <code><nowiki>{{CURRENTDOW}}</nowiki></code>
| + | |
− | | {{CURRENTDOW}}
| + | |
− | | <!--T:54-->
| + | |
− | Day of the week (unpadded number), 0 (for Sunday) through 6 (for Saturday)
| + | |
− | |
| + | |
− | |-
| + | |
− | | <code><nowiki>{{CURRENTDAYNAME}}</nowiki></code>
| + | |
− | | {{CURRENTDAYNAME}}
| + | |
− | | <!--T:55-->
| + | |
− | Day of the week (name)
| + | |
− | |
| + | |
− | |-
| + | |
− | ! colspan="4" style="background-color: #DDDDDD;"| <!--T:56-->
| + | |
− | Time{{Anchor|CURRENTTIME|CURRENTHOUR}}
| + | |
− | |-
| + | |
− | | <code><nowiki>{{CURRENTTIME}}</nowiki></code>
| + | |
− | | {{CURRENTTIME}}
| + | |
− | | <!--T:57-->
| + | |
− | Time (24-hour HH:mm format)
| + | |
− | |
| + | |
− | |-
| + | |
− | | <code><nowiki>{{CURRENTHOUR}}</nowiki></code>
| + | |
− | | {{CURRENTHOUR}}
| + | |
− | | <!--T:58-->
| + | |
− | Hour (24-hour zero-padded number)
| + | |
− | | | + | |
− | |-
| + | |
− | ! colspan="4" style="background-color: #DDDDDD;"| <!--T:59-->
| + | |
− | Other{{Anchor|CURRENTWEEK|CURRENTTIMESTAMP}}
| + | |
− | |-
| + | |
− | | <code><nowiki>{{CURRENTWEEK}}</nowiki></code>
| + | |
− | | {{CURRENTWEEK}}
| + | |
− | | <!--T:60-->
| + | |
− | Week (number)
| + | |
− | | | + | |
− | |-
| + | |
− | | <code><nowiki>{{CURRENTTIMESTAMP}}</nowiki></code>
| + | |
− | | {{CURRENTTIMESTAMP}}
| + | |
− | | <!--T:61-->
| + | |
− | YYYYMMDDHHmmss timestamp
| + | |
− | | {{ {{TNTN|MW version}} |version=1.7|compact=y|comment=and after}}
| + | |
− | |}
| + | |
| | | |
− | <!--T:62-->
| + | -->''Note:'' The magic words above can also take a parameter, in order to parse values on a page other than the current page. A colon (''':''') is used to pass the parameter, rather than a pipe ('''|''') that is used in templates, like <code><nowiki>{{MAGICWORD:value}}</nowiki></code>. For example, <code><nowiki>{{TALKPAGENAME:Wikipedia:MOS}}</nowiki></code> returns <code><nowiki>Wikipedia talk:MOS</nowiki></code> on any page. See [https://meta.wikimedia.org/wiki/Help:Page_name meta:Help:Page name] for more details of parser functions. |
− | The following variables do the same as the preceding ones, but using the site's server config or <tvar|manual-wg-localtimezone>[[Special:MyLanguage/Manual:$wgLocaltimezone|$wgLocaltimezone]]</>. | + | |
| | | |
− | * <code><nowiki>{{LOCALYEAR}}</nowiki>
| + | {| class=wikitable |
− | * <nowiki>{{LOCALMONTH}}</nowiki>
| + | ! Code !! Example !! Notes |
− | * <nowiki>{{LOCALMONTH1}}</nowiki>
| + | |
− | * <nowiki>{{LOCALMONTHNAME}}</nowiki>
| + | |
− | * <nowiki>{{LOCALMONTHNAMEGEN}}</nowiki>
| + | |
− | * <nowiki>{{LOCALMONTHABBREV}}</nowiki>
| + | |
− | * <nowiki>{{LOCALDAY}}</nowiki>
| + | |
− | * <nowiki>{{LOCALDAY2}}</nowiki>
| + | |
− | * <nowiki>{{LOCALDOW}}</nowiki>
| + | |
− | * <nowiki>{{LOCALDAYNAME}}</nowiki>
| + | |
− | * <nowiki>{{LOCALTIME}}</nowiki>
| + | |
− | * <nowiki>{{LOCALHOUR}}</nowiki>
| + | |
− | * <nowiki>{{LOCALWEEK}}</nowiki>
| + | |
− | * <nowiki>{{LOCALTIMESTAMP}}</nowiki></code>
| + | |
− | | + | |
− | <!--T:63-->
| + | |
− | ''For more thorough time formatting, you may want to install <tvar|ext-parserfunctions>{{ll|Extension:ParserFunctions}}</> to use the [[<tvar|ext-parserfunct-t>Special:MyLanguage/Help:Extension:ParserFunctions#.23time</>|#time parser function]]''.
| + | |
− | | + | |
− | === Technical metadata === <!--T:64--> | + | |
− | | + | |
− | <!--T:65-->
| + | |
− | ''Note:'' Revision variables return data about the '''latest edit to the current page''', even if viewing an older version of the page.
| + | |
− | | + | |
− | {| class="wikitable"
| + | |
| |- | | |- |
− | ! width="10%" | <!--T:66-->
| + | | {{wikivar|SITENAME}} || {{SITENAME}} || |
− | Variable
| + | |
− | ! width="15%" | <!--T:67-->
| + | |
− | Output
| + | |
− | ! <!--T:68-->
| + | |
− | Description
| + | |
− | ! width="10%" | <!--T:69-->
| + | |
− | Versions
| + | |
| |- | | |- |
− | ! colspan="4" style="background-color: #DDDDDD;"| {{Anchor|Site|SITENAME|SERVER|SERVERNAME|DIRMARK|DIRECTIONMARK}}{{Anchor|SCRIPTPATH|STYLEPATH|CURRENTVERSION|CONTENTLANGUAGE|CONTENTLANG}}<!--T:70-->
| + | | {{wikivar|SERVER}} || {{SERVER}} || |
− | Site
| + | |
| |- | | |- |
− | | <code><nowiki>{{SITENAME}}</nowiki></code> | + | | {{wikivar|SERVERNAME}} || {{SERVERNAME}} || |
− | | {{SITENAME}} | + | |
− | | <!--T:71--> | + | |
− | The wiki's site name (<tvar|manual-wg-sitename>{{mediawiki|Special:MyLanguage/Manual:$wgSitename|$wgSitename}}</>).
| + | |
− | | | + | |
| |- | | |- |
− | | <code><nowiki>{{SERVER}}</nowiki></code> | + | | {{wikivar|CURRENTVERSION}} || {{CURRENTVERSION}} || Returns current MediaWiki version. |
− | | {{SERVER}} | + | |
− | | <!--T:72--> | + | |
− | Domain [[w:URL|URL]] (<tvar|manual-wg-server>{{mediawiki|Special:MyLanguage/Manual:$wgServer|$wgServer}}</>).
| + | |
− | |
| + | |
− | |-
| + | |
− | | <code><nowiki>{{SERVERNAME}}</nowiki></code>
| + | |
− | | {{SERVERNAME}}
| + | |
− | | <!--T:73-->
| + | |
− | Subdomain and domain name (no longer dependent on <tvar|manual-wg-servername>{{mediawiki|Special:MyLanguage/Manual:$wgServerName|$wgServerName}}</> as of version 1.17).
| + | |
− | |
| + | |
− | |-
| + | |
− | | <code><nowiki>{{DIRMARK}}</nowiki></code> <br /><code><nowiki>{{DIRECTIONMARK}}</nowiki></code>
| + | |
− | | {{DIRMARK}} <br />{{DIRECTIONMARK}}
| + | |
− | | <!--T:74-->
| + | |
− | Outputs a [[w:Unicode|Unicode]] directional mark that matches the wiki's default language's direction (<code>&lrm;</code> on left-to-right wikis, <code>&rlm;</code> on right-to-left wikis), useful in text with multi-directional text. Since {{r|94680|1.19}}, it depends on the [[<tvar|manual-pagelang>Special:MyLanguage/Manual:Language#page-content-lang</>|page content language]].
| + | |
− | | {{ {{TNTN|MW version}} |version=1.7|compact=y|comment=and after|r=14442}}
| + | |
− | |-
| + | |
− | | <code><nowiki>{{SCRIPTPATH}}</nowiki></code>
| + | |
− | | {{SCRIPTPATH}}
| + | |
− | | <!--T:75-->
| + | |
− | Relative script path (<tvar|manual-wg-scriptpath>{{mediawiki|Special:MyLanguage/Manual:$wgScriptPath|$wgScriptPath}}</>).
| + | |
− | |
| + | |
− | |-
| + | |
− | | <code><nowiki>{{STYLEPATH}}</nowiki></code>
| + | |
− | | {{STYLEPATH}}
| + | |
− | | <!--T:76-->
| + | |
− | Relative style path (<tvar|manual-wg-stylepath>{{mediawiki|Special:MyLanguage/Manual:$wgStylePath|$wgStylePath}}</>).
| + | |
− | | {{ {{TNTN|MW version}} |version=1.16|compact=y|comment=and after}}
| + | |
− | |-
| + | |
− | | <code><nowiki>{{CURRENTVERSION}}</nowiki></code>
| + | |
− | | {{CURRENTVERSION}} | + | |
− | | <!--T:77-->
| + | |
− | The wiki's MediaWiki version.
| + | |
− | | {{ {{TNTN|MW version}} |version=1.7|compact=y|comment=and after|r=14199}}
| + | |
− | |-
| + | |
− | | <code><nowiki>{{CONTENTLANGUAGE}}</nowiki></code> <br /><code><nowiki>{{CONTENTLANG}}</nowiki></code>
| + | |
− | | {{CONTENTLANGUAGE}} <br />{{CONTENTLANG}}
| + | |
− | | <!--T:78-->
| + | |
− | The wiki's default interface language (<tvar|manual-wg-langcode>{{mediawiki|Special:MyLanguage/Manual:$wgLanguageCode|$wgLanguageCode}}</>).
| + | |
− | | {{ {{TNTN|MW version}} |version=1.7|compact=y|comment=and after|r=14661}}
| + | |
− | |-
| + | |
− | ! colspan="4" style="background-color: #DDDDDD;"| {{Anchor|Page|PAGEID|PROTECTIONLEVEL|CASCADINGSOURCES}}<!--T:79-->
| + | |
− | Page
| + | |
− | |-
| + | |
− | | <code><nowiki>{{PAGEID}}</nowiki></code>
| + | |
− | | {{PAGEID}}
| + | |
− | | <!--T:80--> | + | |
− | Returns the page identifier. | + | |
− | | {{ {{TNTN|MW version}} |version=1.20|compact=y|comment=and after|gerrit change=9858}}
| + | |
− | |-
| + | |
− | | <code><nowiki>{{</nowiki>PROTECTIONLEVEL:<!--T:261-->
| + | |
− | ''action''}}</code>
| + | |
− | | <!-- Leave this empty. -->
| + | |
− | | <!--T:81-->
| + | |
− | Outputs the protection level (e.g. "autoconfirmed", "sysop") for a given action (e.g. "edit", "move") on the current page. Returns an empty string if not protected.
| + | |
− | | {{ {{TNTN|MW version}} |version=1.15|compact=y|comment=and after|r=45587}}
| + | |
− | |- style="background:#FED;"
| + | |
− | | <code><nowiki>{{CASCADINGSOURCES}}</nowiki></code>
| + | |
− | | <!-- Leave this empty. -->
| + | |
− | | <!--T:291-->
| + | |
− | '''[Expensive]''' Returns the sources of any cascading protection acting on the current page. Pages will not return their own title unless they transclude themselves.
| + | |
− | | {{ {{TNTN|MW version}} |version=1.23|compact=y|comment=and after|gerrit change=104999}}
| + | |
− | |-
| + | |
− | ! colspan="4" style="background-color: #DDDDDD;"| {{Anchor|revision|REVISIONID|REVISIONDAY|REVISIONDAY2|REVISIONMONTH|REVISIONMONTH1|REVISIONYEAR|REVISIONTIMESTAMP|REVISIONUSER}}<!--T:82-->
| + | |
− | Latest revision to current page
| + | |
− | |-
| + | |
− | | <code><nowiki>{{REVISIONID}}</nowiki></code>
| + | |
− | | {{REVISIONID}}
| + | |
− | | <!--T:83-->
| + | |
− | Unique revision ID.
| + | |
− | | {{ {{TNTN|MW version}} |version=1.5|compact=y|comment=and after}}
| + | |
− | |-
| + | |
− | | <code><nowiki>{{REVISIONDAY}}</nowiki></code>
| + | |
− | | {{REVISIONDAY}}
| + | |
− | | <!--T:84-->
| + | |
− | Day edit was made (unpadded number).
| + | |
− | | {{ {{TNTN|MW version}} |version=1.8|compact=y|comment=and after}}
| + | |
− | |-
| + | |
− | | <code><nowiki>{{REVISIONDAY2}}</nowiki></code>
| + | |
− | | {{REVISIONDAY2}}
| + | |
− | | <!--T:85-->
| + | |
− | Day edit was made (zero-padded number).
| + | |
− | | {{ {{TNTN|MW version}} |version=1.8|compact=y|comment=and after}}
| + | |
− | |-
| + | |
− | | <code><nowiki>{{REVISIONMONTH}}</nowiki></code>
| + | |
− | | {{REVISIONMONTH}}
| + | |
− | | <!--T:86-->
| + | |
− | Month edit was made (zero-padded number as of {{mediawiki|rev:66200|1.17+}}, unpadded number in prior versions).
| + | |
− | | {{ {{TNTN|MW version}} |version=1.8|compact=y|comment=and after}}
| + | |
− | |-
| + | |
− | | <code><nowiki>{{REVISIONMONTH1}}</nowiki></code>
| + | |
− | | {{REVISIONMONTH1}}
| + | |
− | | <!--T:87-->
| + | |
− | Month edit was made (unpadded number).
| + | |
− | | {{ {{TNTN|MW version}} |version=1.17|compact=y|comment=and after|r=66200}}
| + | |
− | |-
| + | |
− | | <code><nowiki>{{REVISIONYEAR}}</nowiki></code>
| + | |
− | | {{REVISIONYEAR}}
| + | |
− | | <!--T:88-->
| + | |
− | Year edit was made.
| + | |
− | | {{ {{TNTN|MW version}} |version=1.8|compact=y|comment=and after}}
| + | |
− | |-
| + | |
− | | <code><nowiki>{{REVISIONTIMESTAMP}}</nowiki></code>
| + | |
− | | {{REVISIONTIMESTAMP}}
| + | |
− | | <!--T:89-->
| + | |
− | Timestamp as of time of edit.
| + | |
− | | {{ {{TNTN|MW version}} |version=1.8|compact=y|comment=and after}}
| + | |
− | |-
| + | |
− | | <code><nowiki>{{REVISIONUSER}}</nowiki></code>
| + | |
− | | {{REVISIONUSER}}
| + | |
− | | <!--T:90-->
| + | |
− | The username of the user who made the most recent edit to the page, or the current user when previewing an edit.
| + | |
− | | {{ {{TNTN|MW version}} |version=1.15|compact=y|comment=and after|r=48149}}
| + | |
− | |-
| + | |
− | | <code><nowiki>{{REVISIONSIZE}}</nowiki></code>
| + | |
− | | {{REVISIONSIZE}}
| + | |
− | | <!--T:91-->
| + | |
− | The size (bytes of wikitext) of the current revision of this page
| + | |
− | | {{ {{TNTN|MW version}} |version=1.22|compact=y|comment=and after|gerrit change=82650}}
| + | |
− | |-
| + | |
− | ! colspan="4" style="background-color: #DDDDDD;"| {{Anchor|DISPLAYTITLE|DEAFULTSORT|DEFAULTCATEGORYSORT|DEFAULTSORTKEY}}<!--T:92-->
| + | |
− | Affects page content
| + | |
− | |-
| + | |
− | | {{anchor|Displaytitle}} <code><nowiki>{{DISPLAYTITLE:</nowiki><!--T:262-->
| + | |
− | ''title''<nowiki>}}</nowiki></code>
| + | |
− | |
| + | |
− | | <!--T:93-->
| + | |
− | Format the current page's title header. The value must be equivalent to the default title: only capitalization changes and replacing spaces with underscores are allowed (this can be changed with <tvar|manual-wg-restrict-disp-title>{{mediawiki|Special:MyLanguage/Manual:$wgRestrictDisplayTitle|$wgRestrictDisplayTitle}}</>). It can be disabled or enabled by <tvar|manual-wg-allow-disp-title>{{mediawiki|Special:MyLanguage/Manual:$wgAllowDisplayTitle|$wgAllowDisplayTitle}}</>; disabled by default before 1.10+, enabled by default thereafter.
| + | |
− | <!--T:300-->
| + | |
− | It can take a second argument of ''noerror'' or ''noreplace'' to suppress error messages when multiple displaytitles are used on one page or to make this <tt>displaytitle</tt> do nothing if a <tt>displaytitle</tt> was already specified earlier in the page.
| + | |
− | | {{ {{TNTN|MW version}} |version=1.7|compact=y|comment=and after}}<br/>{{ {{TNTN|MW version}} |version=1.24|compact=y|comment=and after|gerrit change=144870}} <br /> (<!--T:299-->
| + | |
− | for noerror and noreplace)
| + | |
− | |-
| + | |
− | | {{anchor|Defaultsort}} <code><nowiki>{{DEFAULTSORT:</nowiki><!--T:263-->
| + | |
− | ''sortkey''<tvar|code1><nowiki>}}</nowiki></code> <br /><code><nowiki>{{DEFAULTSORTKEY:</nowiki></>''sortkey''<tvar|code2><nowiki>}}</nowiki></code> <br /><code><nowiki>{{DEFAULTCATEGORYSORT:</nowiki></>''sortkey''<tvar|code3><nowiki>}}</nowiki></code> <br/><code><nowiki>{{DEFAULTSORT:</nowiki></>''sortkey''<tvar|code4><nowiki>|noerror}}</nowiki></code> <br/><code><nowiki>{{DEFAULTSORT:</nowiki></>''sortkey''<nowiki>|noreplace}}</nowiki></code>
| + | |
− | |
| + | |
− | | <!--T:94-->
| + | |
− | Used for categorizing pages, sets a default [[<tvar|help-categories>Special:MyLanguage/Help:Categories</>|category sort key]]. For example if you put <tvar|sort><code><nowiki>{{DEFAULTSORT:</>Smith , John<tvar|sort-end>}}</nowiki></code></> at the end of [[John Smith]], the page would be sorted under "S" by default in categories. It can take a second argument of ''noerror'' or ''noreplace'' to suppress error messages when multiple defaultsortkeys are used on one page or to make this <tvar|sort2><tt>defaultsort</tt></> do nothing if a <tvar|sort3><tt>defaultsort</tt></> was already specified earlier in the page.
| + | |
− | | {{ {{TNTN|MW version}} |version=1.10|compact=y|comment=and after}}<br/>{{ {{TNTN|MW version}} |version=1.19|compact=y|comment=and after|r=96767}} <br /> (<!--T:95-->
| + | |
− | for noerror and noreplace)
| + | |
| |} | | |} |
| | | |
− | | + | ===Other variables by type=== |
− | | + | |
− | === Statistics === <!--T:96--> | + | |
− | | + | |
− | <!--T:97-->
| + | |
− | Numbers returned by these variables normally contain separators (commas, dots or spaces, depending on the local language), but can return raw numbers with the ":R" flag (for example, <tvar|nop-code><code><nowiki>{{NUMBEROFPAGES}}</nowiki></code></> → <tvar|nop-result>{{NUMBEROFPAGES}}</> and <tvar|nop-r-code><code><nowiki>{{NUMBEROFPAGES:R}}</nowiki></code></> → <tvar|nop-r-result>{{NUMBEROFPAGES:R}}</>).
| + | |
− | | + | |
− | <!--T:98-->
| + | |
− | Use "|R" for magic words that require a parameter like PAGESINCATEGORY (for example <tvar|pic><code><nowiki>{{PAGESINCATEGORY:Help}}</nowiki></code></> and <tvar|pic-r><code><nowiki>{{PAGESINCATEGORY:Help|R}}</nowiki></code></>, or <tvar|pic-subcats><code><nowiki>{{PAGESINCATEGORY:Help|subcats}}</nowiki></code></> and <tvar|pic-subcats-r><code><nowiki>{{PAGESINCATEGORY:Help|subcats|R}}</nowiki></code></>). Also applicable to <tvar|pagesize><code><nowiki>{{PAGESIZE:</nowiki></>''page name''<tvar|pagesize-end><nowiki>}}</nowiki></code></> hereinbefore.
| + | |
− | | + | |
− | <!--T:99-->
| + | |
− | The number magic words are formatted in the wiki content language. Since {{r|94680|1.19}}, it depends on the [[<tvar|manual-pagelang>Special:MyLanguage/Manual:Language#page-content-lang</>|page content language]].
| + | |
− | | + | |
| {| class="wikitable" | | {| class="wikitable" |
− | |-
| + | ! Date and time |
− | ! width="10%" | <!--T:100--> | + | ! Revision data |
− | Variable
| + | ! Statistics |
− | ! width="10%" | <!--T:101--> | + | |- style="vertical-align:top" |
− | Output
| + | |
− | ! <!--T:102--> | + | |
− | Description
| + | |
− | ! width="10%" | <!--T:103-->
| + | |
− | Versions
| + | |
− | |-
| + | |
− | | <code><nowiki>{{NUMBEROFPAGES}}</nowiki></code>
| + | |
− | | {{NUMBEROFPAGES}}
| + | |
− | | {{Anchor|NUMBEROFPAGES}}<!--T:104-->
| + | |
− | Number of wiki pages.
| + | |
− | | {{ {{TNTN|MW version}} |version=1.7|compact=y|comment=and after}}
| + | |
− | |-
| + | |
− | | <code><nowiki>{{NUMBEROFARTICLES}}</nowiki></code>
| + | |
− | | {{NUMBEROFARTICLES}}
| + | |
− | | {{Anchor|NUMBEROFARTICLES}}<!--T:105-->
| + | |
− | Number of pages in {{mediawiki|<tvar|manual-content-ns>Special:MyLanguage/Manual:Using custom namespaces#content-ns</>|content namespaces}}.
| + | |
| | | | | |
− | |-
| + | {| |
− | | <code><nowiki>{{NUMBEROFFILES}}</nowiki></code>
| + | | ''Universal time'' |
− | | {{NUMBEROFFILES}} | + | * {{wikivar|CURRENTYEAR}} |
− | | {{Anchor|NUMBEROFFILES}}<!--T:106--> | + | * {{wikivar|CURRENTMONTH}} |
− | Number of uploaded files.
| + | * {{wikivar|CURRENTMONTHNAME}} |
− | | {{ {{TNTN|MW version}} |version=1.5|compact=y|comment=and after}}
| + | * {{wikivar|CURRENTMONTHABBREV}} |
− | |-
| + | * {{wikivar|CURRENTDAY}} |
− | | <code><nowiki>{{NUMBEROFEDITS}}</nowiki></code>
| + | * {{wikivar|CURRENTDAY2}} |
− | | {{NUMBEROFEDITS}} | + | * {{wikivar|CURRENTDOW}} |
− | | {{Anchor|NUMBEROFEDITS}}<!--T:107-->
| + | * {{wikivar|CURRENTDAYNAME}} |
− | Number of wiki edits.
| + | * {{wikivar|CURRENTTIME}} |
− | | {{ {{TNTN|MW version}} |version=1.10|compact=y|comment=and after|r=21319}}
| + | * {{wikivar|CURRENTHOUR}} |
− | |-
| + | * {{wikivar|CURRENTWEEK}} |
− | | <code><nowiki>{{NUMBEROFVIEWS}}</nowiki></code>
| + | * {{wikivar|CURRENTTIMESTAMP}} |
− | |
| + | | ''Local website time'' |
− | | {{Anchor|NUMBEROFVIEWS}}<!--T:108-->
| + | * {{wikivar|LOCALYEAR}} |
− | Number of page views. Usually useless on a wiki using [[<tvar|manual-cache>Special:MyLanguage/Manual:Cache</>|caching]]. <!--T:303-->
| + | * {{wikivar|LOCALMONTH}} |
− | Removed in <tvar|gerrit>{{gerrit|150699}}</>.
| + | * {{wikivar|LOCALMONTHNAME}} |
− | | {{ {{TNTN|MW version}} |version=1.14|compact=y|version2=1.24|r=42721}}
| + | * {{wikivar|LOCALMONTHABBREV}} |
− | |-
| + | * {{wikivar|LOCALDAY}} |
− | | <code><nowiki>{{NUMBEROFUSERS}}</nowiki></code>
| + | * {{wikivar|LOCALDAY2}} |
− | | {{NUMBEROFUSERS}} | + | * {{wikivar|LOCALDOW}} |
− | | {{Anchor|NUMBEROFUSERS}}<!--T:109-->
| + | * {{wikivar|LOCALDAYNAME}} |
− | Number of registered users.
| + | * {{wikivar|LOCALTIME}} |
− | | {{ {{TNTN|MW version}} |version=1.7|compact=y|comment=and after}}
| + | * {{wikivar|LOCALHOUR}} |
− | |-
| + | * {{wikivar|LOCALWEEK}} |
− | | <code><nowiki>{{NUMBEROFADMINS}}</nowiki></code>
| + | * {{wikivar|LOCALTIMESTAMP}} |
− | | {{NUMBEROFADMINS}} | + | |
− | | {{Anchor|NUMBEROFADMINS}}<!--T:110-->
| + | |
− | Number of users in the ''sysop'' {{mediawiki|<tvar|manual-userrights>Special:MyLanguage/Manual:User rights</>|group}}.
| + | |
− | | {{ {{TNTN|MW version}} |version=1.7|compact=y|comment=and after}}
| + | |
− | |-
| + | |
− | | <code><nowiki>{{NUMBEROFACTIVEUSERS}}</nowiki></code>
| + | |
− | | {{NUMBEROFACTIVEUSERS}}
| + | |
− | | {{Anchor|NUMBEROFACTIVEUSERS}}<!--T:111-->
| + | |
− | Number of active users, based on the criteria used in [[Special:Statistics]].
| + | |
− | | {{ {{TNTN|MW version}} |version=1.15|compact=y|comment=and after|r=47392}}
| + | |
− | |- style="background:#FED;"
| + | |
− | | {{Anchor|PAGESINCATEGORY|PAGESINCAT}}<code><nowiki>{{PAGESINCATEGORY:</nowiki>''categoryname''<nowiki>}}</nowiki></code> <br /><code><nowiki>{{PAGESINCAT:</nowiki>''categoryname''<nowiki>}}</nowiki></code>
| + | |
− | | {{PAGESINCATEGORY:Help}} <br />{{PAGESINCAT:Help}}
| + | |
− | | <!--T:112--> | + | |
− | '''[Expensive]''' Number of pages (including subcategories and files) in the given [[<tvar|help-categories>Special:MyLanguage/Help:Categories</>|category]]. <small>([[:Category:Help]] used for demonstration)</small>
| + | |
− | | {{ {{TNTN|MW version}} |version=1.13|compact=y|comment=and after|r=32932}}
| + | |
− | |- style="background:#FED;"
| + | |
− | | <code><nowiki>{{PAGESINCATEGORY:</nowiki><!--T:264-->
| + | |
− | ''categoryname''<tvar|code1><nowiki>|all}}</nowiki></code> <br /><code><nowiki>{{PAGESINCATEGORY:</nowiki></>''categoryname''<tvar|code2><nowiki>|pages}}</nowiki></code> <br /><code><nowiki>{{PAGESINCATEGORY:</nowiki></>''categoryname''<tvar|code3><nowiki>|subcats}}</nowiki></code> <br /><code><nowiki>{{PAGESINCATEGORY:</nowiki></>''categoryname''<nowiki>|files}}</nowiki></code>
| + | |
− | | {{PAGESINCATEGORY:Help|all}} <br />{{PAGESINCATEGORY:Help|pages}} <br />{{PAGESINCATEGORY:Help|subcats}} <br />{{PAGESINCATEGORY:Help|files}}
| + | |
− | | <!--T:113-->
| + | |
− | '''[Expensive]''' Respectively, the number of
| + | |
− | * all pages | + | |
− | * ordinary pages (excluding subcategories and files)
| + | |
− | * subcategories or
| + | |
− | * files
| + | |
− | in the given [[<tvar|help-categories>Special:MyLanguage/Help:Categories</>|category]]. <small>([[:Category:Help]] used for demonstration)</small>
| + | |
− | | {{ {{TNTN|MW version}} |version=1.20|compact=y|comment=and after|gerrit change=12790}}
| + | |
− | |-
| + | |
− | | <code><nowiki>{{NUMBERINGROUP:</nowiki><!--T:265-->
| + | |
− | ''groupname''<tvar|code1><nowiki>}}</nowiki></code> <br /><code><nowiki>{{NUMINGROUP:</nowiki></>''groupname''<nowiki>}}</nowiki></code>
| + | |
− | | {{Anchor|NUMBERINGROUP|NUMINGROUP}}{{NUMBERINGROUP:bureaucrat}} <br />{{NUMINGROUP:bureaucrat}} <br /><small><nowiki>({{NUMBERINGROUP:bureaucrat}} used here)</nowiki></small>
| + | |
− | | <!--T:114-->
| + | |
− | Number of users in a specific {{mediawiki|<tvar|manual-userrights>Special:MyLanguage/Manual:User rights</>|group}}.
| + | |
− | | {{ {{TNTN|MW version}} |version=1.14|compact=y|comment=and after|r=40116}}
| + | |
− | |- style="background:#FED;"
| + | |
− | | <code><nowiki>{{PAGESINNS:</nowiki><!--T:266-->
| + | |
− | ''index''<tvar|code1><nowiki>}}</nowiki></code> <br /><code><nowiki>{{PAGESINNAMESPACE:</nowiki></>''index''<nowiki>}}</nowiki></code>
| + | |
− | | <!--T:115-->
| + | |
− | ''Not enabled''
| + | |
− | | {{Anchor|PAGESINNS|PAGESINNAMESPACE}}<!--T:116-->
| + | |
− | '''[Expensive]''' Number of pages in the given [[<tvar|help-ns>Special:MyLanguage/Help:Namespaces</>|namespace]] (replace ''index'' with the relevant [[<tvar|manual-ns>Special:MyLanguage/Manual:Namespace</>|namespace index]]). For instance, <tvar|pins14><code><nowiki>{{PAGESINNAMESPACE:</nowiki>''14''<nowiki>}}</nowiki></code></> will output the number of category pages. <tvar|pins0><code><nowiki>{{PAGESINNS:0}}</nowiki></code></> differs from <tvar|noa><code><nowiki>{{NUMBEROFARTICLES}}</nowiki></code></> in that the former includes redirects and disambiguation pages. Disabled by default, enable with <tvar|manual-wg-allow-slow-parser-funct>{{mediawiki|Special:MyLanguage/Manual:$wgAllowSlowParserFunctions|$wgAllowSlowParserFunctions}}</>.
| + | |
− | | {{ {{TNTN|MW version}} |version=1.7|compact=y|comment=and after}}
| + | |
| |} | | |} |
− |
| |
− | {{Anchor|Page-names|Page names}}
| |
− |
| |
− | === Page names === <!--T:117-->
| |
− |
| |
− |
| |
− | {| class="wikitable"
| |
− | |-
| |
− | ! width="10%" | <!--T:118-->
| |
− | Variable
| |
− | ! width="10%" | <!--T:119-->
| |
− | Output
| |
− | ! <!--T:120-->
| |
− | Description
| |
− | ! width="10%" | <!--T:121-->
| |
− | Versions
| |
− | |-
| |
− | | {{Anchor|FULLPAGENAME|fullpagename}}<code><nowiki>{{FULLPAGENAME}}</nowiki></code>
| |
− | | {{FULLPAGENAME}}
| |
− | | <!--T:122-->
| |
− | Namespace and full page title (including all subpage levels).
| |
− | | {{ {{TNTN|MW version}} |version=1.6|compact=y|comment=and after}}
| |
− | |-
| |
− | | {{Anchor|PAGENAME|pagename}}<code><nowiki>{{PAGENAME}}</nowiki></code>
| |
− | | {{PAGENAME}}
| |
− | | <!--T:123-->
| |
− | Full page title (including all subpage levels) without the namespace.
| |
| | | | | |
− | |-
| + | * {{wikivar|REVISIONID}}<sup>a</sup> |
− | | <code><nowiki>{{BASEPAGENAME}}</nowiki></code>
| + | * {{wikivar|REVISIONDAY}} |
− | | {{BASEPAGENAME}}
| + | * {{wikivar|REVISIONDAY2}} |
− | | {{Anchor|BASEPAGENAME|basepagename}}<!--T:124-->
| + | * {{wikivar|REVISIONMONTH}} |
− | Page title of the page in the immediately superior [[<tvar|help-subpages>Special:MyLanguage/Help:Subpages</>|subpage]] level without the namespace ("Title/foo" on "Help:Title/foo/bar").
| + | * {{wikivar|REVISIONYEAR}} |
− | | + | * {{wikivar|REVISIONTIMESTAMP}} |
− | <!--T:260-->
| + | * {{wikivar|REVISIONUSER}} |
− | For more complex splitting, use <tvar|help-ext-pf-titleparts><code><nowiki>{{</nowiki>[[Special:MyLanguage/Help:Extension:ParserFunctions#.23titleparts|#titleparts:]]<nowiki>}}</nowiki></code></> from the [[<tvar|help-ext-pf>Special:MyLanguage/Help:Extension:ParserFunctions</>|ParserFunctions extension]].
| + | | |
− | | {{ {{TNTN|MW version}} |version=1.7|compact=y|comment=and after}}
| + | * {{wikivar|NUMBEROFPAGES}} |
− | |-
| + | * {{wikivar|NUMBEROFARTICLES}} |
− | | {{Anchor|SUBPAGENAME|subpagename}}<code><nowiki>{{SUBPAGENAME}}</nowiki></code>
| + | * {{wikivar|NUMBEROFFILES}} |
− | | {{SUBPAGENAME}} | + | * {{wikivar|NUMBEROFEDITS}} |
− | | <!--T:125--> | + | * {{wikivar|NUMBEROFVIEWS}} |
− | The [[<tvar|help-subpages>Special:MyLanguage/Help:Subpages</>|subpage]] title ("bar" on "Help:Title/foo/bar").
| + | * {{wikivar|NUMBEROFUSERS}} |
− | | {{ {{TNTN|MW version}} |version=1.6|compact=y|comment=and after}}
| + | * {{wikivar|NUMBEROFADMINS}} |
− | |-
| + | * {{wikivar|NUMBEROFACTIVEUSERS}} |
− | | {{Anchor|SUBJECTPAGENAME|ARTICLEPAGENAME|subjectpagename|articlepagename}}<code><nowiki>{{SUBJECTPAGENAME}}</nowiki></code> <br/><code><nowiki>{{ARTICLEPAGENAME}}</nowiki></code>
| + | |
− | | {{SUBJECTPAGENAME}}<br/>{{ARTICLEPAGENAME}} | + | |
− | | <!--T:126-->
| + | |
− | Full page name of the associated subject (e.g. article or file). Useful on talk pages.
| + | |
− | | {{ {{TNTN|MW version}} |version=1.7|compact=y|comment=and after}}
| + | |
− | |-
| + | |
− | | {{Anchor|TALKPAGENAME|talkpagename}}<code><nowiki>{{TALKPAGENAME}}</nowiki></code>
| + | |
− | | {{TALKPAGENAME}}
| + | |
− | | <!--T:127--> | + | |
− | Full page name of the associated talk page.
| + | |
− | | {{ {{TNTN|MW version}} |version=1.7|compact=y|comment=and after}}
| + | |
− | |-
| + | |
− | | {{Anchor|ROOTPAGENAME|rootpagename}}<code><nowiki>{{ROOTPAGENAME}}</nowiki></code>
| + | |
− | | {{ROOTPAGENAME}}
| + | |
− | | <!--T:301-->
| + | |
− | Name of the root of the current page. <!--T:302-->
| + | |
− | Would return <tvar|foo><code>Title</code></> on page <tvar|baz><code>Help:Title/Foo/Bar</code></>
| + | |
− | | {{ {{TNTN|MW version}} |version=1.22|compact=y|comment=and after}}
| + | |
| |} | | |} |
| + | <sup>a</sup> {{wikivar|REVISIONID}} cannot be [[help:Substitution|substituted]] and does not function in preview. |
| | | |
− | <!--T:128-->
| + | == Parser functions == |
− | The <tvar|basepagename><code><nowiki>{{BASEPAGENAME}}</nowiki></code></> and <tvar|subpagename><code><nowiki>{{SUBPAGENAME}}</nowiki></code></> magic words only work in namespaces that have subpages enabled. See <tvar|manual-wg-ns-with-subpages>{{mediawiki|Special:MyLanguage/Manual:$wgNamespacesWithSubpages|$wgNamespacesWithSubpages}}</> for information on enabling subpages.
| + | : ''For documentation, see the [[mw:Help:Magic words|MediaWiki magic words page]] or the [[mw:Help:Extension:ParserFunctions|ParserFunctions Extension page]], unless otherwise stated. |
− | | + | |
− | <!--T:129-->
| + | |
− | As of {{mediawiki|rev:46662|1.15+}}, these can all take a parameter, allowing specification of the page to be operated on, instead of just the current page:
| + | |
− | * <tvar|code><code><nowiki>{{PAGENAME:Template:Main Page}}</nowiki></code></> → '''<tvar|result>{{PAGENAME:Template:Main Page}}</>'''
| + | |
− | | + | |
− | <!--T:130-->
| + | |
− | {{Warning|Page titles containing certain characters, such as apostrophes <code>'</code> or asterisks <code>*</code>, may produce unexpected results when handled with these magic words, e.g. <tvar|pic><code><nowiki>{{PAGESINCATEGORY:{{PAGENAME}}}}</nowiki></code></>. See bugs {{mediawiki|phabricator:T16779|T16779}}, {{mediawiki|phabricator:T18474|T18474}}, {{mediawiki|phabricator:T37628|T37628}}, and {{mediawiki|phabricator:T37746|T37746}}. One simple way to fix this is wrapping the pagename in #titleparts (parser function).}}
| + | |
− | | + | |
− | <!--T:131-->
| + | |
− | For example, if page name is "<tvar|pagename>L'Aquila</>", the following code will produce the string "<tvar|result>Numeric char encoding</>": | + | |
− | | + | |
− | <pre><nowiki>{{#switch:{{PAGENAME}}
| + | |
− | | L'Aquila = No translation | + | |
− | | L = Not OK
| + | |
− | | L&apos;Aquila = Entity escaping
| + | |
− | | L&#39;Aquila = Numeric char encoding
| + | |
− | }}</nowiki></pre>
| + | |
− | | + | |
− | | + | |
− | ==== URL encoded page names ==== <!--T:133-->
| + | |
− | | + | |
− | <!--T:134-->
| + | |
− | The following are equivalents encoded for use in MediaWiki URLs (i.e. spaces replaced with underscores and some characters [[wikipedia:Numeric character reference|HTML escaped using numeric character encoding]]):
| + | |
− | | + | |
− | * <code><nowiki>{{FULLPAGENAMEE}}</nowiki>
| + | |
− | * <nowiki>{{PAGENAMEE}}</nowiki>
| + | |
− | * <nowiki>{{BASEPAGENAMEE}}</nowiki>
| + | |
− | * <nowiki>{{SUBPAGENAMEE}}</nowiki>
| + | |
− | * <nowiki>{{SUBJECTPAGENAMEE}}</nowiki>
| + | |
− | * <nowiki>{{ARTICLEPAGENAMEE}}</nowiki>
| + | |
− | * <nowiki>{{TALKPAGENAMEE}}</nowiki>
| + | |
− | * <nowiki>{{ROOTPAGENAMEE}}</nowiki></code>
| + | |
− | | + | |
− | <!--T:135-->
| + | |
− | Note that <tvar|pagename><code><nowiki>{{PAGENAME:...}}</nowiki></code></>, <tvar|pagenamee><code><nowiki>{{PAGENAMEE:...}}</nowiki></code></> and <tvar|uec><code><nowiki>{{urlencode:...}}</nowiki></code></> have distinct implementations. See [[<tvar|manual-pagename-encoding>Special:MyLanguage/Manual:PAGENAMEE encoding</>|Manual:PAGENAMEE encoding]] for details.
| + | |
− | | + | |
− | | + | |
− | {{anchor|Namespaces}}
| + | |
− | | + | |
− | | + | |
− | === Namespaces === <!--T:136-->
| + | |
− | | + | |
| | | |
| + | ===Metadata=== |
| {| class="wikitable" | | {| class="wikitable" |
| + | ! Code |
| + | ! Notes |
| |- | | |- |
− | ! <!--T:137-->
| + | | {{wikivar|PAGEID}} |
− | Variable
| + | | Unique page identifier number. |
− | ! <!--T:138-->
| + | |
− | Output
| + | |
− | ! <!--T:139-->
| + | |
− | Description
| + | |
− | ! <!--T:140-->
| + | |
− | Versions
| + | |
| |- | | |- |
− | | <code><nowiki>{{NAMESPACE}}</nowiki></code> | + | | {{wikivar|PAGESIZE|''pagename''}} |
− | | {{NAMESPACE}} | + | | Size of page named ''pagename'' in bytes. |
− | | <!--T:141--> | + | |
− | Name of the page's namespace
| + | |
− | |
| + | |
| |- | | |- |
− | | <code><nowiki>{{NAMESPACENUMBER}}</nowiki></code> | + | | {{wikivar|PROTECTIONLEVEL|''action''{{pipe}}''pagename''}} |
− | | {{NAMESPACENUMBER}} | + | | [[gunsopedia:Protection policy|Protection level]] assigned to ''action'' ("edit", "move", etc) on page named ''pagename''. |
− | | <!--T:142--> | + | |
− | [[<tvar|manual-ns-id>Special:MyLanguage/Manual:Namespace#Built-in_namespaces</>|ID]] of the page's namespace | + | |
− | | {{ {{TNTN|MW version}} |version=1.20|compact=y|comment=and after|gerrit change=4056}}
| + | |
| |- | | |- |
− | | <code><nowiki>{{SUBJECTSPACE}}</nowiki></code> <br /><code><nowiki>{{ARTICLESPACE}}</nowiki></code> | + | | {{wikivar|PENDINGCHANGELEVEL}} |
− | | {{SUBJECTSPACE}} <br />{{ARTICLESPACE}} | + | | Protection level for [[gunsopedia:Pending changes|pending changes]] on the current page. |
− | | <!--T:143--> | + | |
− | Name of the associated content namespace
| + | |
− | | {{ {{TNTN|MW version}} |version=1.7|compact=y|comment=and after}}
| + | |
| |- | | |- |
− | | <code><nowiki>{{TALKSPACE}}</nowiki></code> | + | | {{wikivar|PAGESINCATEGORY|''categoryname''}} |
− | | {{TALKSPACE}} | + | | Number of pages in the category named ''categoryname''. |
− | | <!--T:144--> | + | |
− | Name of the associated talk namespace
| + | |
− | | {{ {{TNTN|MW version}} |version=1.7|compact=y|comment=and after}}
| + | |
− | |}
| + | |
− | | + | |
− | <!--T:145-->
| + | |
− | The following are equivalents encoded for use in MediaWiki URLs (spaces replaced with underscores and some characters percent-encoded):
| + | |
− | | + | |
− | * <code><nowiki>{{NAMESPACEE}}</nowiki></code>
| + | |
− | * <code><nowiki>{{SUBJECTSPACEE}}</nowiki></code>
| + | |
− | * <code><nowiki>{{ARTICLESPACEE}}</nowiki></code>
| + | |
− | * <code><nowiki>{{TALKSPACEE}}</nowiki></code>
| + | |
− | | + | |
− | <!--T:146-->
| + | |
− | As of {{mediawiki|rev:46630|1.15+}}, these can take a full-page-name parameter and will return the requested namespace associated with that page, instead of with the current page:
| + | |
− | | + | |
− | * <code><nowiki>{{NAMESPACE:Template:Main Page}}</nowiki></code> → '''{{NAMESPACE:Template:Main Page}}'''
| + | |
− | * <code><nowiki>{{SUBJECTSPACE:Template:Main Page}}</nowiki></code> → '''{{SUBJECTSPACE:Template:Main Page}}'''
| + | |
− | * <code><nowiki>{{TALKSPACE:Template:Main Page}}</nowiki></code> → '''{{TALKSPACE:Template:Main Page}}'''
| + | |
− | <!--T:147-->
| + | |
− | Parameter must not be a namespace name:
| + | |
− | * <code><nowiki>{{SUBJECTSPACE:Help talk}}</nowiki></code> → '''{{SUBJECTSPACE:Help talk}}<!-- empty --> ''' (''Empty'')
| + | |
− | | + | |
− | | + | |
− | === Other === <!--T:293-->
| + | |
− | | + | |
− | {| class="wikitable"
| + | |
| |- | | |- |
− | ! <!--T:294-->
| + | | {{wikivar|NUMBERINGROUP|''groupname''}} |
− | Variable
| + | | Number of users in the [[Help:User rights|usergroup]] named ''groupname''. |
− | ! <!--T:295-->
| + | |
− | Output
| + | |
− | ! <!--T:296-->
| + | |
− | Description
| + | |
− | ! <!--T:297-->
| + | |
− | Versions
| + | |
− | |-
| + | |
− | | <code><nowiki>{{!}}</nowiki></code> | + | |
− | |style="text-align:center;"| <nowiki>|</nowiki> | + | |
− | | {{Anchor|PIPE|Pipe|pipe|.7C|.7c}}<!--T:298-->
| + | |
− | Used to include a pipe character as part of a template argument or table cell contents. Before this was added as a magic word, many wikis implemented this by creating [[Template:!]] with <code><nowiki>|</nowiki></code> as the content.
| + | |
− | | {{ {{TNTN|MW version}} |version=1.24|compact=y|comment=and after|gerrit change=136234}}
| + | |
| |} | | |} |
| + | To output numbers without comma separators (for example, as "123456789" rather than "123,456,789"), append the parameter <code>|R</code>. |
| | | |
− | {{anchor|Parser functions}}
| + | ===Formatting=== |
− | | + | |
− | == Parser functions == <!--T:148--> | + | |
− | | + | |
− | <!--T:149-->
| + | |
− | Parser functions are very similar to variables, but take one or more parameters (technically, any magic word that takes a parameter is a parser function), and the name is sometimes prefixed with a hash to distinguish them from templates.
| + | |
− | | + | |
− | <!--T:150-->
| + | |
− | This page only describes parser functions that are integral to the MediaWiki software. Other parser functions may be added by MediaWiki extensions such as the <tvar|ext-pf>{{ll|Extension:ParserFunctions}}</>. For those see <tvar|help-ext-pf>{{ll|Help:Extension:ParserFunctions}}</>.
| + | |
− | | + | |
− | | + | |
− | === URL data === <!--T:169--> | + | |
− | | + | |
− | | + | |
| {| class="wikitable" | | {| class="wikitable" |
| + | ! Code |
| + | ! Notes |
| |- | | |- |
− | ! <!--T:170-->
| + | | <code> {{((}}lc:''string''{{))}} </code> |
− | Parser function
| + | | Converts all characters in ''string'' to lower case. |
− | ! <!--T:171-->
| + | |
− | Input → Output
| + | |
− | ! <!--T:172-->
| + | |
− | Description
| + | |
− | ! <!--T:173-->
| + | |
− | Versions
| + | |
| |- | | |- |
− | | colspan="4"| {{Anchor|localurl|LOCALURL}} | + | | <code> {{((}}lcfirst:''string''{{))}} </code> |
| + | | Converts first character of ''string'' to lower case. |
| |- | | |- |
− | | <code><nowiki>{{localurl:</nowiki><!--T:279--> | + | | <code> {{((}}uc:''string''{{))}} </code> |
− | ''page name''<tvar|code1><nowiki>}}</nowiki></code> <br /><code><nowiki>{{localurl:</nowiki></>''page name''<br /><tvar|code2><nowiki>|</nowiki></>''query_string''<nowiki>}}</nowiki></code>
| + | | Converts all characters in ''string'' to upper case. |
− | | <code><nowiki>{{localurl:MediaWiki}}</nowiki></code><br />→ {{localurl:MediaWiki}} <br /><code><nowiki>{{localurl:MediaWiki|printable=yes}}</nowiki></code><br />→ {{localurl:MediaWiki|printable=yes}}
| + | |
− | | <!--T:174--> | + | |
− | The relative path to the title.
| + | |
− | |
| + | |
| |- | | |- |
− | | colspan="4"| {{Anchor|fullurl|FULLURL}} | + | | <code> {{((}}ucfirst:''string''{{))}} </code> |
| + | | Converts first character of ''string'' to upper case. |
| |- | | |- |
− | | <code><nowiki>{{fullurl:</nowiki><!--T:280--> | + | | <code> {{((}}formatnum:''unformatted_number''{{))}} </code> |
− | ''page name''<tvar|code1><nowiki>}}</nowiki></code> <br /><code><nowiki>{{fullurl:</nowiki></>''page name''<tvar|code2><br /><nowiki>|</nowiki></>''query_string''<tvar|code3><nowiki>}}</nowiki></code> <br /><code><nowiki>{{fullurl:</nowiki></>''interwiki:remote page name''<tvar|code4><br /><nowiki>|</nowiki></>''query_string''<nowiki>}}</nowiki></code> | + | | Adds comma separators to an ''unformatted_number'' (e.g. 123456789 becomes {{formatnum:123456789}}). To remove such formatting, use <code>{{((}}formatnum:''formatted_number''{{pipe}}R{{))}}</code> (i.e. <code>{{braces|formatnum:7,654,321{{pipe}}R}}</code>, for example, produces {{formatnum:7,654,321|R}}). |
− | | <code><nowiki>{{fullurl:Category:Top level}}</nowiki></code><br />→ {{fullurl:Category:Top level}} <br />
| + | |
− | <code><nowiki>{{fullurl:Category:Top level|action=edit}}</nowiki></code><br />→ {{fullurl:Category:Top level|action=edit}}<br />
| + | |
− | <code><nowiki>https:{{fullurl:s:Electra|action=edit}}</nowiki></code><br />→ https:{{fullurl:s:Electra|action=edit}}<br /> | + | |
− | <code><nowiki>https:{{fullurl:s:es:Electra|action=edit}}</nowiki></code><br />→ https:{{fullurl:s:es:Electra|action=edit}}
| + | |
− | | <!--T:175-->
| + | |
− | A protocol-relative path to the title. This will also resolve [[<tvar|manual-interwiki>Special:MyLanguage/Manual:Interwiki</>|interwiki]] prefixes. '''Note:''' Unbracketed (plain) protocol-relative links are not automagically linked.
| + | |
− | | {{ {{TNTN|MW version}} |version=1.5|compact=y|comment=and after}}
| + | |
| |- | | |- |
− | | colspan="4"| {{Anchor|canonicalurl|CANONICALURL}} | + | | <code> {{((}}#formatdate:''date''{{pipe}}''format''{{))}} </code> |
| + | | Formats a date according to user preferences; a default can be given as an optional case-sensitive second parameter for users without date preference; can convert a date from an existing format to any of <code>dmy</code>, <code>mdy</code>, <code>ymd</code> or <code>ISO 8601</code> formats, with the user's preference overriding the specified format. |
| |- | | |- |
− | | <code><nowiki>{{canonicalurl:</nowiki><!--T:281--> | + | | <code> {{((}}padleft:xyz{{pipe}}''stringlength''{{))}} </code><br/><code> {{((}}padright:xyz{{pipe}}''stringlength''{{))}} </code> |
− | ''page name''<tvar|code1><nowiki>}}</nowiki></code> <br /><code><nowiki>{{canonicalurl:</nowiki></>''page name''<tvar|code2><br /><nowiki>|</nowiki></>''query_string''<tvar|code3><nowiki>}}</nowiki></code> <br /><code><nowiki>{{canonicalurl:</nowiki></>''interwiki:remote page name''<tvar|code4><br /><nowiki>|</nowiki></>''query_string''<nowiki>}}</nowiki></code>
| + | | Pad with zeros to the right or left; an alternative padding string can be given as a third parameter; the alternative padding string may be truncated if its length does not evenly divide the required number of characters. |
− | | <code><nowiki>{{canonicalurl:Category:Top level}}</nowiki></code><br />→ {{canonicalurl:Category:Top level}} <br />
| + | |
− | <code><nowiki>{{canonicalurl:Category:Top level|action=edit}}</nowiki></code><br />→ {{canonicalurl:Category:Top level|action=edit}}
| + | |
− | | <!--T:176--> | + | |
− | The absolute path to the title, using the canonical URL. This will also resolve [[<tvar|manual-interwiki>Special:MyLanguage/Manual:Interwiki</>|interwiki]] prefixes.
| + | |
− | | {{ {{TNTN|MW version}} |version=1.18|compact=y|comment=and after}}
| + | |
| |- | | |- |
− | | colspan="4"| {{Anchor|filepath|FILEPATH}} | + | | <code> {{((}}plural:''N'' {{pipe}}''singular'' {{pipe}}''plural''{{))}} </code> |
| + | | Outputs ''singular'' if ''N'' is equal to 1, otherwise outputs ''plural''. See the [[mw:Help:Magic words#Localization|documentation at mediawiki.org]] for more details. |
| |- | | |- |
− | | <code><nowiki>{{filepath:</nowiki><!--T:282--> | + | | <code> {{((}}#time:''format''{{pipe}}''object''{{))}} </code><br/><code> {{braces|#timel:}} </code> (for local time) |
− | ''file name''<tvar|code1><nowiki>}}</nowiki></code> <br /><code><nowiki>{{filepath:</nowiki></>''file name''<tvar|code2><nowiki>|nowiki}}</nowiki></code> <br /><code><nowiki>{{filepath:</nowiki></>''file name''<tvar|code3><nowiki>|</nowiki></>''thumbnail_size''<nowiki>}}</nowiki></code> | + | | Used to format dates and times. <code>#timel</code> is based on local time as defined for the entire wiki; for the English Wikipedia, where local time is set to UTC, this is identical to <code>#time</code>. (See [[mw:Help:Extension:ParserFunctions##time]].) |
− | | <code><nowiki>{{filepath:Wiki.png}}</nowiki></code><br />→ {{filepath:Wiki.png}} <br /> | + | |
− | <code><nowiki>{{filepath:Wiki.png|nowiki}}</nowiki></code><br />→ {{filepath:Wiki.png|nowiki}} <br />
| + | |
− | <code><nowiki>{{filepath:Example.svg|300}}</nowiki></code><br />→ {{filepath:Example.svg|300}} <br />
| + | |
− | | <!--T:177-->
| + | |
− | A protocol-relative path to the full size or thumbnail ({{mediawiki|rev:80813|1.18+}}) of a media file.
| + | |
− | | {{ {{TNTN|MW version}} |version=1.12|compact=y|comment=and after|r=25854}} <br />{{ {{TNTN|MW version}} |version=1.18|compact=y|comment=and after|r=80813}}
| + | |
| |- | | |- |
− | | colspan="4"| {{Anchor|urlencode|URLENCODE}} | + | | <code> {{((}}gender:''user'' {{pipe}}''m_out'' {{pipe}}''f_out'' {{pipe}}''u_out''{{))}} </code> |
| + | | Outputs ''m_out'', ''f_out'' or ''u_out'' according to whether the gender specified in user's preferences is, respectively, male, female or unspecified. Other parameter permutations are available, see [[mw:Help:Magic words#gender]]. |
| |- | | |- |
− | | <code><nowiki>{{urlencode:</nowiki><!--T:283--> | + | | <code> {{((}}#tag:''tag''{{pipe}}''content'' {{pipe}}''p1''=''v1'' {{pipe}}''p2''=''v2''{{))}} </code> |
− | ''string''<tvar|code1><nowiki>}}</nowiki></code></> or <br /><tvar|code2><code><nowiki>{{urlencode:</nowiki></>''string''<tvar|code3><nowiki>|QUERY}}</nowiki></code></> <tvar|code4><br /><code><nowiki>{{urlencode:</nowiki></>''string''<tvar|code5><nowiki>|WIKI}}</nowiki></code> <br /><code><nowiki>{{urlencode:</nowiki></>''string''<nowiki>|PATH}}</nowiki></code> | + | | An equivalent to the HTML <code><''tag''>...</''tag''><code> that is useful when e.g. [[wikipedia:WP:REFNEST|nesting references]]. |
− | | <code><nowiki>{{urlencode:x:y/z á é}}</nowiki></code> or <br /><code><nowiki>{{urlencode:x:y/z á é|QUERY}}</nowiki></code><br />→ {{urlencode:x:y/z á é}} <br /><code><nowiki>{{urlencode:x:y/z á é|WIKI}}</nowiki></code><br />→ {{urlencode:x:y/z á é|WIKI}} <br /><code><nowiki>{{urlencode:x:y/z á é|PATH}}</nowiki></code><br />→ {{urlencode:x:y/z á é|PATH}}
| + | |
− | <!--T:178-->
| + | |
− | Note that the default changed from <tvar|wiki><code>|WIKI</code></> to <tvar|query><code>|QUERY</code></> in 1.17; this may break templates that rely on this function.
| + | |
− | | <!--T:179-->
| + | |
− | The input encoded for use in URLs. Note that there is no urldecode function like there is in the obsolete <tvar|ext-stringfunctions>{{ll|Extension:StringFunctions}}</>.<br /><table class="wikitable"><caption><!--T:305-->
| + | |
− | Encoding</caption><tr><th><!--T:306-->
| + | |
− | code</th><th><!--T:307--> | + | |
− | space</th></tr><tr><td> ''none''</td><td><samp> + </samp></td></tr><tr><td><kbd>QUERY</kbd></td><td><samp> + </samp></td></tr><tr><td><kbd> WIKI</kbd></td><td><samp> _ </samp></td></tr><tr><td><kbd> PATH</kbd></td><td><samp>%20</samp></td></tr></table>
| + | |
− | | {{ {{TNTN|MW version}} |version=1.7|compact=y|comment=and after|r=14273}} (or {{ {{TNTN|MW version}} |version=1.17|compact=y|comment=and after|r=64726}} <br />{{ {{TNTN|MW version}} |version=1.17|compact=y|comment=and after|r=64726}} <br />{{ {{TNTN|MW version}} |version=1.17|compact=y|comment=and after|r=64726}})
| + | |
− | |-
| + | |
− | | colspan="4"| {{Anchor|anchorencode|ANCHORENCODE}}
| + | |
− | |-
| + | |
− | | <code><nowiki>{{anchorencode:</nowiki><!--T:284-->
| + | |
− | ''string''<nowiki>}}</nowiki></code> | + | |
− | | <code><nowiki>{{anchorencode:x y z á é}}</nowiki></code><br />→ {{anchorencode:x y z á é}}
| + | |
− | | <!--T:180--> | + | |
− | The input encoded for use in URL section anchors (after the “#” symbol in a URL).
| + | |
− | | {{ {{TNTN|MW version}} |version=1.6|compact=y|comment=and after|r=16279}}
| + | |
| |} | | |} |
| | | |
− | {{anchor|Namespaces_2}}
| + | ===Paths=== |
− | | + | |
− | === Namespaces === <!--T:181--> | + | |
− | | + | |
− | <!--T:182-->
| + | |
− | <tvar|ns><code><nowiki>{{ns:}}</nowiki></code></> returns the current localized name for the [[<tvar|help-ns>Special:MyLanguage/Help:Namespace</>|namespace]] with that index, canonical name, or local alias. Thus <tvar|ns6><code><nowiki>{{ns:6}}</nowiki></code></>, <tvar|ns-file><code><nowiki>{{ns:File}}</nowiki></code></>, and <tvar|ns-img><code><nowiki>{{ns:Image}}</nowiki></code></> (an old name for the File namespace) all return "{{ns:6}}". On a wiki where the content language is French, <tvar|ns-file-de><code><nowiki>{{ns:Fichier}}</nowiki></code></> is also valid, but <tvar|ns-file-incorrect><code><nowiki>{{ns:Datei}}</nowiki></code></> (the localisation of "File" in German) is not.
| + | |
− | | + | |
− | <!--T:183-->
| + | |
− | <tvar|nse><code><nowiki>{{nse:}}</nowiki></code></> is the equivalent encoded for MediaWiki URLs. It does the same, but it replaces spaces with underscores, making it usable in external links.
| + | |
− | | + | |
| {| class="wikitable" | | {| class="wikitable" |
| + | ! Code |
| + | ! Notes |
| |- | | |- |
− | ! colspan="2" width="50%" | <!--T:258-->
| + | | <code> {{((}}localurl:''pagename'' {{pipe}}''query''{{))}} </code> |
− | Content namespaces
| + | | Relative [[Path (computing)|path]] to ''pagename''. The ''query'' parameter is optional. |
− | ! rowspan="11" |
| + | |
− | ! colspan="2" width=%50%" | <!--T:259-->
| + | |
− | Talk namespaces
| + | |
| |- | | |- |
− | ! <!--T:184-->
| + | | <code> {{((}}fullurl:''pagename'' {{pipe}}''query''{{))}} </code> |
− | Usage
| + | | Absolute path, without [[Application layer|protocol prefix]] (i.e. without "{{thinsp|<nowiki>http://</nowiki>}}" etc), to ''pagename''. The ''query'' parameter is optional. |
− | ! <!--T:185-->
| + | |
− | Output
| + | |
− | ! <!--T:186-->
| + | |
− | Usage
| + | |
− | ! <!--T:187-->
| + | |
− | Output
| + | |
| |- | | |- |
− | | <code><nowiki>{{ns:-2}}</nowiki></code> / <code><nowiki>{{ns:Media}}</nowiki></code> | + | | <code> {{((}}canonicalurl:''pagename'' {{pipe}}''query''{{))}} </code> |
− | | {{ns:-2}}
| + | | Absolute path, including protocol prefix, to ''pagename''. The ''query'' parameter is optional. |
− | | <code><nowiki>{{ns:-1}}</nowiki></code> / <code><nowiki>{{ns:Special}}</nowiki></code>
| + | |
− | | {{ns:-1}}<br/>''(no '''talk''' page)'' | + | |
| |- | | |- |
− | | <code><nowiki>{{ns:0}}</nowiki></code> / <code><nowiki>{{ns:}}</nowiki></code> | + | | <code> {{((}}filepath:''filename''{{))}} </code> |
− | | {{ns:0}}
| + | | Absolute path to the media file ''filename''. |
− | | <code><nowiki>{{ns:1}}</nowiki></code> / <code><nowiki>{{ns:Talk}}</nowiki></code>
| + | |
− | | {{ns:1}} | + | |
| |- | | |- |
− | | <code><nowiki>{{ns:2}}</nowiki></code> / <code><nowiki>{{ns:User}}</nowiki></code> | + | | <code> {{((}}urlencode:''string''{{))}} </code> |
− | | {{ns:2}}
| + | | Encodes ''string'' for use in URL query strings; <code>{{braces|urlencode:test string}}</code>, for example, produces: {{urlencode:test string}}. To encode ''string'' for use in URL paths or MediaWiki page names, append, respectively, {{para||PATH}} or {{para||WIKI}} (to produce "{{urlencode:test string|PATH}}" or "{{urlencode:test string|WIKI}}"). |
− | | <code><nowiki>{{ns:3}}</nowiki></code> / <code><nowiki>{{ns:User talk}}</nowiki></code> | + | |
− | | {{ns:3}}
| + | |
| |- | | |- |
− | | <code><nowiki>{{ns:4}}</nowiki></code> / <code><nowiki>{{ns:Project}}</nowiki></code> | + | | <code> {{((}}anchorencode:''string''{{))}} </code> |
− | | {{ns:4}} <br/>''Varies between wikis''
| + | | Input encoded for use in MediaWiki URL [[Help:Anchor|section anchor]]s. |
− | | <code><nowiki>{{ns:5}}</nowiki></code> / <code><nowiki>{{ns:Project talk}}</nowiki></code>
| + | |
− | | {{ns:5}} | + | |
| |- | | |- |
− | | <code><nowiki>{{ns:6}}</nowiki></code> / <code><nowiki>{{ns:File}}</nowiki></code> or <code><nowiki>{{ns:Image}}</nowiki></code> | + | | <code> {{((}}ns:''n''{{))}} </code> |
− | | {{ns:6}} | + | | Returns the name of the [[Help:Namespace|namespace]] whose index is the number ''n''. For MediaWiki URLs, use <code>{{((}}nse:{{))}}</code>. |
− | | <code><nowiki>{{ns:7}}</nowiki></code> / <code><nowiki>{{ns:File talk}}</nowiki></code> or <code><nowiki>{{ns:Image talk}}</nowiki></code> | + | |
− | | {{ns:7}}
| + | |
| |- | | |- |
− | | <code><nowiki>{{ns:8}}</nowiki></code> / <code><nowiki>{{ns:MediaWiki}}</nowiki></code> | + | | <code> {{((}}#rel2abs:''path''{{))}} </code> |
− | | {{ns:8}} | + | | Converts a relative file path to an absolute path. (See [[mw:Help:Extension:ParserFunctions##rel2abs]].) |
− | | <code><nowiki>{{ns:9}}</nowiki></code> / <code><nowiki>{{ns:MediaWiki talk}}</nowiki></code>
| + | |
− | | {{ns:9}}
| + | |
| |- | | |- |
− | | <code><nowiki>{{ns:10}}</nowiki></code> / <code><nowiki>{{ns:Template}}</nowiki></code> | + | | <code> {{((}}#titleparts:''pgname''{{pipe}}''num''{{pipe}}''first_seg''{{))}} </code> |
− | | {{ns:10}}
| + | | Splits the page ''pgname''{{thinsp}}'s title into a ''num''ber of ''seg''ments. (See [[mw:Help:Extension:ParserFunctions##titleparts]].) |
− | | <code><nowiki>{{ns:11}}</nowiki></code> / <code><nowiki>{{ns:Template talk}}</nowiki></code>
| + | |
− | | {{ns:11}} | + | |
− | |-
| + | |
− | | <code><nowiki>{{ns:12}}</nowiki></code> / <code><nowiki>{{ns:Help}}</nowiki></code>
| + | |
− | | {{ns:12}}
| + | |
− | | <code><nowiki>{{ns:13}}</nowiki></code> / <code><nowiki>{{ns:Help talk}}</nowiki></code>
| + | |
− | | {{ns:13}}
| + | |
− | |-
| + | |
− | | <code><nowiki>{{ns:14}}</nowiki></code> / <code><nowiki>{{ns:Category}}</nowiki></code>
| + | |
− | | {{ns:14}}
| + | |
− | | <code><nowiki>{{ns:15}}</nowiki></code> / <code><nowiki>{{ns:Category talk}}</nowiki></code>
| + | |
− | | {{ns:15}}
| + | |
| |} | | |} |
| | | |
− | <!--T:188-->
| + | ===Conditional=== |
− | Don't confuse localised namespaces with [[<tvar|manual-custom-ns>Special:MyLanguage/Manual:Using custom namespaces</>|custom namespaces]].
| + | : ''Some parameters are optional. For documentation, see [[mw:Help:Extension:ParserFunctions]]. For #switch specifically, see [[Wikipedia:Help:Switch parser function]]. |
− | | + | |
− | {{anchor|Formatting}}
| + | |
− | | + | |
− | === Formatting === <!--T:189-->
| + | |
− | | + | |
| | | |
| {| class="wikitable" | | {| class="wikitable" |
− | ! width="10%" | <!--T:190--> | + | ! Code |
− | Usage
| + | ! Notes |
− | ! width="40%" | <!--T:191--> | + | |
− | Input → Output
| + | |
− | ! <!--T:192-->
| + | |
− | Description
| + | |
− | ! width="10%" | <!--T:193-->
| + | |
− | Version
| + | |
| |- | | |- |
− | | <code><nowiki>{{formatnum:</nowiki>''unformatted number''<nowiki>}}</nowiki></code> <br /> | + | |<code> {{((}}#expr:''expression''{{))}} </code> |
− | <code><nowiki>{{formatnum:</nowiki>''formatnum-formatted number''<nowiki>|R}}</nowiki></code> <br />
| + | | Evaluates ''expression'' (see [https://meta.wikimedia.org/wiki/Help:Calculation m:Help:Calculation]). |
− | <code><nowiki>{{formatnum:</nowiki>''unformatted number''<nowiki>|NOSEP}}</nowiki></code>
| + | |
− | |
| + | |
− | * <!--T:194-->
| + | |
− | Simple:
| + | |
− | ** <code><nowiki>{{formatnum:987654321.654321}}</nowiki></code> <br/> → {{formatnum:987654321.654321}}
| + | |
− | ** <code><nowiki>{{formatnum:</nowiki>{{formatnum:987654321.654321}}<nowiki>|R}}</nowiki></code> <br/> → {{formatnum:{{formatnum:987654321.654321}}|R}}
| + | |
− | * <!--T:195-->
| + | |
− | Advanced:
| + | |
− | ** <code><nowiki>{{formatnum:{{formatnum:987654321.654321}}|R}}</nowiki></code> <br/> → {{formatnum:{{formatnum:987654321.654321}}|R}} <!--T:196-->
| + | |
− | (on any locale) | + | |
− | ** <code><nowiki>{{formatnum:00001}}</nowiki></code> <br/> → {{formatnum:00001}}
| + | |
− | ** <code><nowiki>{{formatnum:987654321.654321 |NOSEP}}</nowiki></code> <br/> → {{formatnum:987654321.654321 |NOSEP}}
| + | |
− | ** <!--T:197-->
| + | |
− | Examples with [[w:Bengali numerals|{{#language:bn|en}} locale]]:
| + | |
− | *** <code><nowiki>{{formatnum:987654321.654321}}</nowiki></code> <br/> → ৯৮,৭৬,৫৪,৩২১.৬৫৪৩২১
| + | |
− | *** <code><nowiki>{{formatnum:987654321.654321 |NOSEP}}</nowiki></code> <br/> → ৯৮৭৬৫৪৩২১.৬৫৪৩২১
| + | |
− | *** <code><nowiki>{{formatnum:৯৮,৭৬,৫৪,৩২১.৬৫৪৩২১ |R}}</nowiki></code> <br/> → 987654321.654321
| + | |
− | ----
| + | |
− | <!--T:198-->
| + | |
− | Unsupported: <br />
| + | |
− | <code><nowiki>{{formatnum:{{formatnum:987.654.321}}}}</nowiki></code> <br/> → 987 654 321 <!--T:199-->
| + | |
− | (e.g. with Italian locale)
| + | |
− | ----
| + | |
− | <!--T:200-->
| + | |
− | Examples of wrong input (unreliable output), with or without <code>|R</code>: <br />
| + | |
− | <code><nowiki>{{formatnum:987,654.321|R}}</nowiki></code> <!--T:201-->
| + | |
− | (the least broken) <br/>
| + | |
− | <code><nowiki>{{formatnum:987.654,321|R}}</nowiki></code> <br/>
| + | |
− | <code><nowiki>{{formatnum:987 654,321|R}}</nowiki></code> <br/>
| + | |
− | <code><nowiki>{{formatnum:987&nbsp;654,321|R}}</nowiki></code>
| + | |
− | | <!--T:202-->
| + | |
− | Takes an unformatted number (arab, no group separators and <code>.</code> as decimal separator) and outputs it in the localized digit script and formatted with decimal and decimal group separators, according to the wiki's default locale. <br />
| + | |
− | The <code><nowiki>|R</nowiki></code> parameter can be used to reverse the behavior, for use in mathematical situations: it's reliable and should be used only to deformat numbers which are known to be formatted exactly as formatnum formats them with the wiki's locale.<br/>
| + | |
− | <!--T:205-->
| + | |
− | The <code>NOSEP</code> ("no separators") parameter means that no group / decimal separators are changed; formatnum will only transform the digits themselves in languages which don't use the [[w:en:Hindu–Arabic numeral system|Hindu–Arabic numeral system]]. <code>NOSEP</code> can also prevent non-standard digit groupings you wouldn't expect.
| + | |
− | | + | |
− | <small>{{TNT|warning}} <!--T:203-->
| + | |
− | Leading zeroes are not removed, you can use <nowiki>{{#expr:00001}}</nowiki> instead if you have <tvar|ext-pf>{{ll|Extension:ParserFunctions}}</> installed.</small> <br/>
| + | |
− | | + | |
− | <small>{{TNT|warning}} <!--T:204-->
| + | |
− | If you don't input numbers in the exact format required, don't expect any reliable output, especially on non-English wikis.</small><br/>
| + | |
− | ----
| + | |
− | | + | |
− | <!--T:206-->
| + | |
− | If you really need to format (according the wiki's locale) a number in unknown input format, you could try and use <code>formatnum</code> two times (but not if it can have a decimal group, or its separator will be eaten or the number won't be formatted). Be aware that this is more a hack than a regular way to proceed, thus the output may be not reliable.
| + | |
− | | + | |
− | | {{ {{TNTN|MW version}} |version=1.7|compact=y|comment=and after}} <br />{{ {{TNTN|MW version}} |version=1.13|compact=y|comment=and after|r=32012}}
| + | |
| |- | | |- |
− | | | + | | <code> {{((}}#if:''string'' {{pipe}}''result1'' {{pipe}}''result2''{{))}} </code> |
− | <code><nowiki>{{#dateformat:</nowiki>''date''<nowiki>}}</nowiki></code><br /> | + | | Outputs ''result2'' if ''string'' is empty, otherwise outputs ''result1''. |
− | <code><nowiki>{{#formatdate:</nowiki>''date''<nowiki>}}</nowiki></code><br />
| + | |
− | <code><nowiki>{{#dateformat:</nowiki>''date''{{!}}''format''<nowiki>}}</nowiki></code><br />
| + | |
− | <code><nowiki>{{#formatdate:</nowiki>''date''{{!}}''format''<nowiki>}}</nowiki></code>
| + | |
− | |
| + | |
− | <code><nowiki>{{#dateformat:25 dec 2009|ymd}}</nowiki></code> <br/>
| + | |
− | → {{#dateformat:25 dec 2009|ymd}} <!--T:207-->
| + | |
− | (your pref), 2009 Dec 25 (default) <br/>
| + | |
− | <code><nowiki>{{#formatdate:dec 25,2009|dmy}}</nowiki></code> <br/>
| + | |
− | → {{#formatdate:dec 25,2009|dmy}} <!--T:208-->
| + | |
− | (your pref), 25 Dec 2009 (default) <br/>
| + | |
− | <code><nowiki>{{#dateformat:2009-12-25|mdy}}</nowiki></code> <br/>
| + | |
− | → {{#dateformat:2009-12-25|mdy}} <!--T:209-->
| + | |
− | (your pref), December 25, 2009 (default) <br/>
| + | |
− | <code><nowiki>{{#formatdate:2009 dec 25|ISO 8601}}</nowiki></code> <br/>
| + | |
− | → {{#formatdate:2009 dec 25|ISO 8601}} <!--T:210-->
| + | |
− | (your pref), 2009-12-25 (default) <br/>
| + | |
− | <code><nowiki>{{#dateformat:25 decEmber|mdy}}</nowiki></code> <br/>
| + | |
− | → {{#dateformat:25 decEmber|mdy}} <!--T:211-->
| + | |
− | (your pref), DecEmber 25 (default) <br/>
| + | |
− | <!--T:212-->
| + | |
− | ''Note:'' In the example hereinbefore, "your pref" refers to your date preference on the current MediaWiki wiki only. | + | |
− | | + | |
− | | + | |
− | | <!--T:213-->
| + | |
− | Formats an unlinked date based on user "date format" preference, and adds metadata tagging it as a formatted date. For logged-out users and those who have not set a date format in their preferences, dates can be given a default: <code>mdy</code>, <code>dmy</code>, <code>ymd</code>, <code>ISO 8601</code> (all case sensitive). If only the month and day are given, only <code>mdy</code> and <code>dmy</code> are valid. If a format is not specified or is invalid, the input format is used as a default. If the supplied date is not recognized as a valid date (specifically, if it contains any metadata such as from a nested use of these or similar templates), it is rendered unchanged, and no (additional) metadata is generated. <br/>
| + | |
− | | + | |
− | <small>{{TNT|warning}}<!--T:214-->
| + | |
− | Although the ISO 8601 standard requires that dates be in the Gregorian calendar, the ISO parameter in this function will still format dates that fall outside the usual Gregorian range (e.g. dates prior to 1583). Also, the magic word cannot properly convert between negative years (used with ISO 8601) and years BC or years BCE (used in general writing).</small>
| + | |
− | | + | |
− | | {{ {{TNTN|MW version}} |version=1.15|compact=y|comment=and after|r=48249}}
| + | |
| |- | | |- |
− | | <code><nowiki>{{lc:</nowiki>''string''<nowiki>}}</nowiki></code> | + | | <code> {{((}}#ifeq:''string1''{{pipe}}''string2'' {{pipe}}''result1'' {{pipe}}''result2''{{))}} </code> |
− | | <code><nowiki>{{lc:DATA CENTER}}</nowiki></code> → {{lc:DATA CENTER}}
| + | | Outputs ''result1'' if ''string1'' and ''string2'' are equal (alphabetically or numerically), otherwise outputs ''result2''. |
− | | {{Anchor|lc|Lc|LC}}<!--T:215-->
| + | |
− | The lowercase input.
| + | |
− | | {{ {{TNTN|MW version}} |version=1.5|compact=y|comment=and after}} | + | |
| |- | | |- |
− | | <code><nowiki>{{lcfirst:</nowiki>''string''<nowiki>}}</nowiki></code> | + | | <code> {{((}}#iferror:''test_string'' {{pipe}}''result1'' {{pipe}}''result2''{{))}} </code> |
− | | <code><nowiki>{{lcfirst:DATA center}}</nowiki></code> → {{lcfirst:DATA center}}
| + | | Outputs ''result1'' if ''test_string'' generates a parsing error, otherwise outputs ''result2''. |
− | | {{Anchor|lcfirst|Lcfirst|LCFIRST}}<!--T:216-->
| + | |
− | The input with the <u>very first</u> character lowercase.
| + | |
− | | {{ {{TNTN|MW version}} |version=1.5|compact=y|comment=and after}} | + | |
| |- | | |- |
− | | <code><nowiki>{{uc:</nowiki>''string''<nowiki>}}</nowiki></code> | + | | <code> {{((}}#ifexpr:''expression'' {{pipe}}''result1'' {{pipe}}''result2''{{))}} </code> |
− | | <code><nowiki>{{uc:text transform}}</nowiki></code> → {{uc:text transform}}
| + | | Outputs ''result1'' if ''expression''{{thinsp}} is true, otherwise outputs ''result2''. |
− | | {{Anchor|uc|Uc|UC}}<!--T:217-->
| + | |
− | The uppercase input.
| + | |
− | | {{ {{TNTN|MW version}} |version=1.5|compact=y|comment=and after}} | + | |
| |- | | |- |
− | | <code><nowiki>{{ucfirst:</nowiki>''string''<nowiki>}}</nowiki></code> | + | | <code> {{((}}#ifexist:''pagetitle'' {{pipe}}''result1'' {{pipe}}''result2''{{))}} </code> |
− | | <code><nowiki>{{ucfirst:text TRANSFORM}}</nowiki></code> → {{ucfirst:text TRANSFORM}}
| + | | Outputs ''result1'' if the page <nowiki>[[</nowiki>''pagetitle'']] exists, otherwise outputs ''result2''. Note that underscores are needed for spaces in namespaces. |
− | | {{Anchor|ucfirst|Ucfirst|UCFIRST}}<!--T:218-->
| + | |
− | The input with the <u>very first</u> character uppercase.
| + | |
− | | {{ {{TNTN|MW version}} |version=1.5|compact=y|comment=and after}}
| + | |
| |- | | |- |
− | | <code><nowiki>{{padleft:xyz|</nowiki>''stringlength''<nowiki>}}</nowiki></code> <br /> | + | | style=white-space:nowrap| <code> {{((}}#switch:''string'' {{pipe}}''c1''=''r1'' {{pipe}}''c2''=''r2'' ... {{pipe}}''default''{{))}}</code> |
− | <code><nowiki>{{padleft:xyz|</nowiki>''strlen''<nowiki>|</nowiki>''char''<nowiki>}}</nowiki></code> <br />
| + | | Outputs ''r1'' if ''string'' is ''c1'', ''r2'' if ''string'' is ''c2'', etc, otherwise outputs ''default'' (if provided). |
− | <code><nowiki>{{padleft:xyz|</nowiki>''strlen''<nowiki>|</nowiki>''string''<nowiki>}}</nowiki></code>
| + | |
− | | <code><nowiki>{{padleft:xyz|5}}</nowiki></code> → {{padleft:xyz|5}} <br />
| + | |
− | <code><nowiki>{{padleft:xyz|5|_}}</nowiki></code> → {{padleft:xyz|5|_}} <br />
| + | |
− | <code><nowiki>{{padleft:xyz|5|abc}}</nowiki></code> → {{padleft:xyz|5|abc}}<br />
| + | |
− | <code><nowiki>{{padleft:xyz|2}}</nowiki></code> → {{padleft:xyz|2}} <br />
| + | |
− | <code><nowiki>{{padleft:|1|xyz}}</nowiki></code> → {{padleft:|1|xyz}}
| + | |
− | <!--T:219-->
| + | |
− | (first character of the string) <br />
| + | |
− | | <!--T:220-->
| + | |
− | Inserts a string of padding characters (character chosen in third parameter; default "0") of a specified length (second parameter) next to a chosen base character or variable (first parameter). The final digits or characters in the base replace the final characters in the padding; i.e. <code><nowiki>{{padleft:44|3|0}}</nowiki></code> produces {{padleft:44|3}}. The padding string may be truncated if its length does not evenly divide the required number of characters.
| + | |
− | | + | |
− | <!--T:221-->
| + | |
− | Only the first character of the third parameter is used in versions up to 1.12, but by version 1.15 all the characters are used.
| + | |
− | | + | |
− | <!--T:222-->
| + | |
− | '''{{mediawiki|bugzilla:16852|Bug}} (fixed in {{mediawiki|rev:45734|r45734}}):''' multibyte characters are interpreted as two characters, which can skew width. These also cannot be used as padding characters. | + | |
− | | {{ {{TNTN|MW version}} |version=1.8|compact=y|comment=and after}}
| + | |
− | |-
| + | |
− | | <code><nowiki>{{padright:xyz|</nowiki>''stringlength''<nowiki>}}</nowiki></code> <br /><code><nowiki>{{padright:xyz|</nowiki>''strlen''<nowiki>|</nowiki>''char''<nowiki>}}</nowiki></code> <br /><code><nowiki>{{padright:xyz|</nowiki>''strlen''<nowiki>|</nowiki>''string''<nowiki>}}</nowiki></code>
| + | |
− | | <code><nowiki>{{padright:xyz|5}}</nowiki></code> → {{padright:xyz|5}} <br />
| + | |
− | <code><nowiki>{{padright:xyz|5|_}}</nowiki></code> → {{padright:xyz|5|_}} <br />
| + | |
− | <code><nowiki>{{padright:xyz|5|abc}}</nowiki></code> → {{padright:xyz|5|abc}} <br />
| + | |
− | <code><nowiki>{{padright:xyz|2}}</nowiki></code> → {{padright:xyz|2}} <br />
| + | |
− | <code><nowiki>{{padright:|1|xyz}}</nowiki></code> → {{padright:|1|xyz}} <br />
| + | |
− | | <!--T:223-->
| + | |
− | Identical to <code>padleft</code>, but adds padding characters to the right side.
| + | |
− | | {{ {{TNTN|MW version}} |version=1.8|compact=y|comment=and after}}
| + | |
| |} | | |} |
− | <!--T:224-->
| |
− | '''See also:''' <tvar|ext-stringfunctions>{{ll|Extension:StringFunctions}}</>.
| |
| | | |
| + | If, in these conditional functions, empty unnamed parameters are to be parsed as empty rather than as text (i.e. as empty rather than as the text "{{{1}}}", "{{{2}}}", etc.), they will require trailing pipes (i.e. <code>{{{1{{pipe}}}}}</code>, <code>{{{2{{pipe}}}}}</code>, etc., rather than <code>{{{1}}}</code>, <code>{{{2}}}</code>, etc.). |
| + | * For the use of these functions in tables, see [[Wikipedia:Conditional tables]]. |
| + | * For examples and further explanations, see [[Wikipedia:Help:Conditional expressions]] and [[Wikipedia:Help:Switch parser function]]. |
| | | |
− | {{anchor|Localization|Localisation}}
| + | ===Other=== |
| | | |
| + | == See also == |
| + | * [[mw:Localisation]] |
| + | * [[mw:Manual:Extending wiki markup]] |
| + | * [http://svn.wikimedia.org/viewvc/mediawiki/trunk/phase3/includes/parser/CoreParserFunctions.php?view=log CoreParserFunctions.php] |
| + | * [[wikipedia:User:Cacycle/wikEd|wikEd]], a MediaWiki editor with syntax highlighting for templates and parser functions |
| | | |
− | === Localization === <!--T:225-->
| + | [[Category:help pages]] |
− | | + | |
− | <!--T:226-->
| + | |
− | Here are the magic words which are used as main localisation tools. Other magic words will often depend on the wiki's locale and configuration or on the chosen language: see in particular [[<tvar|date>#Date and time</>|#Date and time]], [[<tvar|formatting>#Formatting</>|#Formatting]], [[<tvar|misc>#Miscellaneous</>|#Miscellaneous]]. More magic words are added by the <tvar|ext-translate>{{ll|Extension:Translate}}</>.
| + | |
− | | + | |
− | <!--T:227-->
| + | |
− | The usage of these magic words can be very complex, and the documentation is currently incomplete; there's some more info on [[translatewiki:Special:MyLanguage/FAQ#PLURAL|PLURAL]], [[translatewiki:Special:MyLanguage/Grammar|GRAMMAR]], [[translatewiki:Special:MyLanguage/Gender|GENDER]].
| + | |
− | | + | |
− | {| class="wikitable"
| + | |
− | ! width="10%" | <!--T:228-->
| + | |
− | Usage
| + | |
− | ! width="40%" | <!--T:229-->
| + | |
− | Input → Output
| + | |
− | ! <!--T:230-->
| + | |
− | Description
| + | |
− | ! width="10%" | <!--T:231-->
| + | |
− | Version
| + | |
− | |-
| + | |
− | | {{Anchor|plural|Plural|PLURAL}}<code><nowiki>{{plural:2|</nowiki>''is''<nowiki>|</nowiki>''are''<nowiki>}}</nowiki></code>
| + | |
− | | <code><nowiki>{{plural:0|is|are}}</nowiki></code> → {{plural:0|is|are}} <br /> <code><nowiki>{{plural:1*1|is|are}}</nowiki></code> → {{plural:1*1|is|are}} <br /> <code><nowiki>{{plural:21 mod 10|is|are}}</nowiki></code> → {{plural:21 mod 10|is|are}} <br /> <code><nowiki>{{plural:{{#expr:21 mod 10}}|is|are}}</nowiki></code> → {{plural:{{#expr:21 mod 10}}|is|are}} <br /> <code><nowiki>{{plural:1|is|are}}</nowiki></code> → {{plural:1|is|are}} <br /> <code><nowiki>{{plural:2|is|are}}</nowiki></code> → {{plural:2|is|are}} <br /> <!--T:232-->
| + | |
− | (For [[w:Russian language|Russian]])<br /><code><nowiki>{{PLURAL:5|1=Категория|Категории}} </nowiki></code> → Категории
| + | |
− | <br /><code><nowiki>{{PLURAL:3|страница|страницы|страниц}}</nowiki></code> → страницы<br /><code><nowiki>{{PLURAL:5|страница|страницы|страниц}}</nowiki></code> → страниц
| + | |
− | | <!--T:233-->
| + | |
− | Outputs the singular form (second parameter) if the first parameter is an expression equalling one; the plural form (third parameter) otherwise. Its functioning is [[<tvar|meta-help-magicwords>m:Special:MyLanguage/Help:Magic_words#Language-dependent_word_conversions</>|language-dependent]]. <br />Some language codes (ab, av, ba, bxr, ce, crh_cyrl, cv, inh, koi, krc, kv, lbe, lez, mhr, mrj, myv, ru, tt_cyrl, tyv, udm, xal) used 3 plural forms ([[betawiki:Thread:Portal talk:Ru/Plural changes in many languages|updated 01.2014]]):
| + | |
− | *Form 1: 1, 21, 31, 41, 51, 61, 71, 81, 101, 1001, …
| + | |
− | *Form 2: 0, 5, 6, 7,8,...18, 19, 100, 1000, 10000, 100000, 1000000, …
| + | |
− | *Form 3: 2, 3, 4, 22, 23, 24, 32, 33, 34, 42, 43, 44, 52, 53, 54, 62, 102, 1002, …
| + | |
− | |
| + | |
− | |-
| + | |
− | | {{Anchor|grammar|Grammar|GRAMMAR}}<code><nowiki>{{grammar:N|</nowiki>''noun''<nowiki>}}</nowiki></code>
| + | |
− | |
| + | |
− | | <!--T:234-->
| + | |
− | Outputs the correct inflected form of the given word described by the inflection code after the colon ([[<tvar|meta-help-magicwords>m:Special:MyLanguage/Help:Magic_words#Language-dependent_word_conversions</>|language-dependent]]). Grammar transformations are used for inflected languages like Polish. See also <tvar|manual-wg-grammarform>{{mediawiki|Special:MyLanguage/Manual:$wgGrammarForms|$wgGrammarForms}}</>.
| + | |
− | | {{ {{TNTN|MW version}} |version=1.7|compact=y|comment=and after}}
| + | |
− | |-
| + | |
− | | {{Anchor|gender|Gender|GENDER}}<code><nowiki>{{gender:username|text for every gender}}</nowiki></code><br />
| + | |
− | <code><nowiki>{{gender:Username|male text|female text|text for unspecified}}</nowiki></code><br />
| + | |
− | <code><nowiki>{{gender:|male text|female text|text for unspecified}}</nowiki></code><br />
| + | |
− | <code><nowiki>{{gender:.|male text|female text|text for unspecified}}</nowiki></code><br />
| + | |
− | | ''<!--T:235-->
| + | |
− | (Depends on the named user's gender)''
| + | |
− | | <!--T:236-->
| + | |
− | A switch for the gender set in [[Special:Preferences]]. <br/>
| + | |
− | ''Note:'' The first example is basically a no-op<br/>
| + | |
− | ''Note:'' If 3rd parameter is omitted and user hasn't defined his/her gender, then <code>''text if user is male''</code> is returned.<br>A blank username field (<tvar|gender><nowiki>{{gender:|</nowiki></>) means the current user.<br>
| + | |
− | A dot username (.) means the default user gender on this wiki.
| + | |
− | | {{ {{TNTN|MW version}} |version=1.15|compact=y|comment=and after|r=46247}}
| + | |
− | |-
| + | |
− | | {{Anchor|int|INT}}<code><nowiki>{{int:</nowiki><!--T:285-->
| + | |
− | ''message name''<nowiki>}}</nowiki>
| + | |
− | | <code><nowiki>{{int:</nowiki>edit<nowiki>}}</nowiki></code> → '''{{int:edit}}''' <br /><small>''<!--T:237-->
| + | |
− | (Depends on user language; try: [{{fullurl:{{FULLPAGENAME}}|uselang=fr}}#Localisation fr] • [{{fullurl:{{FULLPAGENAME}}|uselang=ja}}#Localisation ja])''</small>
| + | |
− | | <!--T:238-->
| + | |
− | Internationalizes (translates) the given '''int'''erface (MediaWiki namespace) message into the user language. For <code>msgnw</code> and other transclusion magic words, see the [[<tvar|sec>#Transclusion modifiers</>|Transclusion modifiers]] section.
| + | |
− | ''Note that this can damage / confuse cache consistency in MediaWiki 1.17 and earlier, see [[bugzilla:14404|bug 14404]].''
| + | |
− | |
| + | |
− | |-
| + | |
− | | <code><nowiki>{{int:editsectionhint|MediaWiki}}</nowiki>
| + | |
− | | <code><nowiki>{{int:editsectionhint|MediaWiki}}</nowiki></code> → '''{{int:editsectionhint|MediaWiki}}'''
| + | |
− | | <!--T:239-->
| + | |
− | You may also use parameters with translations. <br />Parameters are designated in messages with: $1, $2, $3, etc. <br />For example, here is the message for ''editsectionhint'': Edit section: $1 <br />In this example, MediaWiki replaces $1.
| + | |
− | |
| + | |
− | |}
| + | |
− | | + | |
− | {{anchor|Transclusion modifiers}}
| + | |
− | | + | |
− | === Transclusion modifiers === <!--T:308-->
| + | |
− | | + | |
− | <!--T:309-->
| + | |
− | <nowiki>{{</nowiki>''Page name''|''optional params''}} usually transcludes another page, by default from the Template:namespace.
| + | |
− | | + | |
− | <!--T:310-->
| + | |
− | These magic words modify that behavior.
| + | |
− | | + | |
− | | + | |
− | {| class="wikitable plainlinks"
| + | |
− | ! width="15%" | <!--T:311-->
| + | |
− | Usage
| + | |
− | ! width="15%" | <!--T:312-->
| + | |
− | Output
| + | |
− | ! <!--T:313-->
| + | |
− | Description
| + | |
− | ! width="10%" | <!--T:314-->
| + | |
− | Version
| + | |
− | |-
| + | |
− | | <nowiki>{{:xyz}}</nowiki>
| + | |
− | |
| + | |
− | | <!--T:315-->
| + | |
− | A bare colon is not a template modifier, it's the prefix for the main namespace. <!--T:316-->
| + | |
− | Since transclusion defaults to the Template namespace, you would use for example, <tvar|code1>{{:UTC}}</> (vs. <tvar|code2>{{UTC}}</>) to include the text of the main namespace article UTC rather than Template:UTC.
| + | |
− | |
| + | |
− | |-
| + | |
− | | <nowiki>{{int:xyz}}</nowiki>
| + | |
− | |
| + | |
− | | <!--T:317-->
| + | |
− | Same as <tvar|mw><nowiki>{{MediaWiki:xyz}}</nowiki></>, except standard message translation is applied depending on subpages and content/user/uselang language. <!--T:318-->
| + | |
− | Another difference is: this doesn't appear under "<tvar|translatesused>{{int|templatesused}}</>". <!--T:319-->
| + | |
− | Rendered as <tvar|int>{{int:xyz}}</> if <tvar|mw>[[MediaWiki:xyz]]</> doesn't exist. <!--T:320-->
| + | |
− | See also <tvar|1>{{ll|Help:System message}}</>.
| + | |
− | |
| + | |
− | |-
| + | |
− | | <nowiki>{{msg:xyz}}</nowiki>
| + | |
− | |
| + | |
− | | <!--T:321-->
| + | |
− | Even if there is a magic word named "xyz", use template:xyz unless the template doesn't exist (equivalent to <tvar|code><nowiki>{{template:xyz}}</nowiki></>). <!--T:322-->
| + | |
− | Normally, magic words have priority when there is a conflict.
| + | |
− | |
| + | |
− | |-
| + | |
− | | <nowiki>{{msgnw:xyz}}</nowiki>
| + | |
− | |
| + | |
− | | <!--T:323-->
| + | |
− | The unexpanded wikitext is rendered (more or less, for details see <tvar|msgnw>{{ll|Help:Template#msgnw|msgnw}}</>).
| + | |
− | |
| + | |
− | |-
| + | |
− | | <nowiki>{{raw:xyz}}</nowiki>
| + | |
− | |
| + | |
− | | <!--T:324-->
| + | |
− | Equivalent to <tvar|msg><code><nowiki>{{msg:xyz}}</nowiki></code></> above.
| + | |
− | | {{TNT|MW version|version=1.6|compact=y|comment=and after|r=12925}}
| + | |
− | |-
| + | |
− | | <nowiki>{{subst:xyz}}</nowiki>
| + | |
− | |
| + | |
− | | <!--T:325-->
| + | |
− | In the wikitext, the tag is substituted by the ''content'' (single-level evaluation only), see [[<tvar|usage>Special:MyLanguage/Help:template#Usage</>|Template usage]].
| + | |
− | |
| + | |
− | |}
| + | |
− | | + | |
− | {{anchor|Miscellaneous}}
| + | |
− | | + | |
− | === Miscellaneous === <!--T:240-->
| + | |
− | | + | |
− | | + | |
− | {| class="wikitable plainlinks"
| + | |
− | ! width="15%" | <!--T:241-->
| + | |
− | Usage
| + | |
− | ! width="15%" | <!--T:242-->
| + | |
− | Output
| + | |
− | ! <!--T:243-->
| + | |
− | Description
| + | |
− | ! width="10%" | <!--T:244-->
| + | |
− | Version
| + | |
− | |-
| + | |
− | | <!--T:286-->
| + | |
− | <tvar|code1><code><nowiki>{{#language:</nowiki></>''language code''<tvar|code2><nowiki>}}</nowiki></code><br /><code><nowiki>{{#language:ar}}</nowiki></code> <br /><code><nowiki>{{#language:</nowiki></>''language code''<tvar|code3><nowiki>|</nowiki><br /></>''target language code''<tvar|code5><nowiki>}}</nowiki></code> <br /><code><nowiki>{{#language:ar|en}}</nowiki></code></>
| + | |
− | | {{#language:language code}} <br />{{#language:ar}} <br />{{#language:language code|<!--T:287-->
| + | |
− | target language code<tvar|code1>}} <br /></>Arabic
| + | |
− | | <!--T:245-->
| + | |
− | The full name of the language for the given [[<tvar|manual-langcode>Special:MyLanguage/Manual:Language#lang-code</>|language code]]: native name (language autonym) by default, name translated in target language if a target language code is specified. <tvar|ext-cldr>{{ll|Extension:CLDR}}</> must be installed for the translation to work.
| + | |
− | | {{ {{TNTN|MW version}} |version=1.7|compact=y|comment=and after|r=14490}}<br /> {{ {{TNTN|MW version}} |version=1.18|compact=y|comment=and after|r=91875}} <!--T:246-->
| + | |
− | (translation)
| + | |
− | |-
| + | |
− | | <code><nowiki>{{#special:</nowiki><!--T:288-->
| + | |
− | ''special page name''<nowiki>}}</nowiki> <br /><nowiki>{{#special:userlogin}}</nowiki></code>
| + | |
− | | {{#special:special page name}} <br />{{#special:userlogin}}
| + | |
− | | <!--T:247-->
| + | |
− | The localized name for the given canonical Special: page.
| + | |
− | | {{ {{TNTN|MW version}} |version=1.9|compact=y|comment=and after|r=17321}}
| + | |
− | |-
| + | |
− | | <code><nowiki>{{#speciale:</nowiki><!--T:289-->
| + | |
− | ''special page name''<nowiki>}}</nowiki> <br /><nowiki>{{#speciale:userlogin}}</nowiki></code>
| + | |
− | | {{#speciale:special page name}} <br />{{#speciale:userlogin}}
| + | |
− | | <!--T:248-->
| + | |
− | The localized and URL-encoded name for the given canonical Special: page.
| + | |
− | | {{ {{TNTN|MW version}} |version=1.20|compact=y|comment=and after|gerrit change=4340}}
| + | |
− | |-
| + | |
− | | <code><nowiki>{{#tag:</nowiki><!--T:290-->
| + | |
− | ''tagname'' <tvar|code1><br/><nowiki>|</nowiki></>''content'' <tvar|code2><br/><nowiki>|</nowiki></>''attribute1=value1'' <tvar|code3><br /><nowiki>|</nowiki></>''attribute2=value2''<br /><nowiki>}}</nowiki></code>
| + | |
− | | <!--T:249-->
| + | |
− | ''(Depends on parser tag)''
| + | |
− | | <!--T:250-->
| + | |
− | Alias for XML-style MediaWiki parser tags or extension tags. It allows execution of wiki code and <tvar|ext-pf>{{ll|Extension:ParserFunctions}}</> within tags before the tag is processed. It also prevents parsing of tags in conditional paths that aren't executed (like in <code>#if</code> statements). Content between tags is passed as the first parameter, and any attributes for the tags can be passed as subsequent parameters. This example:
| + | |
− | | + | |
− | <!--T:251-->
| + | |
− | <tvar|code1><code><</>tagname ''attribute1''="''value1''"<br />''attribute2''="''value2''"<tvar|code2>></code></>''Your content goes here''<tvar|code3><code><</>/tagname<tvar|code4>></code></>
| + | |
− | | + | |
− | <!--T:252-->
| + | |
− | …can be rewritten like this:
| + | |
− | | + | |
− | <!--T:253-->
| + | |
− | <tvar|code1><code><nowiki>{{#tag:</nowiki></code></>''tagname''<tvar|code2><code><nowiki>|</nowiki></code></>''Your content goes here''<tvar|code3><code><nowiki>|</nowiki></code></>''attribute1''=''value1''<tvar|code4><code><nowiki>|</nowiki></code></>''attribute2''=''value2''<tvar|code5><code><nowiki>}}</nowiki></code></>
| + | |
− | | + | |
− | <!--T:254-->
| + | |
− | Example for the [[<tvar|ext-cite>Special:MyLanguage/Extension:Cite</>|Cite extension]]'s <code><ref></code> tags:
| + | |
− | | + | |
− | | + | |
− | <!--T:255-->
| + | |
− | <code><nowiki>{{#tag:ref|Citation text goes here,</nowiki><br /><nowiki>and you can include parser functions</nowiki><br /><nowiki>like {{#expr: ... }} and magic words</nowiki><br /><nowiki>like {{PAGENAME}}.|name="multiple"}}</nowiki></code>
| + | |
− | | + | |
− | | + | |
− | <small>{{TNT|warning}}<!--T:256-->
| + | |
− | You must write <tvar|code1><code><nowiki>{{#tag:</nowiki></code></>''tagname''<tvar|code2><code><nowiki>||</nowiki></code></>''attribute1''=''value1''<tvar|code3><code><nowiki>|</nowiki></code></>''attribute2''=''value2''<tvar|code4><code><nowiki>}}</nowiki></code></> to pass an empty content. No space is permitted in the area reserved for content between the pipe characters <tvar|code5><code>{{!}}{{!}}</code></> before ''attribute1''.</small>
| + | |
− | | {{ {{TNTN|MW version}} |version=1.12|compact=y|comment=and after|r=29482}}
| + | |
− | |}
| + | |
− | | + | |
− | [[Category:Help pages]]
| + | |
A quick reference for magic words can be found on this page. For more complete documentation, see the following pages on the MediaWiki site:
Some magic words are case-insensitive, but not all. White space is stripped from the start and end of keywords and parameters, as in template syntax.
The example outputs in the following table are those that would be produced on the page "Help:Magic words/subpage".
The magic words above can also take a parameter, in order to parse values on a page other than the current page. A colon (
. For example,
on any page. See
for more details of parser functions.
To output numbers without comma separators (for example, as "123456789" rather than "123,456,789"), append the parameter |R
.
If, in these conditional functions, empty unnamed parameters are to be parsed as empty rather than as text (i.e. as empty rather than as the text "{{{1}}}", "{{{2}}}", etc.), they will require trailing pipes (i.e. {{{1|}}}
, {{{2|}}}
, etc., rather than {{{1}}}
, {{{2}}}
, etc.).