Difference between revisions of "Help:Magic words"
m (1 revision(s)) |
m (1 revision: Updating our Help Pages) |
||
(3 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | {{ | + | {{Notice|1= |
+ | See '''[[mw:Help:Magic words|Help:Magic words]] on [[mw:|www.mediawiki.org]]''' for more magic words in the MediaWiki software. The page here is currently kept for things not yet merged to www.mediawiki.org and for documentation specific to the Wikimedia Foundation. If something is missing from both pages, check the [//meta.wikimedia.org/w/index.php?title=Help:Magic_words&oldid=3392669 full version of this page] and restore the lacking information. | ||
+ | }} | ||
− | + | {{H:h|editor toc}} | |
− | + | This is an organized index of magic words used in MediaWiki. | |
− | |||
− | + | A "'''[[w:Magic (programming)|magic]] word'''" is a symbol recognized by the MediaWiki software and which when seen in the non-commented text of the page, triggers the software to do something other than display that symbol, or transclude a page with that name, but instead to use the symbol directly. | |
− | A | ||
− | + | A magic word can be: | |
− | + | * a behavior switch, called using an upper case word, preceded and followed by pairs of underscores, e.g. '''<nowiki>__NOTOC__</nowiki>''' | |
− | + | * [[Help:XML-style tags|XML-style tags]], preceded by "<" (and for the end tag "/") and followed by ">", as in '''<nowiki>'''...'''</nowiki>''' | |
− | + | * a [[help:parser function|parser function]]: similar to a template, a word preceded by the symbols "'''<nowiki>{{</nowiki>'''" and followed by "'''<nowiki>}}</nowiki>'''", and optionally parameter definitions between pipe characters, except that the part before the first pipe (or without pipes, the text between the braces) contains a colon ("''':'''"), e.g. <nowiki>{{</nowiki>'''ns:'''3}} and {{'''#ifexpr:'''<nowiki>{{{1}}}>3|large|small}}</nowiki> | |
− | + | * a [[help:variable|variable]]: similar to a template without parameters, a word preceded by the symbols "'''<nowiki>{{</nowiki>'''" and followed by "'''<nowiki>}}</nowiki>'''", except the word used is in all upper case, e.g. '''<nowiki>{{CURRENTDAY}}</nowiki>''' | |
− | + | * a template modifier | |
− | + | * an image modifier | |
− | + | ||
− | + | If a page in the template namespace has the same name as a magic word, the magic word will be invoked instead. If you discover you absolutely have to define a template with the same name as a magic word, prefix the name of the template with "'''msg:'''" or the name of the template namespace ("'''Template:'''"). See below for further details if you need this feature. | |
− | | | + | |
− | + | == Variables == | |
− | + | ||
− | + | :''For details see [[Help:Variable]]'' | |
− | | | + | |
− | + | === Page names and related info === | |
− | + | {{H:Page name variables}} | |
− | + | ||
− | + | == Template modifiers == | |
− | + | {| class="wikitable" border="2" cellpadding="4" cellspacing="0" | |
− | + | ! Usage | |
− | + | ! Explanation | |
− | |||
− | |||
− | |||
− | | | ||
− | | | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
|- | |- | ||
− | | <nowiki> | + | | <nowiki>{{:xyz}}</nowiki> |
− | | | + | | A bare colon is not a template modifier, it's the prefix for the main namespace. Test e.g. article {{:UTC}} vs. template {{UTC}}.<br>Using this syntax you include the text of the main namespace article xyz in another article. |
− | |||
|- | |- | ||
− | |{{ | + | | <nowiki>{{int:xyz}}</nowiki> |
+ | | Same as <nowiki>{{MediaWiki:xyz}}</nowiki>, except standard message translation is applied depending on subpages and content/user/uselang language. Another difference is: this doesn't appear under "{{int:templatesused}}". Rendered as {{int:xyz}} if [[MediaWiki:xyz]] doesn't exist. See also [[Help:System message]]. | ||
|- | |- | ||
− | | <nowiki> | + | | <nowiki>{{msg:xyz}}</nowiki> |
− | | | + | | Even if there is a magic word named "xyz", use template:xyz unless the template doesn't exist (equivalent to <nowiki>{{template:xyz}}</nowiki>). Normally, magic words have priority when there is a conflict. |
− | |||
− | |||
− | |||
− | |||
− | |||
|- | |- | ||
− | | | + | | <nowiki>{{msgnw:xyz}}</nowiki> |
− | | | + | | The unexpanded wikitext is rendered (more or less, for details see [[Help:Template#msgnw|msgnw]]). |
− | |||
|- | |- | ||
− | | | + | | <nowiki>{{raw:xyz}}</nowiki> |
− | | | + | | '''[MW1.6+]''' Equivalent to <code><nowiki>{{msg:xyz}}</nowiki></code> above<ref>[http://svn.wikimedia.org/viewvc/mediawiki?view=rev&revision=12925 Wikimedia SVN revision 12925]</ref>. |
− | |||
|- | |- | ||
− | | <nowiki> | + | | <nowiki>{{subst:xyz}}</nowiki> |
− | | | + | | In the wikitext, the tag is substituted by the ''content'' (single-level evaluation only), see [[Help:Substitution]]. |
− | |} | + | |}{{-}} |
− | == | + | == Image modifiers == |
− | |||
− | + | :''For details see [[w:en:Wikipedia:Extended image syntax]].'' | |
− | + | These are [[Help:Image page|image]] modifiers used in <code><nowiki>[[File:title.ext|modifier|...|modifier]]</nowiki></code> links. Some are mutually exclusive, and then the last specified wins. The last unrecognized modifier is used as '''caption''' for [[w:framed image|''framed'' images]] or together with ''[[w:thumbnail|thumbnail]]s''. It's also used as description <tt>alt=</tt>''text''. | |
− | |||
− | + | === Size === | |
− | {| | + | {| class="wikitable" border="2" cellpadding="4" cellspacing="0" |
+ | ! Word | ||
+ | ! Usage | ||
+ | ! Explanation | ||
|- | |- | ||
− | + | | framed <br/>frame <br/>enframed | |
− | + | | <code><nowiki>[[File:Mediawiki.png|framed]]</nowiki></code> | |
− | + | | 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 |
+ | | <code><nowiki>[[File:Mediawiki.png|border]]</nowiki></code> | ||
+ | | Shows a 1 pixel border around the image. | ||
|- | |- | ||
− | | <nowiki> | + | | thumbnail <br/>thumb |
− | | | + | | <code><nowiki>[[File:Mediawiki.png|thumbnail]]</nowiki></code> |
− | + | | Modifies image size, sets it dependent on user's favorite thumbnail size in one's preferences, or on the given width parameter (see hereafter). | |
− | |||
|- | |- | ||
− | | | + | | thumb=''xyz'' |
− | + | | <code><nowiki>[[File:Mediawiki.png|thumb=Wiki.png]]</nowiki></code> | |
− | | < | + | | Manual thumbnail: 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 | |
− | + | | <code><nowiki>[[File:Mediawiki.png|40px]]</nowiki></code> <br/><code><nowiki>[[File:Mediawiki.png|100x200px]]</nowiki></code> | |
− | + | | Scales image to given ''width''  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. | |
− | | <nowiki> | + | |}{{-}} |
− | | | + | |
− | + | === Position === | |
− | + | ||
− | + | :''For details see [[Help:Images and other uploaded files]].'' | |
− | + | ||
− | + | The positions are mutually exclusive; the last specified wins. [[Template:Clear]] can stop floating. For inline images only modifier ''px'' (see hereinbefore) is supported. | |
− | + | ||
− | + | {| class="wikitable" width="100%" | |
− | + | ! Word | |
− | + | ! Usage | |
− | + | ! Explanation | |
− | |||
− | |||
− | |- | ||
− | |||
− | | | ||
− | | <nowiki> | ||
− | |||
− | |||
− | |||
− | |||
− | | <nowiki> | ||
− | | | ||
− | |||
− | |||
− | |||
− | |||
− | | {{ | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | | | ||
− | |||
|- | |- | ||
− | | <nowiki> | + | | right |
− | | | + | | <code><nowiki>[[File:Mediawiki.png|right]]</nowiki></code> |
− | + | | Sets top of image to the right margin, text will flow from the left. | |
− | |||
|- | |- | ||
− | | <nowiki> | + | | <nowiki>left</nowiki> |
− | | | + | | <code><nowiki>[[File:Mediawiki.png|left]]</nowiki></code> |
− | | | + | | Sets top of image to the left margin, content text will flow from the right. |
− | | | ||
|- | |- | ||
− | | | + | | <nowiki>none</nowiki> |
+ | | <code><nowiki>[[File:Mediawiki.png|none]]</nowiki></code> | ||
+ | | Image will be alone at left, content text will not appear with image. | ||
|- | |- | ||
− | | < | + | | center <br />centre |
− | + | | <code><nowiki>[[File:Mediawiki.png|center]]</nowiki></code> | |
− | + | | Like ''none'' with image centered. | |
− | + | |}{{-}} | |
− | |||
− | | < | ||
− | |||
− | |||
− | | | ||
− | |} | ||
− | + | == Miscellany == | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | === | + | {| class="wikitable" border="2" cellpadding="4" cellspacing="0" |
− | + | ! Word | |
− | + | ! Example | |
+ | ! Explanation | ||
|- | |- | ||
− | + | | <nowiki>{{DISPLAYTITLE:</nowiki>''xyz''<nowiki>}}</nowiki> | |
− | + | | ''no inline output'' | |
− | + | | '''[MW 1.7+]''' Modify 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> | |
− | + | | '''[MW 1.7+]''' U+200E left-to-right or U+200D right-to-left mark. | |
− | | {{ | ||
− | |||
− | |||
− | |||
− | |||
− | | | ||
− | |||
− | |||
|- | |- | ||
| <nowiki>{{CONTENTLANGUAGE}}</nowiki> | | <nowiki>{{CONTENTLANGUAGE}}</nowiki> | ||
− | | {{CONTENTLANGUAGE}} | + | | <code>{{CONTENTLANGUAGE}}</code> |
− | | | + | | '''[MW 1.7+]''' Code of the site's default interface language ({{h:mwg|LanguageCode}}). |
− | |||
|- | |- | ||
− | + | | <nowiki>{{DEFAULTSORT:xyz}}</nowiki> | |
− | + | | ''no inline output'' | |
− | | <nowiki>{{ | + | | '''[MW 1.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]]", English Wikipedia Signpost, January 2007</ref>. |
− | | | ||
− | | | ||
− | |||
− | |- | ||
− | | | ||
− | |||
− | |||
− | |||
|- | |- | ||
− | | <nowiki> | + | | <nowiki>#REDIRECT</nowiki> |
− | | | + | | <code>#REDIRECT [[target]]</code><br />at top of source page |
− | + | | Creates a [[Help:Redirect|redirect]] to another page (to the target page). | |
− | + | |}{{-}} | |
− | |||
− | |||
− | | | ||
− | | | ||
− | |||
− | | | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | Despite its name <tt>MAGICNUMBER</tt> is no magic word, the [[m:Help:ISBN links|ISBN]] magic works only on the [[{{ns:4}}:{{int:Booksources}}|{{ns:8}}:Booksources]] page used by [[Special:Booksources]], but talking about <tt><nowiki>[[{{ns:4}}:{{int:Booksources}}|{{ns:8}}:Booksources]]</nowiki></tt> in a way working on any MediaWiki installation is esoteric enough to be noted here. | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |{{ | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | | {{ | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | === | + | ===Language-dependent word conversions=== |
− | ==== | + | {| class="wikitable" border="2" cellpadding="4" cellspacing="0" |
− | + | ! Word | |
+ | ! Example | ||
+ | ! Explanation | ||
|- | |- | ||
− | + | | <nowiki>{{CURRENTMONTHNAMEGEN}}</nowiki> | |
− | + | | <code>{{CURRENTMONTHNAMEGEN}}</code> | |
− | + | | [[w:genitive case|Genitive form]] of month name used for Czech, Polish, Ukrainian[http://svn.wikimedia.org/svnroot/mediawiki/trunk/phase3/languages/] | |
− | |||
− | |||
− | | <nowiki>{{ | ||
− | |||
− | |||
− | |||
− | |||
− | | < | ||
− | | | ||
− | | | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
|- | |- | ||
− | | <nowiki>{{ | + | | <nowiki>{{LOCALMONTHNAMEGEN}}</nowiki> |
− | | | + | | <code>{{LOCALMONTHNAMEGEN}}</code> |
− | + | | [[w:genitive case|Genitive form]] of month name used for Czech, Polish, Ukrainian (local time) | |
− | |||
|- | |- | ||
− | | | + | | {{grammar:''case | word'' }} |
− | | | + | | <nowiki>{{grammar:7sg|Wikipedie}}</nowiki><br />on [[:cs:]] is <code>Wikipedií</code>. |
− | + | | Derived word forms in inflected languages like [[:cs:|Czech]] [http://svn.wikimedia.org/svnroot/mediawiki/trunk/phase3/languages/classes/LanguageCs.php] | |
− | |||
|- | |- | ||
− | | | + | | {{plural:''count |form1 |form2'' }}<br />{{plural:''count |1st | 2nd | 3rd ''}} |
− | + | | <nowiki>{{plural: 2 | is | are }}</nowiki><br />outputs <code>{{plural: 2 | is |are }}</code><br /><nowiki>{{plural: 1 | this | these }}</nowiki><br />outputs <code>{{plural: 1 |this | these }}</code><br /><nowiki>{{plural: 0 | his | their }}</nowiki><br />outputs <code>{{plural: 0 |his | their }}</code> | |
− | | | + | | ''count'' '''1''' yields ''form1'' (singular), [[w:Plural|plural]] transformations are used for languages like [[:ru:|Russian]] [http://svn.wikimedia.org/svnroot/mediawiki/trunk/phase3/languages/classes/LanguageRu.php] based on "count mod 10". |
− | + | |}{{-}} | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | | | ||
− | | {{ | ||
− | |||
− | + | "Grammar" and "Plural" are language-dependent functions, defined in [http://svn.wikimedia.org/svnroot/mediawiki/trunk/phase3/languages/classes/LanguageCs.php], [http://svn.wikimedia.org/svnroot/mediawiki/trunk/phase3/languages/classes/LanguageRu.php], etc. (note that in PHP, the modulo operator is the percent sign). | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | "Grammar" can either be applied to predefined words only, or to arbitrary words, depending on whether the definition is just a 2D array, or involves string manipulations. See also [[:cs:Šablona:Wikivar/GRAMMAR]]. | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | "Plural" is a site-language-dependent switch function, controlled by function convertPlural in Language.php (which distinguishes between 1 and "not 1"), for some languages overridden in Languagexx.php, e.g. for French (which distinguishes between <=1 and >1) and Russian, which uses a grammar case for amounts ending in 1 (1, 21, 31,...), another case for amounts ending in 2 to 4 (2, 3, 4, 22, 23, 24, ...) and still another case for the remaining quantities. | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | As opposed to [[ParserFunctions]], "plural" accepts points and commas in numbers and interprets them in a site-language-specific way (depending on $separatorTransformTable in Messagesxx.php); on this site: | |
− | * <nowiki>{{ | + | *<nowiki>{{plural:1.000|a|b|c}}</nowiki> gives {{plural:1.000|a|b|c}} |
− | * <nowiki>{{ | + | *<nowiki>{{plural:1,000|a|b|c}}</nowiki> gives {{plural:1,000|a|b|c}} |
− | |||
− | + | (on e.g. the German and the Dutch sites reversed w.r.t. the result on English sites). | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | "Plural" is used in various system messages, e.g. {{msg|nmembers}}, where it uses interface language instead of site language. | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | == | + | == See also == |
− | + | * [[mw:Help:Extension:ParserFunctions|ParserFunctions]] '''#expr:''', '''#if:''', '''#ifeq:''', etc. | |
− | + | * [[mw:Manual:Magic words]] | |
− | + | * [http://svn.wikimedia.org/svnroot/mediawiki/trunk/phase3/languages/Language.php Source for Language.php] | |
− | + | * [http://svn.wikimedia.org/svnroot/mediawiki/trunk/phase3/includes/MagicWord.php Source for MagicWord.php] | |
− | + | * [[m:Extending_wiki_markup#Parser_functions|Adding parser functions]] | |
− | + | * [[mw:Extension:Variables]]'' : MediaWiki extension to add new magic words'' | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | {{ | + | ==Notes and references== |
+ | <div style="font-size:0.9em;"><references/></div> | ||
+ | {{H:f|enname=Magic words}} | ||
− | [[Category: | + | [[Category:Editor handbook]] |
− | |||
− |
Latest revision as of 22:02, 10 October 2013
MediaWiki Handbook: Contents, Readers, Editors, Moderators, System admins +/- |
This is an organized index of magic words used in MediaWiki.
A "magic word" is a symbol recognized by the MediaWiki software and which when seen in the non-commented text of the page, triggers the software to do something other than display that symbol, or transclude a page with that name, but instead to use the symbol directly.
A magic word can be:
- a behavior switch, called using an upper case word, preceded and followed by pairs of underscores, e.g. __NOTOC__
- XML-style tags, preceded by "<" (and for the end tag "/") and followed by ">", as in <nowiki>...</nowiki>
- a parser function: similar to a template, a word preceded by the symbols "{{" and followed by "}}", and optionally parameter definitions between pipe characters, except that the part before the first pipe (or without pipes, the text between the braces) contains a colon (":"), e.g. {{ns:3}} and {{#ifexpr:{{{1}}}>3|large|small}}
- a variable: similar to a template without parameters, a word preceded by the symbols "{{" and followed by "}}", except the word used is in all upper case, e.g. {{CURRENTDAY}}
- a template modifier
- an image modifier
If a page in the template namespace has the same name as a magic word, the magic word will be invoked instead. If you discover you absolutely have to define a template with the same name as a magic word, prefix the name of the template with "msg:" or the name of the template namespace ("Template:"). See below for further details if you need this feature.
Contents
Variables
- For details see Help:Variable
Word | Example | Explanation | |
---|---|---|---|
This page | "User:Anonymous user/sandbox/my page " page
| ||
"User talk:Anonymous user/sandbox/my page " page
| |||
{{PAGENAME}} | Magic words
|
Anonymous user/sandbox/my page
|
Returns the name of the current page, including all levels (Title/Subtitle). This does not include the name of the namespace. |
{{PAGENAMEE}} | Magic_words
|
Anonymous_user/sandbox/my_page
|
More URL-friendly percent encoded special characters (to use an article name in an external link). |
{{BASEPAGENAME}} {{BASEPAGENAMEE}} |
Magic words
|
Anonymous user/sandbox
|
[MW 1.7+] The basename of a subpage ("Title/Other" on "Title/Other/Subtitle"), see Help:Link. |
{{SUBPAGENAME}} {{SUBPAGENAMEE}} |
Magic words
|
my page
|
[MW 1.6+] Name of the current page, excluding parent pages ("Subtitle" on "Title/Other/Subtitle") in namespaces supporting subpages, see Help:Link. |
{{NAMESPACE}} {{NAMESPACEE}} |
Help
|
User
|
Returns the name of the namespace the current page resides in. Note that this returns an empty string for the main (article) space. |
User talk
| |||
{{FULLPAGENAME}} {{FULLPAGENAMEE}} |
Help:Magic words
|
User:Anonymous user/sandbox/my page
|
[MW 1.6+] Shorthands for NAMESPACE+PAGENAME. |
User talk:Anonymous user/sandbox/my page
| |||
{{TALKSPACE}} {{TALKSPACEE}} |
Help talk
|
User talk
|
[MW 1.7+] Name of next odd namespace (e.g. 4 ⇒ 5). |
{{SUBJECTSPACE}} {{SUBJECTSPACEE}} |
Help
|
User
|
[MW 1.7+] Name of last even namespace (e.g. 5 ⇒ 4). |
{{ARTICLESPACE}} {{ARTICLESPACEE}} |
Help
|
User
|
[MW 1.7+] An alias for SUBJECTSPACE(E). |
{{TALKPAGENAME}} {{TALKPAGENAMEE}} |
Help talk:Magic words
|
User talk:Anonymous user/sandbox/my page
|
[MW 1.7+] FULLPAGENAME in its TALKSPACE. |
{{SUBJECTPAGENAME}} {{SUBJECTPAGENAMEE}} |
Help:Magic words
|
User:Anonymous user/sandbox/my page
|
[MW 1.7+] FULLPAGENAME in its SUBJECTSPACE. |
{{ARTICLEPAGENAME}} {{ARTICLEPAGENAMEE}} |
Help:Magic words
|
User:Anonymous user/sandbox/my page
|
[MW 1.7+] An alias for SUBJECTPAGENAME(E). |
{{REVISIONID}} | 71975
|
N/A | [MW 1.5+] The unique identifying number of a page, see Help:Diff. Note that when editing a page, this value is null. |
{{REVISIONDAY}} | 10
|
N/A | [MW 1.8+] The day on which the page was last modified. |
{{REVISIONDAY2}} | 10
|
N/A | [MW 1.8+] The day on which the page was last modified, but with a leading zero (01 … 31). |
{{REVISIONMONTH}} | 10
|
N/A | [MW 1.8+] The month in which the page was last modified. |
{{REVISIONYEAR}} | 2013
|
N/A | [MW 1.8+] The year in which the page was last modified. |
{{REVISIONTIMESTAMP}} | 20131010220200
|
N/A | [MW 1.8+] ISO 8601 time stamp, indicating when the page was last modified. |
{{SITENAME}} | SacredWiki
|
Value of $wgSitename. | |
{{SERVER}} | https://www.sacredwiki.org | Value of $wgServer. | |
{{SCRIPTPATH}} |
|
[MW 1.5+] $wgScriptPath. | |
{{SERVERNAME}} | www.sacredwiki.org
|
[MW 1.5+] $wgServerName. |
Template modifiers
Usage | Explanation |
---|---|
{{:xyz}} | A bare colon is not a template modifier, it's the prefix for the main namespace. Test e.g. article {{:UTC}} vs. template {{UTC}}. Using this syntax you include the text of the main namespace article xyz in another article. |
{{int:xyz}} | Same as {{MediaWiki:xyz}}, except standard message translation is applied depending on subpages and content/user/uselang language. Another difference is: this doesn't appear under "Templates used on this page:". Rendered as ⧼xyz⧽ if MediaWiki:xyz doesn't exist. See also Help:System message. |
{{msg:xyz}} | Even if there is a magic word named "xyz", use template:xyz unless the template doesn't exist (equivalent to {{template:xyz}}). Normally, magic words have priority when there is a conflict. |
{{msgnw:xyz}} | The unexpanded wikitext is rendered (more or less, for details see msgnw). |
{{raw:xyz}} | [MW1.6+] Equivalent to {{msg:xyz}} above<ref>Wikimedia SVN revision 12925</ref>.
|
{{subst:xyz}} | In the wikitext, the tag is substituted by the content (single-level evaluation only), see Help:Substitution. |
Image modifiers
- For details see w:en:Wikipedia:Extended image syntax.
These are image modifiers used in [[File:title.ext|modifier|...|modifier]]
links. Some are mutually exclusive, and then the last specified wins. The last unrecognized modifier is used as caption for framed images or together with thumbnails. It's also used as description alt=text.
Size
Word | Usage | Explanation |
---|---|---|
framed frame enframed |
[[File: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 | [[File:Mediawiki.png|border]]
|
Shows a 1 pixel border around the image. |
thumbnail thumb |
[[File: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 hereafter). |
thumb=xyz | [[File:Mediawiki.png|thumb=Wiki.png]]
|
Manual thumbnail: instead of displaying an automatically-sized thumbnail for Mediawiki.png, display the image Wiki.png. |
width px 100x200px |
[[File:Mediawiki.png|40px]] [[File: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:Clear can stop floating. For inline images only modifier px (see hereinbefore) is supported.
Word | Usage | Explanation |
---|---|---|
right | [[File:Mediawiki.png|right]]
|
Sets top of image to the right margin, text will flow from the left. |
left | [[File:Mediawiki.png|left]]
|
Sets top of image to the left margin, content text will flow from the right. |
none | [[File:Mediawiki.png|none]]
|
Image will be alone at left, content text will not appear with image. |
center centre |
[[File:Mediawiki.png|center]]
|
Like none with image centered. |
Miscellany
Word | Example | Explanation |
---|---|---|
{{DISPLAYTITLE:xyz}} | no inline output | [MW 1.7+] Modify the page's title [1], enabled in Wikimedia projects since June 2007 ([2]). Also see $wgAllowDisplayTitle. |
{{DIRMARK}} {{DIRECTIONMARK}} |
|
[MW 1.7+] U+200E left-to-right or U+200D right-to-left mark. |
{{CONTENTLANGUAGE}} | en
|
[MW 1.7+] Code of the site's default interface language ($wgLanguageCode). |
{{DEFAULTSORT:xyz}} | no inline output | [MW 1.10+] Sets a default category sort key for the whole current page (also applying for category tags before this tag)<ref>"Technology report", English Wikipedia Signpost, January 2007</ref>. |
#REDIRECT | #REDIRECT [[target]] at top of source page |
Creates a redirect to another page (to the target page). |
Despite its name MAGICNUMBER is no magic word, the ISBN magic works only on the MediaWiki:Booksources page used by Special:Booksources, but talking about [[{{ns:4}}:{{int:Booksources}}|{{ns:8}}:Booksources]] in a way working on any MediaWiki installation is esoteric enough to be noted here.
Language-dependent word conversions
Word | Example | Explanation |
---|---|---|
{{CURRENTMONTHNAMEGEN}} | November
|
Genitive form of month name used for Czech, Polish, Ukrainian[3] |
{{LOCALMONTHNAMEGEN}} | November
|
Genitive form of month name used for Czech, Polish, Ukrainian (local time) |
{{grammar:case | word }} | {{grammar:7sg|Wikipedie}} on cs: is Wikipedií .
|
Derived word forms in inflected languages like Czech [4] |
{{plural:count |form1 |form2 }} {{plural:count |1st | 2nd | 3rd }} |
{{plural: 2 | is | are }} outputs are {{plural: 1 | this | these }} outputs this {{plural: 0 | his | their }} outputs their
|
count 1 yields form1 (singular), plural transformations are used for languages like Russian [5] based on "count mod 10". |
"Grammar" and "Plural" are language-dependent functions, defined in [6], [7], etc. (note that in PHP, the modulo operator is the percent sign).
"Grammar" can either be applied to predefined words only, or to arbitrary words, depending on whether the definition is just a 2D array, or involves string manipulations. See also cs:Šablona:Wikivar/GRAMMAR.
"Plural" is a site-language-dependent switch function, controlled by function convertPlural in Language.php (which distinguishes between 1 and "not 1"), for some languages overridden in Languagexx.php, e.g. for French (which distinguishes between <=1 and >1) and Russian, which uses a grammar case for amounts ending in 1 (1, 21, 31,...), another case for amounts ending in 2 to 4 (2, 3, 4, 22, 23, 24, ...) and still another case for the remaining quantities.
As opposed to ParserFunctions, "plural" accepts points and commas in numbers and interprets them in a site-language-specific way (depending on $separatorTransformTable in Messagesxx.php); on this site:
- {{plural:1.000|a|b|c}} gives a
- {{plural:1,000|a|b|c}} gives b
(on e.g. the German and the Dutch sites reversed w.r.t. the result on English sites).
"Plural" is used in various system messages, e.g. message with id 'nmembers' (talk), where it uses interface language instead of site language.
See also
- ParserFunctions #expr:, #if:, #ifeq:, etc.
- mw:Manual:Magic words
- Source for Language.php
- Source for MagicWord.php
- Adding parser functions
- mw:Extension:Variables : MediaWiki extension to add new magic words
Notes and references
Links to other help pages
- Help contents
- Meta · Wikinews · Wikipedia · Wikiquote · Wiktionary · Commons: · mw: · b: · s: · mw:Manual · Google
- Versions of this help page (for other languages see further)
- Meta · Wikinews · Wikipedia · Wikiquote · Wiktionary
- What links here on Meta or from Meta · Wikipedia · MediaWiki
- Reading
- Go · Search · Stop words · Namespace · Page name · Section · Backlinks · Redirect · Category · Image page · Special pages · Printable version
- Tracking changes
- Recent changes (enhanced) | Related changes · Watching pages · Diff · Page history · Edit summary · User contributions · Minor edit · Patrolled edit
- Logging in and preferences
- Logging in · Preferences · User style
- Editing
- Starting a new page · Advanced editing · Editing FAQ · Edit toolbar · Export · Import · Shortcuts · Edit conflict · Page size
- Referencing
- Links · URLs · Piped links · Interwiki linking · Footnotes
- Style and formatting
- Wikitext examples · CSS · Reference card · HTML in wikitext · Formula · List · Table · Sorting · Colors · Images and file uploads
- Fixing mistakes
- Show preview · Testing · Reverting edits
- Advanced functioning
- Expansion · Template · Advanced templates · Parser function · Parameter default · Variable · System message · Substitution · Array · Calculation · Embed page
- Others
- Special characters · Renaming (moving) a page · Talk page · Signatures · Sandbox · Legal issues for editors