Magic words: Difference between revisions

Jump to navigation Jump to search
m (Gerald Chi moved page Help:Magic Words to Magic Words)
 
m (Gerald Chi moved page Magic Words to Magic words without leaving a redirect)
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
This is an organised index of all Magic words that are known to work on this wiki. "XYZ" indicates user input, which is used in the example.
__NOTOC__
{{CMG}}


== Template modifiers ==
==Overview==
This is an organized index of Magic words used in MediaWiki.  "XYZ" indicates user input, which is used in the example.
 
==Table of contents==
:''For details see [[Help:Section]]''
{{H:TOC variables}}<br clear="left" />
 
===Other===
{| class="wikitable" border="2" cellpadding="4" cellspacing="0" width="79%"
! Word
! Explanation
|-
| <nowiki>__NOEDITSECTION__</nowiki>
| Hides the edit links beside headings.
|-
| <nowiki>__NEWSECTIONLINK__</nowiki>
| '''[MW1.7+]''' Gives a "+"-link next to the edit-tab to make a new section on a non-talk page.
|-
| <nowiki>__NOCONTENTCONVERT__</nowiki><br /><nowiki>__NOCC__</nowiki>
| Don't perform the content language conversion  (character and phase) in article display; for example, Chinese zh with zh_cn, zh_tw, zh_sg, zh_hk.
|-
| <nowiki>__NOGALLERY__</nowiki>
| '''[MW1.7+]''' This magic word allows images in category pages to be displayed as inline links instead of gallery.
|-
| <nowiki>__NOTITLECONVERT__</nowiki><br /><nowiki>__NOTC__</nowiki>
| Like <nowiki>__NOCC__</nowiki> but affecting article title only.
|-
| <nowiki>__END__</nowiki>
| Allows for trailing whitespace to be included in the page save (does not seem to work anymore).
|-
| <nowiki>__START__</nowiki>
| This magic word has no effect but an ID in <tt>MagicWord.php</tt> (<code>MAG_START</code>).
|}<br clear="left" />
 
==XML-style tags==
'''nowiki''': &lt;nowiki>'''...'''&lt;/nowiki>, disables expansion/interpretation of templates, link syntax, formatting syntax, etc.:<nowiki>&lt;nowiki>'''[[{{tc}}]]'''&lt;/nowiki></nowiki> gives <nowiki>'''[[{{tc}}]]'''</nowiki>
 
'''noinclude''': &lt;noinclude>'''...'''&lt;/noinclude>, specifies text to appear or function calls to apply  ''only'' on the transcluded page, ''not'' on the transcluding page. E.g. categorizing of a template itself (and not the transcluding page) would use this tag.
 
'''includeonly''': &lt;includeonly>'''...'''&lt;/includeonly>, specifies text to appear or function calls to apply ''only'' on the transcluding page, ''not'' on the transcluded page (which usually is a template). E.g. a template which categorizes pages where it's applied, but not the template itself, into a certain category.
 
'''onlyinclude''': &lt;onlyinclude>'''...'''&lt;/onlyinclude>, specifies text to appear or function calls to apply ''only'' on the transcluding page, ''not'' on the transcluded page. This tag is distinguished from the &lt;includeonly> tag in that text or code on the transcluded page not enveloped by the tag will ''not'' be transcluded, whether or not the &lt;noinclude> tag is in use.
 
'''pre''': &lt;pre>'''...'''&lt;/pre>, ditto, also for multiple lines; it is rendered with a new paragraph at the start and end: a&lt;pre><nowiki>'''[[{{tc}}]]'''</nowiki>&lt;/pre> gives a<pre>'''[[{{tc}}]]'''</pre>
'''math''': &lt;math>'''...'''&lt;/math>, e.g. <nowiki><math>\sqrt{a^2+b^2}</math></nowiki> gives <math>\sqrt{a^2+b^2}</math>; see [[Help:Displaying a formula]]
'''hiero''': &lt;hiero>'''...'''&lt;/hiero>, e.g. <nowiki><hiero>A1</hiero></nowiki> gives: <hiero>A1</hiero>
 
'''categorytree''': &lt;categorytree>'''...'''&lt;/categorytree> provides a dynamic view of the category structure specified as a tree.
 
===Time===
The time in [[:en:UTC|UTC]].  Note that if the page was displayed by the same user and has not changed (has not been edited) since the last time it was displayed, it is possible that the page may be cached (by the user's browser) and the displayed time or date may not change.  Also, if a heavily used page, rather than freshly rendered by the software each time it is generated, is instead being retrieved from a caching system (such as the main page on Wikipedia) the date or time may not change from the last time the page was originally retrieved by the caching hardware or software.
{| class="wikitable sortable" border="2" cellpadding="4" cellspacing="0"
! Word
! class="unsortable" | Example
! class="unsortable" | Explanation
|-
| <nowiki>{{CURRENTDAY}}</nowiki>
| <code>{{CURRENTDAY}}</code>
| Displays the current day in numeric form.
|-
| <nowiki>{{CURRENTDAY2}}</nowiki>
| <code>{{CURRENTDAY2}}</code>
| '''[MW1.6+]''' Same as <nowiki>{{CURRENTDAY}}</nowiki>, but with leading zero (01 .. 31).
|-
| <nowiki>{{CURRENTDAYNAME}}</nowiki>
| <code>{{CURRENTDAYNAME}}</code>
| Name of the day in the language of the project or English.
|-
| <nowiki>{{CURRENTDOW}}</nowiki>
| <code>{{CURRENTDOW}}</code>
| Same as <nowiki>{{CURRENTDAYNAME}}</nowiki>, but as a number (0=Sunday, 1=Monday...).
|-
| <nowiki>{{CURRENTMONTH}}</nowiki>
| <code>{{CURRENTMONTH}}</code>
| The number 01 .. 12 of the month.
|-
| <nowiki>{{CURRENTMONTHABBREV}}</nowiki>
| <code>{{CURRENTMONTHABBREV}}</code>
| '''[MW1.5+]''' Same as <nowiki>{{CURRENTMONTH}}</nowiki>, but in abbreviated form (Jan .. Dec).
|-
| <nowiki>{{CURRENTMONTHNAME}}</nowiki>
| <code>{{CURRENTMONTHNAME}}</code>
| Same as <nowiki>{{CURRENTMONTH}}</nowiki>, but in named form (January .. December).
|-
| <nowiki>{{CURRENTTIME}}</nowiki>
| <code>{{CURRENTTIME}}</code>
| The current time (00:00 .. 23:59).
|-
| <nowiki>{{CURRENTHOUR}}</nowiki>
| <code>{{CURRENTHOUR}}</code>
| The current hour (00 .. 23).
|-
| <nowiki>{{CURRENTMINUTE}}</nowiki>
| <code>{{CURRENTMINUTE}}</code>
| The current minute (00 .. 59).
|-
| <nowiki>{{CURRENTSECOND}}</nowiki>
| <code>{{CURRENTSECOND}}</code>
| The current second (00 .. 59).
|-
| <nowiki>{{CURRENTWEEK}}</nowiki>
| <code>{{CURRENTWEEK}}</code>
| Number of the current week (1-53) according to [[w:en:ISO 8601|ISO 8601]] with no leading zero.
|-
| <nowiki>{{CURRENTYEAR}}</nowiki>
| <code>{{CURRENTYEAR}}</code>
| Returns the current year.
|-
| <nowiki>{{CURRENTTIMESTAMP}}</nowiki>
| <code>{{CURRENTTIMESTAMP}}</code>
| '''[MW1.7+]''' [[w:en:ISO 8601|ISO 8601]] time stamp.
|}{{-}}
 
===Local time===
The time depending on the local timezone of the wiki (''not'' depending on the timezone in the user's preference settings). (All words '''[MW1.8+]''' )
{| class="wikitable" border="2" cellpadding="4" cellspacing="0"
! Word
! Example
! Explanation
|-
| <nowiki>{{LOCALDAY}}</nowiki>
| <code>{{LOCALDAY}}</code>
| Displays the local day of the month in numeric form.
|-
| <nowiki>{{LOCALDAY2}}</nowiki>
| <code>{{LOCALDAY2}}</code>
| Same as <nowiki>{{LOCALDAY}}</nowiki>, but with a leading zero (01 .. 31).
|-
| <nowiki>{{LOCALDAYNAME}}</nowiki>
| <code>{{LOCALDAYNAME}}</code>
| Name of the day in the language of the project or English.
|-
| <nowiki>{{LOCALDOW}}</nowiki>
| <code>{{LOCALDOW}}</code>
| Same as <nowiki>{{LOCALDAYNAME}}</nowiki>, but as a number (0=Sunday, 1=Monday...).
|-
| <nowiki>{{LOCALMONTH}}</nowiki>
| <code>{{LOCALMONTH}}</code>
| The number 01 .. 12 of the month.
|-
| <nowiki>{{LOCALMONTHABBREV}}</nowiki>
| <code>{{LOCALMONTHABBREV}}</code>
| Same as <nowiki>{{LOCALMONTH}}</nowiki>, but in abbreviated form as Jan .. Dec.
|-
| <nowiki>{{LOCALMONTHNAME}}</nowiki>
| <code>{{LOCALMONTHNAME}}</code>
| Same as <nowiki>{{LOCALMONTH}}</nowiki>, but in named form as January .. December.
|-
| <nowiki>{{LOCALTIME}}</nowiki>
| <code>{{LOCALTIME}}</code>
| The local time (00:00 .. 23:59).
|-
| <nowiki>{{LOCALHOUR}}</nowiki>
| <code>{{LOCALHOUR}}</code>
| The local hour (00 .. 23).
|-
| <nowiki>{{LOCALWEEK}}</nowiki>
| <code>{{LOCALWEEK}}</code>
| Number of the local week (1-53) according to [[w:en:ISO 8601|ISO 8601]] with no leading zero.
|-
| <nowiki>{{LOCALYEAR}}</nowiki>
| <code>{{LOCALYEAR}}</code>
| Returns the local year.
|-
| <nowiki>{{LOCALTIMESTAMP}}</nowiki>
| <code>{{LOCALTIMESTAMP}}</code>
| [[w:en:ISO 8601|ISO 8601]] time stamp.
|}{{-}}
 
===Statistics===
Statistics variables give thousands separators unless ":R" for "raw" is added (actually, these versions are parser functions).
 
{| class="wikitable" border="2" cellpadding="4" cellspacing="0"
! Word
! Example
! Explanation
|-
| <nowiki>{{CURRENTVERSION}}</nowiki>
| <code>{{CURRENTVERSION}}</code>
| '''[MW1.7+]''' {{h:mwg|Version}} [http://mail.wikipedia.org/pipermail/mediawiki-i18n/2006-May/000026.html]
|-
|<nowiki>{{NUMBEROFEDITS}}</nowiki><br /><nowiki>{{NUMBEROFEDITS:R}}</nowiki>
| <code>{{NUMBEROFEDITS}}</code><br /><code>{{NUMBEROFEDITS:R}}</code>
| '''[MW1.10+ (r21319)]''' Returns the total number of page edits since MediaWiki, the software that runs this site, was installed.
|-
| <nowiki>{{NUMBEROFARTICLES}}</nowiki><br /><nowiki>{{NUMBEROFARTICLES:R}}</nowiki>
| <code>{{NUMBEROFARTICLES}}</code><br /><code>{{NUMBEROFARTICLES:R}}</code>
| A [[Help:Variable|variable]] which returns the total number of articles on the Wiki.
|-
| <nowiki>{{NUMBEROFPAGES}}</nowiki><br /><nowiki>{{NUMBEROFPAGES:R}}</nowiki>
| <code>{{NUMBEROFPAGES}}</code><br /><code>{{NUMBEROFPAGES:R}}</code>
| '''[MW1.7+]''' Returns the total number of pages. [http://mail.wikipedia.org/pipermail/mediawiki-i18n/2006-May/000026.html]
|-
| <nowiki>{{NUMBEROFFILES}}</nowiki><br /><nowiki>{{NUMBEROFFILES:R}}</nowiki>
| <code>{{NUMBEROFFILES}}</code><br /><code>{{NUMBEROFFILES:R}}</code>
| '''[MW1.5+]''' Returns the number of uploaded files (rows in the image table).
|-
| <nowiki>{{NUMBEROFUSERS}}</nowiki><br /><nowiki>{{NUMBEROFUSERS:R}}</nowiki>
| <code>{{NUMBEROFUSERS}}</code><br /><code>{{NUMBEROFUSERS:R}}</code>
| '''[MW1.7+]''' Returns the number of registered users (rows in the user table).
|-
| <nowiki>{{NUMBEROFADMINS}}</nowiki><br /><nowiki>{{NUMBEROFADMINS:R}}</nowiki>
| <code>{{NUMBEROFADMINS}}</code><br /><code>{{NUMBEROFADMINS:R}}</code>
| '''[MW1.7+]''' Returns the number of administrators (users in the ''sysop'' group).
|-
| <nowiki>{{PAGESINNAMESPACE}}</nowiki>
| &#160;{{#if:{{#ifexpr:{{PAGEINNS:0|R}}}}|<font color="red">'''disabled here'''</font>}}
| Longer alias of PAGESINNS
|-
| <nowiki>{{PAGESINNS:ns}}</nowiki><br /><nowiki>{{PAGESINNS:ns:R}}</nowiki>
| <nowiki>{{PAGESINNS:2}}</nowiki>&#160;{{#if:{{#ifexpr:{{PAGEINNS:0|R}}}}||=&#160;<tt>{{PAGESINNS:2}}</tt>}}<br /><nowiki>{{PAGESINNS:2:R}}</nowiki>&#160;{{#if:{{#ifexpr:{{PAGEINNS:0|R}}}}|<br /><font color="red">'''disabled here'''</font>|=&#160;<tt>{{PAGESINNS:2|R}}</tt>}}
| '''[MW1.7+]''' Returns the number of pages in the given namespace. Disabled by default, enable with {{h:mwg|AllowSlowParserFunctions}}.
|}{{-}}
 
=== Page names and related info ===
==Parser functions==
Not working at the position of the page where the tag is located but on the page header, and throughout the page, respectively (see below):
*DISPLAYTITLE: allow the page header to be different from the page name.
*DEFAULTSORT: Sets a default [[Help:Categories#Sort_key|category sort key]] for the page.
 
=== Formatting ===
{| class="wikitable" border="2" cellpadding="4" cellspacing="0" width="100%"
! Word
! Example
! Explanation
|-
| <nowiki>{{#language:}}</nowiki>
| <nowiki>{{#language:da}}</nowiki> = <code>{{#language:da}}</code>
| '''[MW1.7+]''' Native name of language code.
|-
| <nowiki>{{lc:}}</nowiki>
| <nowiki>{{lc:AbC dEf}}</nowiki> = <code>{{lc:AbC dEf}}</code>
| '''[MW1.5+]''' LowerCase
|-
| <nowiki>{{lcfirst:}}</nowiki>
| <nowiki>{{lcfirst:Ab Cd}}</nowiki> = <code>{{lcfirst:Ab Cd}}</code>
| '''[MW1.5+]''' LC first char.
|-
| <nowiki>{{uc:}}</nowiki>
| <nowiki>{{uc:aBc DeF}}</nowiki> = <code>{{uc:aBc DeF}}</code>
| '''[MW1.5+]''' UpperCase
|-
| <nowiki>{{ucfirst:}}</nowiki>
| <nowiki>{{ucfirst:aB cD}}</nowiki> = <code>{{ucfirst:aB cD}}</code>
| '''[MW1.5+]''' UC first char.
|-
| <nowiki>{{formatnum:}}</nowiki>
| <nowiki>{{formatnum:-299792458.56789}}</nowiki> = <code>{{formatnum:-299792458.56789}}</code>
| '''[MW1.7+]''' Add [[w:Decimal_separator#Thousands_separator|decimal separators]] according to the wiki's default locale. Leading minus and plus are recognized.
|-
|<nowiki>{{padleft:}}</nowiki><br /><br /><br /><br /><br /><nowiki>{{padright:}}</nowiki><br />
|
<nowiki>{{padleft:7|3|0}}</nowiki> = <code>{{padleft:7|3|0}}</code><br/><br/>
<nowiki>{{padleft:0|3|0}}</nowiki> = <code>{{padleft:0|3|0}}</code> (bug)<br/><br/>
<nowiki>{{padleft:bcd|6|a}}</nowiki> = <code>{{padleft:bcd|6|a}}</code><br/>
<nowiki>{{padleft:café|8|-}}</nowiki> = <code>{{padleft:café|8|-}}</code>(<==Bug effect)<br />
<nowiki>{{padleft:cafe|8|-}}</nowiki> = <code>{{padleft:cafe|8|-}}</code><br />
 
<nowiki>{{padleft:bcd|6|{{!}}}}</nowiki> = <code>{{padleft:bcd|6|{{!}}}}</code><br/>
<br/>
<nowiki>{{padright:bcd|6|a}}</nowiki> = <code>{{padright:bcd|6|a}}</code><br />
<nowiki>{{padright:0|6|a}}</nowiki> = <code>{{padright:0|6|a}}</code> (bug)<br />
 
|valign="top"|<br />First case is, for example, applicable to years in a category... giving an ordered year to sort by pipetricks order, or any such ordering where left extended zeros allow a proper sorting.<br /><br /> '''[MW1.8+]''' Pads a string with a character to the specified width. Note that there's a little bug that interprets non-[[w:US-ASCII|US-ASCII]] characters as two, instead of one character (see the difference in''' ''café'' and ''cafe'' '''in the examples.)
 
It does not seem possible to use padleft and padright for padding with characters with a multi-character code, such as <code>&amp;nbsp;</code>, which would be useful with padleft for [[Help:Sorting|sorting tables]] with Javascript.
 
Padding "0" does not work, it returns the same. This seems to be a bug.<ref>Function pad in includes/CoreParserFunctions.php puts, oddly, the $string itself as a condition for the padding. To be reported as bug.</ref>
|}{{-}}
 
With regard to #language and {{tim|n local}}, see also:
*[[List of Wikipedias/local names]] - shows both names for all languages, without automatic comparison
*[[List of Wikipedias/local names/diff]] - values of [[Help:Magic words#Formatting|#language]] for which <nowiki>{{n local}}</nowiki> contains a different name.
*[[List of Wikipedias/local names/diff 1]] - for languages where the two names are different, shows both; due to the {{peisl}} the end of the table is messed up
 
==Image modifiers==
These are [[Help:Image page|image]] modifiers used in <code><nowiki>[[Image:title.ext|modifier|...|modifier]]</nowiki></code> links. Some are mutually exclusive, and then the last specified wins.
 
===Size===
The last unrecognized modifier is used as '''caption''' for ''framed'' images or together with ''thumbnail''s. It's also used as description <tt>alt=</tt>''text''.
{| class="wikitable" border="2" cellpadding="4" cellspacing="0"
! Word
! Usage
! Explanation
|-
| framed<br/>frame<br/>enframed
| <nowiki>[[Image:Mediawiki.png|framed]]</nowiki>
| Places an image in a ''frame'' with a description. Uses original size and stubbornly ignores width parameter if given.<br>In general, far better to use thumb, as is only suitable for small images.
|-
| border
| <nowiki>[[Image:Mediawiki.png|border]]</nowiki>
| Shows a 1px border around the image.
|-
| thumbnail<br/>thumb
| <nowiki>[[Image:Mediawiki.png|thumbnail]]</nowiki>
| Modifies image size, sets it dependent on user's favorite thumbnail size in one's preferences, or on the given width parameter (see below).
|-
| thumb=''xyz''
| <nowiki>[[Image:Mediawiki.png|thumb=Wiki.png]]</nowiki>
| Manualthumb: instead of displaying an automatically-sized thumbnail for <var>Mediawiki.png</var>, display the image <var>Wiki.png</var>.
|-valign="top"
| ''width'' px<br>100x200px
| <nowiki>[[Image:Mediawiki.png|40px]]</nowiki><br><nowiki>[[Image:Mediawiki.png|100x200px]]</nowiki>
| Scales image to given ''width''&#160; in pixels<br>Scales image to no more than 100 pixels wide and no more than 200 high, but image scaled to retain its true aspect ratio within the boundary specified.
|}{{-}}
 
=== Position ===
:''For details see [[Help:Images and other uploaded files]]''
The positions are mutually exclusive; the last specified wins. [[:Template:-]] can stop floating. For inline images only modifier ''px'' (see above) is supported.
{| class="wikitable" border="2" cellpadding="4" cellspacing="0" width="100%"
! Word
! Usage
! Explanation
|-
| right
| <nowiki>[[Image:Mediawiki.png|right]]</nowiki>
| Modifies position, floats the image to the right.
|-
| <nowiki>left</nowiki>
| <nowiki>[[Image:Mediawiki.png|left]]</nowiki>
| Modifies position, floats the image to the left.
|-
| <nowiki>none</nowiki>
| <nowiki>[[Image:Mediawiki.png|none]]</nowiki>
| Explicitly states that the image should not float.
|-
| center<br />centre
| <nowiki>[[Image:Mediawiki.png|center]]</nowiki>
| Modifies position, like ''none'' but centered.
|}{{-}}
 
==Miscellany==
{| class="wikitable" border="2" cellpadding="4" cellspacing="0"
! Word
! Example
! Explanation
|-
| <nowiki>{{DISPLAYTITLE:</nowiki>''xyz''<nowiki>}}</nowiki>
|
| '''[MW 1.7+]''' Set the page's title [http://svn.wikimedia.org/viewvc/mediawiki?view=rev&revision=13572], enabled in Wikimedia projects since June 2007 ([http://svn.wikimedia.org/viewvc/mediawiki?view=rev&revision=23393]). Also see {{h:mwg|AllowDisplayTitle}}.
|-
| <nowiki>{{DIRMARK}}</nowiki><br /><nowiki>{{DIRECTIONMARK}}</nowiki>
| <code>{{DIRMARK}}</code><br /><code>{{DIRECTIONMARK}}</code>
| '''[MW1.7+]''' u+200E left to right or u+200D right to left mark
|-
| <nowiki>{{CONTENTLANGUAGE}}</nowiki>
| <code>{{CONTENTLANGUAGE}}</code>
| '''[MW1.7+]''' code of the site's default interface language ({{h:mwg|LanguageCode}})
|-
| <nowiki>{{DEFAULTSORT:xyz}}</nowiki>
| <nowiki>{{DEFAULTSORT:xyz}}</nowiki>
| '''[MW1.10+]''' Sets a default [[Help:Categories#Sort_key|category sort key]] for the whole current page (also applying for category tags before this tag)<ref>"[[w:Wikipedia:Wikipedia Signpost/2007-01-02/Technology report|Technology report]]", en-Wikipedia Signpost, January 2007</ref>.
|-
| <nowiki>#REDIRECT</nowiki>
| <code>#REDIRECT&#160;[&#91;target&#93;]</code><br />at top of source page
| Creates a [[Help:Redirect|redirect]] to another page.
|}{{-}}
 
==Notes and references==
<div style="font-size:0.9em;"><references/></div>
 
==Template modifiers==
{| border="2" cellpadding="4" cellspacing="0" style="margin: 1em 1em 1em 0; background: #f9f9f9; border: 1px #aaa solid; border-collapse: collapse;" width="75%"
{| border="2" cellpadding="4" cellspacing="0" style="margin: 1em 1em 1em 0; background: #f9f9f9; border: 1px #aaa solid; border-collapse: collapse;" width="75%"
! Word !! Usage !! Explanation
! Word !! Usage !! Explanation
Line 21: Line 383:
| If a template clashes with a MediaWiki:message, use of the INT: modifier will use the message instead of the template. Otherwise, the template is used.
| If a template clashes with a MediaWiki:message, use of the INT: modifier will use the message instead of the template. Otherwise, the template is used.
|}
|}
[[Category:Help]]


{{WikiDoc Help Menu}}
{{WikiDoc Help Menu}}
{{WikiDoc Sources}}
{{WikiDoc Sources}}
[[Category:Help]]

Latest revision as of 12:20, 2 September 2013

Editor-In-Chief: C. Michael Gibson, M.S., M.D. [1]

Overview

This is an organized index of Magic words used in MediaWiki. "XYZ" indicates user input, which is used in the example.

Table of contents

For details see Help:Section

Template:H:TOC variables

Other

Word Explanation
__NOEDITSECTION__ Hides the edit links beside headings.
__NEWSECTIONLINK__ [MW1.7+] Gives a "+"-link next to the edit-tab to make a new section on a non-talk page.
__NOCONTENTCONVERT__
__NOCC__
Don't perform the content language conversion (character and phase) in article display; for example, Chinese zh with zh_cn, zh_tw, zh_sg, zh_hk.
__NOGALLERY__ [MW1.7+] This magic word allows images in category pages to be displayed as inline links instead of gallery.
__NOTITLECONVERT__
__NOTC__
Like __NOCC__ but affecting article title only.
__END__ Allows for trailing whitespace to be included in the page save (does not seem to work anymore).
__START__ This magic word has no effect but an ID in MagicWord.php (MAG_START).


XML-style tags

nowiki: <nowiki>...</nowiki>, disables expansion/interpretation of templates, link syntax, formatting syntax, etc.:<nowiki>'''[[{{tc}}]]'''</nowiki> gives '''[[{{tc}}]]'''

noinclude: <noinclude>...</noinclude>, specifies text to appear or function calls to apply only on the transcluded page, not on the transcluding page. E.g. categorizing of a template itself (and not the transcluding page) would use this tag.

includeonly: <includeonly>...</includeonly>, specifies text to appear or function calls to apply only on the transcluding page, not on the transcluded page (which usually is a template). E.g. a template which categorizes pages where it's applied, but not the template itself, into a certain category.

onlyinclude: <onlyinclude>...</onlyinclude>, specifies text to appear or function calls to apply only on the transcluding page, not on the transcluded page. This tag is distinguished from the <includeonly> tag in that text or code on the transcluded page not enveloped by the tag will not be transcluded, whether or not the <noinclude> tag is in use.

pre: <pre>...</pre>, ditto, also for multiple lines; it is rendered with a new paragraph at the start and end: a<pre>'''[[{{tc}}]]'''</pre> gives a

'''[[{{tc}}]]'''

math: <math>...</math>, e.g. <math>\sqrt{a^2+b^2}</math> gives <math>\sqrt{a^2+b^2}</math>; see Help:Displaying a formula hiero: <hiero>...</hiero>, e.g. <hiero>A1</hiero> gives: <hiero>A1</hiero>

categorytree: <categorytree>...</categorytree> provides a dynamic view of the category structure specified as a tree.

Time

The time in UTC. Note that if the page was displayed by the same user and has not changed (has not been edited) since the last time it was displayed, it is possible that the page may be cached (by the user's browser) and the displayed time or date may not change. Also, if a heavily used page, rather than freshly rendered by the software each time it is generated, is instead being retrieved from a caching system (such as the main page on Wikipedia) the date or time may not change from the last time the page was originally retrieved by the caching hardware or software.

Word Example Explanation
{{CURRENTDAY}} 29 Displays the current day in numeric form.
{{CURRENTDAY2}} 29 [MW1.6+] Same as {{CURRENTDAY}}, but with leading zero (01 .. 31).
{{CURRENTDAYNAME}} Friday Name of the day in the language of the project or English.
{{CURRENTDOW}} 5 Same as {{CURRENTDAYNAME}}, but as a number (0=Sunday, 1=Monday...).
{{CURRENTMONTH}} 03 The number 01 .. 12 of the month.
{{CURRENTMONTHABBREV}} Mar [MW1.5+] Same as {{CURRENTMONTH}}, but in abbreviated form (Jan .. Dec).
{{CURRENTMONTHNAME}} March Same as {{CURRENTMONTH}}, but in named form (January .. December).
{{CURRENTTIME}} 14:20 The current time (00:00 .. 23:59).
{{CURRENTHOUR}} 14 The current hour (00 .. 23).
{{CURRENTMINUTE}} Template:CURRENTMINUTE The current minute (00 .. 59).
{{CURRENTSECOND}} Template:CURRENTSECOND The current second (00 .. 59).
{{CURRENTWEEK}} 13 Number of the current week (1-53) according to ISO 8601 with no leading zero.
{{CURRENTYEAR}} 2024 Returns the current year.
{{CURRENTTIMESTAMP}} 20240329142031 [MW1.7+] ISO 8601 time stamp.

Local time

The time depending on the local timezone of the wiki (not depending on the timezone in the user's preference settings). (All words [MW1.8+] )

Word Example Explanation
{{LOCALDAY}} 29 Displays the local day of the month in numeric form.
{{LOCALDAY2}} 29 Same as {{LOCALDAY}}, but with a leading zero (01 .. 31).
{{LOCALDAYNAME}} Friday Name of the day in the language of the project or English.
{{LOCALDOW}} 5 Same as {{LOCALDAYNAME}}, but as a number (0=Sunday, 1=Monday...).
{{LOCALMONTH}} 03 The number 01 .. 12 of the month.
{{LOCALMONTHABBREV}} Mar Same as {{LOCALMONTH}}, but in abbreviated form as Jan .. Dec.
{{LOCALMONTHNAME}} March Same as {{LOCALMONTH}}, but in named form as January .. December.
{{LOCALTIME}} 14:20 The local time (00:00 .. 23:59).
{{LOCALHOUR}} 14 The local hour (00 .. 23).
{{LOCALWEEK}} 13 Number of the local week (1-53) according to ISO 8601 with no leading zero.
{{LOCALYEAR}} 2024 Returns the local year.
{{LOCALTIMESTAMP}} 20240329142031 ISO 8601 time stamp.

Statistics

Statistics variables give thousands separators unless ":R" for "raw" is added (actually, these versions are parser functions).

Word Example Explanation
{{CURRENTVERSION}} 1.40.0 [MW1.7+] Template:H:mwg [2]
{{NUMBEROFEDITS}}
{{NUMBEROFEDITS:R}}
1,734,062
1734062
[MW1.10+ (r21319)] Returns the total number of page edits since MediaWiki, the software that runs this site, was installed.
{{NUMBEROFARTICLES}}
{{NUMBEROFARTICLES:R}}
140,819
140819
A variable which returns the total number of articles on the Wiki.
{{NUMBEROFPAGES}}
{{NUMBEROFPAGES:R}}
303,988
303988
[MW1.7+] Returns the total number of pages. [3]
{{NUMBEROFFILES}}
{{NUMBEROFFILES:R}}
74,479
74479
[MW1.5+] Returns the number of uploaded files (rows in the image table).
{{NUMBEROFUSERS}}
{{NUMBEROFUSERS:R}}
9,528
9528
[MW1.7+] Returns the number of registered users (rows in the user table).
{{NUMBEROFADMINS}}
{{NUMBEROFADMINS:R}}
98
98
[MW1.7+] Returns the number of administrators (users in the sysop group).
{{PAGESINNAMESPACE}}  disabled here Longer alias of PAGESINNS
{{PAGESINNS:ns}}
{{PAGESINNS:ns:R}}
{{PAGESINNS:2}} 
{{PAGESINNS:2:R}} 
disabled here
[MW1.7+] Returns the number of pages in the given namespace. Disabled by default, enable with Template:H:mwg.

Page names and related info

Parser functions

Not working at the position of the page where the tag is located but on the page header, and throughout the page, respectively (see below):

  • DISPLAYTITLE: allow the page header to be different from the page name.
  • DEFAULTSORT: Sets a default category sort key for the page.

Formatting

Word Example Explanation
{{#language:}} {{#language:da}} = dansk [MW1.7+] Native name of language code.
{{lc:}} {{lc:AbC dEf}} = abc def [MW1.5+] LowerCase
{{lcfirst:}} {{lcfirst:Ab Cd}} = ab Cd [MW1.5+] LC first char.
{{uc:}} {{uc:aBc DeF}} = ABC DEF [MW1.5+] UpperCase
{{ucfirst:}} {{ucfirst:aB cD}} = AB cD [MW1.5+] UC first char.
{{formatnum:}} {{formatnum:-299792458.56789}} = −299,792,458.56789 [MW1.7+] Add decimal separators according to the wiki's default locale. Leading minus and plus are recognized.
{{padleft:}}




{{padright:}}

{{padleft:7|3|0}} = 007

{{padleft:0|3|0}} = 000 (bug)

{{padleft:bcd|6|a}} = aaabcd
{{padleft:café|8|-}} = ----café(<==Bug effect)
{{padleft:cafe|8|-}} = ----cafe

{{padleft:bcd|6|{{!}}}} = |||bcd

{{padright:bcd|6|a}} = bcdaaa
{{padright:0|6|a}} = 0aaaaa (bug)


First case is, for example, applicable to years in a category... giving an ordered year to sort by pipetricks order, or any such ordering where left extended zeros allow a proper sorting.

[MW1.8+] Pads a string with a character to the specified width. Note that there's a little bug that interprets non-US-ASCII characters as two, instead of one character (see the difference in café and cafe in the examples.)

It does not seem possible to use padleft and padright for padding with characters with a multi-character code, such as &nbsp;, which would be useful with padleft for sorting tables with Javascript.

Padding "0" does not work, it returns the same. This seems to be a bug.[1]

With regard to #language and Template:Tim, see also:

Image modifiers

These are image modifiers used in [[Image:title.ext|modifier|...|modifier]] links. Some are mutually exclusive, and then the last specified wins.

Size

The last unrecognized modifier is used as caption for framed images or together with thumbnails. It's also used as description alt=text.

Word Usage Explanation
framed
frame
enframed
[[Image:Mediawiki.png|framed]] Places an image in a frame with a description. Uses original size and stubbornly ignores width parameter if given.
In general, far better to use thumb, as is only suitable for small images.
border [[Image:Mediawiki.png|border]] Shows a 1px border around the image.
thumbnail
thumb
[[Image:Mediawiki.png|thumbnail]] Modifies image size, sets it dependent on user's favorite thumbnail size in one's preferences, or on the given width parameter (see below).
thumb=xyz [[Image:Mediawiki.png|thumb=Wiki.png]] Manualthumb: instead of displaying an automatically-sized thumbnail for Mediawiki.png, display the image Wiki.png.
width px
100x200px
[[Image:Mediawiki.png|40px]]
[[Image:Mediawiki.png|100x200px]]
Scales image to given width  in pixels
Scales image to no more than 100 pixels wide and no more than 200 high, but image scaled to retain its true aspect ratio within the boundary specified.

Position

For details see Help:Images and other uploaded files

The positions are mutually exclusive; the last specified wins. Template:- can stop floating. For inline images only modifier px (see above) is supported.

Word Usage Explanation
right [[Image:Mediawiki.png|right]] Modifies position, floats the image to the right.
left [[Image:Mediawiki.png|left]] Modifies position, floats the image to the left.
none [[Image:Mediawiki.png|none]] Explicitly states that the image should not float.
center
centre
[[Image:Mediawiki.png|center]] Modifies position, like none but centered.

Miscellany

Word Example Explanation
{{DISPLAYTITLE:xyz}} [MW 1.7+] Set the page's title [4], enabled in Wikimedia projects since June 2007 ([5]). Also see Template:H:mwg.
{{DIRMARK}}
{{DIRECTIONMARK}}

[MW1.7+] u+200E left to right or u+200D right to left mark
{{CONTENTLANGUAGE}} en [MW1.7+] code of the site's default interface language (Template:H:mwg)
{{DEFAULTSORT:xyz}} {{DEFAULTSORT:xyz}} [MW1.10+] Sets a default category sort key for the whole current page (also applying for category tags before this tag)[2].
#REDIRECT #REDIRECT [[target]]
at top of source page
Creates a redirect to another page.

Notes and references

  1. Function pad in includes/CoreParserFunctions.php puts, oddly, the $string itself as a condition for the padding. To be reported as bug.
  2. "Technology report", en-Wikipedia Signpost, January 2007

Template modifiers

Word Usage Explanation
{{subst:}} {{subst:XYZ}} Substitutes the template call with the content of the template.
{{msg:}} {{msg:XYZ}} If a template clashes with a magic word, use of the msg: modifier will use the template instead of the magic word. Otherwise, the magic word is used.
{{msgnw:}} {{msgnw:XYZ}} The template message is pasted as unevaluated <nowiki> text.
{{INT:}} {{INT:XYZ}} If a template clashes with a MediaWiki:message, use of the INT: modifier will use the message instead of the template. Otherwise, the template is used.


Template:WikiDoc Sources