Help page: Edit

Editing Help:Magic words

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.

Latest revision Your text
Line 1: Line 1:
 
{{pp-vandalism|small=yes}}
 
{{pp-vandalism|small=yes}}
{{redirect|H:MW|the MediaWiki namespace|Help:MediaWiki namespace|information about the entire MediaWiki software application|w:MediaWiki}}
+
{{for|an introduction|Help:Magic words for beginners}}
 
{{BattleTechWiki how-to|H:MW|BTW:MAGIC|BTW:MAGICWORD|BTW:MAGICWORDS}}
 
{{BattleTechWiki how-to|H:MW|BTW:MAGIC|BTW:MAGICWORD|BTW:MAGICWORDS}}
  
'''Magic words''' (including '''parser functions''', '''variables''' and '''behavior switches''') are features of [[Help:Wiki markup|wiki markup]] that give instructions to BattleTechWiki's underlying [[w:MediaWiki|MediaWiki]] software. For example, magic words can suppress or position the table of contents, disable indexing by external search engines, and produce output dynamically based on the current page or on user-defined conditional logic. Some of these features are especially useful for [[BattleTechWiki:Templates|templates]].
+
'''Magic words''' (including '''parser functions''', '''variables''' and '''behavior switches''') are features of [[Help:Wiki markup|wiki markup]] that give instructions to BattleTechWiki's underlying [[MediaWiki]] software. For example, magic words can suppress or position the table of contents, disable indexing by external search engines, and produce output dynamically based on the current page or on user-defined conditional logic. Some of these features are especially useful for [[BTW:Templates|templates]].
  
 
This page is a quick reference for magic words. For more information, refer to the main MediaWiki documentation:
 
This page is a quick reference for magic words. For more information, refer to the main MediaWiki documentation:
Line 17: Line 17:
  
 
The software generally interprets magic words in the following way:
 
The software generally interprets magic words in the following way:
* Magic words are [[w:case sensitive|case sensitive]].
+
* Magic words are [[case sensitive]].
* [[w:Whitespace character|White space]] is generously allowed for readability. It will be stripped from the start and end of their keywords and parameters (as is also done in template calls using named parameters).
+
* [[Whitespace character|White space]] is generously allowed for readability. It will be stripped from the start and end of their keywords and parameters (as is also done in template calls using named parameters).
* They can be [[BattleTechWiki:Transclusion|transcluded]], even variables "about the current page". This is ensured by the parsing order.
+
* They can be [[BTW:Transclusion|transcluded]], even variables "about the current page". This is ensured by the parsing order.
 
* Instead of magically transforming into HTML instructions, {{tag|[[help:wikitext#Nowiki|nowiki]]|o}} tags remove this magic so a magic word can itself be displayed (documented), e.g. <code><nowiki><nowiki>{{#magic:}}</nowiki></nowiki></code>or <code><nowiki>{{#magic:<nowiki/>}}</nowiki></code>.
 
* Instead of magically transforming into HTML instructions, {{tag|[[help:wikitext#Nowiki|nowiki]]|o}} tags remove this magic so a magic word can itself be displayed (documented), e.g. <code><nowiki><nowiki>{{#magic:}}</nowiki></nowiki></code>or <code><nowiki>{{#magic:<nowiki/>}}</nowiki></code>.
  
 
Magic words compared to templates:
 
Magic words compared to templates:
 
* As with templates, magic words can be [[help:transclusion|transcluded]] and [[Help:substitution|substituted]].
 
* As with templates, magic words can be [[help:transclusion|transcluded]] and [[Help:substitution|substituted]].
* The names of magic words are purposely chosen to be unlike the names of templates, and vice versa. Many parser function names will begin with a <code>#</code>([[w:Hash (character)|pound or hash]]), but template names will not start with a <code>#</code>, and probably not end in a <code>:</code>(colon), or be all-uppercase.
+
* The names of magic words are purposely chosen to be unlike the names of templates, and vice versa. Many parser function names will begin with a <code>#</code>([[Hash (character)|pound or hash]]), but template names [[wp:NCHASHTAG | will not start with a <code>#</code>]], and probably not end in a <code>:</code>(colon), or be all-uppercase.
 
* The first parameter's syntax differs. In <code>{{#magic: <nowiki/>p1 | p2 | p3}}</code>, the name is <code>#magic</code>and it is followed by an unspaced <code>:</code>and a required input parameter, <code>p1</code>. With a template, <code>p1</code>is optional and it is preceded by a <code>|</code>(pipe) instead of a <code>:</code>, e.g. <code>{{template<nowiki/>|p1}}</code>.
 
* The first parameter's syntax differs. In <code>{{#magic: <nowiki/>p1 | p2 | p3}}</code>, the name is <code>#magic</code>and it is followed by an unspaced <code>:</code>and a required input parameter, <code>p1</code>. With a template, <code>p1</code>is optional and it is preceded by a <code>|</code>(pipe) instead of a <code>:</code>, e.g. <code>{{template<nowiki/>|p1}}</code>.
  
Line 34: Line 34:
 
|-
 
|-
 
! scope=row id=TOC | <kbd><nowiki>__TOC__</nowiki></kbd>
 
! scope=row id=TOC | <kbd><nowiki>__TOC__</nowiki></kbd>
| Places the page's [[Help:Table of contents|table of contents (TOC)]] at the word's position. This magic word does not work in skins that present the table of contents outside the article content e.g. the default Vector 2022 skin.  
+
| Places the page's [[Help:Table of contents|table of contents (TOC)]] at the word's position.
 
|-
 
|-
 
! scope=row id=FORCETOC | <kbd><nowiki>__FORCETOC__</nowiki></kbd>
 
! scope=row id=FORCETOC | <kbd><nowiki>__FORCETOC__</nowiki></kbd>
| Forces the TOC to appear in its default position, even when there are fewer than four headings. Can be used anywhere on a page. This magic word does not work in skins that present the table of contents outside the article content e.g. the default Vector 2022 skin.
+
| Forces the TOC to appear in its default position, even when there are fewer than four headings. Can be used anywhere on a page.
 
|-
 
|-
 
! scope=row id=NOTOC | <kbd><nowiki>__NOTOC__</nowiki></kbd>
 
! scope=row id=NOTOC | <kbd><nowiki>__NOTOC__</nowiki></kbd>
Line 43: Line 43:
 
|-
 
|-
 
! scope=row id=NOEDITSECTION | <kbd><nowiki>__NOEDITSECTION__</nowiki></kbd>
 
! scope=row id=NOEDITSECTION | <kbd><nowiki>__NOEDITSECTION__</nowiki></kbd>
| 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 [[w:HTML element|HTML tag]] such as {{tag|h2|content=''heading''}} rather than with the usual wiki equals-signs syntax (e.g. {{nowrap|1=<kbd>== ''heading'' ==</kbd>}}{{thinsp}}).
+
| 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 element|HTML tag]] such as {{tag|h2|content=''heading''}} rather than with the usual wiki equals-signs syntax (e.g. {{nowrap|1=<kbd>== ''heading'' ==</kbd>}}{{thinsp}}).
 
|-
 
|-
 
! scope=row id=ARCHIVEDTALK | <kbd><nowiki>__ARCHIVEDTALK__</nowiki></kbd>
 
! scope=row id=ARCHIVEDTALK | <kbd><nowiki>__ARCHIVEDTALK__</nowiki></kbd>
Line 58: Line 58:
 
|-
 
|-
 
! scope=row id=HIDDENCAT | <kbd><nowiki>__HIDDENCAT__</nowiki></kbd>
 
! scope=row id=HIDDENCAT | <kbd><nowiki>__HIDDENCAT__</nowiki></kbd>
| Makes a category hidden when included on that category's page.
+
| Makes a category [[BTW:HIDDENCAT|hidden]] when included on that category's page.
 
|-
 
|-
 
! scope=row id=INDEX | <kbd><nowiki>__INDEX__</nowiki></kbd>
 
! scope=row id=INDEX | <kbd><nowiki>__INDEX__</nowiki></kbd>
| Instructs [[w:Web search engine|search engine]]s to index the page.
+
| Instructs [[Web search engine|search engine]]s to index the page.
 
|-
 
|-
 
! scope=row id=NOINDEX | <kbd><nowiki>__NOINDEX__</nowiki></kbd>
 
! scope=row id=NOINDEX | <kbd><nowiki>__NOINDEX__</nowiki></kbd>
Line 73: Line 73:
 
|-
 
|-
 
! scope=row id=DISPLAYTITLE | <kbd>{<nowiki/>{DISPLAYTITLE:''title''}}</kbd>
 
! scope=row id=DISPLAYTITLE | <kbd>{<nowiki/>{DISPLAYTITLE:''title''}}</kbd>
| Used to amend the displayed form of the page's title.
+
| Used to amend the [[BTW:DISPLAYTITLE|displayed form]] of the page's title.
 
|-
 
|-
 
! scope=row id=DEFAULTSORT | <kbd>{<nowiki/>{DEFAULTSORT:''sortkey''}}</kbd>
 
! scope=row id=DEFAULTSORT | <kbd>{<nowiki/>{DEFAULTSORT:''sortkey''}}</kbd>
| Sets the default [[Help:Category#Sorting category pages|key]] (the index) under which the page is categorised.
+
| Sets the default [[BTW:SORTKEY|key]] (the index) under which the page is categorized.
 +
|-
 +
! scope=row id=NOEXTERNALLANGLINKS | <kbd>[[mw:Extension:Wikibase Client#noexternallanglinks|{<nowiki/>{NOEXTERNALLANGLINKS}}]]</kbd>
 +
|| (equivalent to {<nowiki/>{NOEXTERNALLANGLINKS|*}}{{thinsp}}) Suppresses the automated inclusion of [[Wikidata:Help:Linking BattleTechWiki pages|Wikidata]] [[Help:Interlanguage links|interlanguage links]] on the lefthand side of the page. Links to particular rather than all languages may be suppressed by using {<nowiki/>{NOEXTERNALLANGLINKS|''list''}}, where ''list'' a [[Vertical bar|pipe]]-[[Delimiter|delimited]] list of [[language code]]s (e.g. {<nowiki/>{NOEXTERNALLANGLINKS|fr{{pipe}}es{{pipe}}ja}} to suppress the French ("fr"), Spanish ("es") and Japanese ("ja") interlanguage links).
 
|}
 
|}
  
 
==Variables==
 
==Variables==
 +
 
{{Shortcut|BTW:VAR}}
 
{{Shortcut|BTW:VAR}}
{{Further|mw:Help:Magic words#Variables}}
+
{{further|mw:Help:Magic words#Variables|BattleTechWiki:Page name#sub}}
 +
{{redirect|BTW:PAGENAME|the article naming policy|BattleTechWiki:Article titles}}
  
 
{| class="wikitable plainrowheaders"
 
{| class="wikitable plainrowheaders"
Line 104: Line 109:
 
| Title of topmost parent (before all subpages), excluding namespace.
 
| Title of topmost parent (before all subpages), excluding namespace.
 
|-
 
|-
! scope=row | <kbd>{<nowiki/>{SUBPAGENAME}}</kbd>
+
! scope=row | <kbd>[[wp:pagename#sub|{<nowiki/>{SUBPAGENAME}}]]</kbd>
 
| {{SUBPAGENAME}}
 
| {{SUBPAGENAME}}
| On a subpage, rightmost portion of ''current'' title; higher subpagenames show as [[w:Breadcrumb navigation|backlinks]].
+
| On a subpage, rightmost portion of ''current'' title; higher subpagenames show as [[Breadcrumb navigation|backlinks]].
 
|-
 
|-
 
! scope=row id=ARTICLEPAGENAME | <kbd>{<nowiki/>{ARTICLEPAGENAME}}</kbd>
 
! scope=row id=ARTICLEPAGENAME | <kbd>{<nowiki/>{ARTICLEPAGENAME}}</kbd>
Line 140: Line 145:
 
! scope=row id=FULLPAGENAMEE | {{longitem|style=line-height:1.5em|<kbd>{<nowiki/>{FULLPAGENAMEE}<nowiki/>}</kbd>,<br /><kbd>{<nowiki/>{PAGENAMEE}<nowiki/>}</kbd>,<br />{{pad|0.4em}}(etc.)}}
 
! scope=row id=FULLPAGENAMEE | {{longitem|style=line-height:1.5em|<kbd>{<nowiki/>{FULLPAGENAMEE}<nowiki/>}</kbd>,<br /><kbd>{<nowiki/>{PAGENAMEE}<nowiki/>}</kbd>,<br />{{pad|0.4em}}(etc.)}}
 
| {{longitem|style=line-height:1.5em|{{FULLPAGENAMEE}},<br/>{{PAGENAMEE}},<br/>(etc.)}}
 
| {{longitem|style=line-height:1.5em|{{FULLPAGENAMEE}},<br/>{{PAGENAMEE}},<br/>(etc.)}}
| 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).
+
| Adding an E to the end of the above variables, renders the above encoded for use in MediaWiki [[URL]]s (i.e. with underscores replacing spaces).
 +
|-
 +
! scope=row id=SHORTDESC | <kbd>{<nowiki/>{SHORTDESC}}</kbd>
 +
| <!-- do not invoke this magic word here: shows nothing and places page in error-tracking category -->
 +
| Only works on the English BattleTechWiki, where it displays a short description below the article title on mobile platforms. {{crossref|printworthy=y|See [[BattleTechWiki:Short description]].}}
 
|}
 
|}
  
 
''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 (<kbd>:</kbd>) is used to pass the parameter, rather than a pipe (<kbd>{{!}}</kbd>) that is used in templates, like <kbd><nowiki>{{MAGICWORD:value}}</nowiki></kbd>. For example, <kbd><nowiki>{{TALKPAGENAME:BattleTechWiki:MOS}}</nowiki></kbd> returns <samp><nowiki>BattleTechWiki talk:MOS</nowiki></samp> on any page.
 
''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 (<kbd>:</kbd>) is used to pass the parameter, rather than a pipe (<kbd>{{!}}</kbd>) that is used in templates, like <kbd><nowiki>{{MAGICWORD:value}}</nowiki></kbd>. For example, <kbd><nowiki>{{TALKPAGENAME:BattleTechWiki:MOS}}</nowiki></kbd> returns <samp><nowiki>BattleTechWiki talk:MOS</nowiki></samp> on any page.
  
''Note:'' In the "Category" and "Category talk" namespaces, to wikilink (some) page name variables may require [[Help:link|prefixing a colon]] to avoid unwanted categorization.
+
''Note:'' In the "Category" and "Category talk" namespaces, to wikilink (some) page name variables may require [[help:link|prefixing a colon]] to avoid unwanted categorization.
  
 
{{crossref|printworthy=y|For more details on parser functions that relate to page names and namespaces, see: {{section link|meta:Help:Page name#Variables and parser functions}}.}}
 
{{crossref|printworthy=y|For more details on parser functions that relate to page names and namespaces, see: {{section link|meta:Help:Page name#Variables and parser functions}}.}}
Line 159: Line 168:
 
! scope=row id=SERVER | <kbd>{<nowiki/>{SERVER}}</kbd>
 
! scope=row id=SERVER | <kbd>{<nowiki/>{SERVER}}</kbd>
 
| {{SERVER}}
 
| {{SERVER}}
| Domain [[w:URL|URL]] ([[mw:Manual:$wgServer|$wgServer]]).
+
| Domain [[URL]] ([[mw:Manual:$wgServer|$wgServer]]).
 
|-
 
|-
 
! scope=row id=SERVERNAME | <kbd>{<nowiki/>{SERVERNAME}}</kbd>
 
! scope=row id=SERVERNAME | <kbd>{<nowiki/>{SERVERNAME}}</kbd>
Line 213: Line 222:
 
| {{LOCALMONTHABBREV}}
 
| {{LOCALMONTHABBREV}}
 
|-
 
|-
! scope=row id=CURRENTDAY | <kbd>{<nowiki/>{CURRENTDAY}}</kbd>{{efn|<kbd><nowiki>{{CURRENTDAY}}</nowiki></kbd>, <kbd><nowiki>{{LOCALDAY}}</nowiki></kbd> and <kbd><nowiki>{{REVISIONDAY}}</nowiki></kbd> return the day (e.g. "<samp>6</samp>"), whilst <kbd><nowiki>{{CURRENTDAY2}}</nowiki></kbd>, <kbd><nowiki>{{LOCALDAY2}}</nowiki></kbd> and <kbd><nowiki>{{REVISIONDAY2}}</nowiki></kbd> return the day with zero-padding (e.g. "<samp>06</samp>"). For all two-digit days (i.e. 10 to 31), these are the same.|name=daynote}}
+
! scope=row id=CURRENTDAY | <kbd>{<nowiki/>{CURRENTDAY}}</kbd>{{efn|<kbd><nowiki>{{CURRENTDAY}}</nowiki></kbd>, <kbd><nowiki>{{LOCALDAY}}</nowiki></kbd>and <kbd><nowiki>{{REVISIONDAY}}</nowiki></kbd>return the day (i.e. "6"), whilst <kbd><nowiki>{{CURRENTDAY2}}</nowiki></kbd>, <kbd><nowiki>{{LOCALDAY2}}</nowiki></kbd>and <kbd><nowiki>{{REVISIONDAY2}}</nowiki></kbd>return the day with zero-padding (i.e. "06"). For all two-digit days (i.e. 10 to 31), these are the same.|name=daynote}}
 
| {{CURRENTDAY}}
 
| {{CURRENTDAY}}
 
! scope=row id=LOCALDAY | <kbd>{<nowiki/>{LOCALDAY}}</kbd>{{efn|name=daynote}}
 
! scope=row id=LOCALDAY | <kbd>{<nowiki/>{LOCALDAY}}</kbd>{{efn|name=daynote}}
Line 319: Line 328:
 
|-
 
|-
 
! scope=row id=PAGEID | <kbd>{<nowiki/>{PAGEID}}</kbd>
 
! scope=row id=PAGEID | <kbd>{<nowiki/>{PAGEID}}</kbd>
| Unique page identifier number (for example, this page's ID is <samp>{{PAGEID}}</samp>).  
+
| Unique page identifier number (for example, this page's ID is <kbd>{{PAGEID}}</kbd>).  
 
|-
 
|-
 
! scope=row id=PAGESIZE | <kbd>{<nowiki/>{PAGESIZE:''fullpagename''}}</kbd>
 
! scope=row id=PAGESIZE | <kbd>{<nowiki/>{PAGESIZE:''fullpagename''}}</kbd>
| Size of named page in bytes (for example, this page is <samp>{{PAGESIZE:{{FULLPAGENAME}}}}</samp> bytes).
+
| Size of named page in bytes (for example, this page is <kbd>{{PAGESIZE:{{FULLPAGENAME}}}}</kbd> bytes).
 
|-
 
|-
 
! scope=row id=PROTECTIONLEVEL | <kbd>{<nowiki/>{PROTECTIONLEVEL:''action''{{pipe}}''fullpagename''}}</kbd>
 
! scope=row id=PROTECTIONLEVEL | <kbd>{<nowiki/>{PROTECTIONLEVEL:''action''{{pipe}}''fullpagename''}}</kbd>
Line 329: Line 338:
 
! scope=row id=PROTECTIONEXPIRY | <kbd>{<nowiki/>{PROTECTIONEXPIRY:''action''{{pipe}}''fullpagename''}}</kbd>
 
! scope=row id=PROTECTIONEXPIRY | <kbd>{<nowiki/>{PROTECTIONEXPIRY:''action''{{pipe}}''fullpagename''}}</kbd>
 
| [[BattleTechWiki:Protection policy|Protection expiry]] assigned to ''action'' ("edit", "move", etc.) on named page (this page's protection expiry is <kbd>{{PROTECTIONEXPIRY:edit|Help:Magic words}}</kbd>).
 
| [[BattleTechWiki:Protection policy|Protection expiry]] assigned to ''action'' ("edit", "move", etc.) on named page (this page's protection expiry is <kbd>{{PROTECTIONEXPIRY:edit|Help:Magic words}}</kbd>).
 +
|-
 +
! scope=row id=PENDINGCHANGELEVEL | <kbd>{<nowiki/>{PENDINGCHANGELEVEL:''fullpagename''}}</kbd>
 +
| Protection level for [[BTW:PC|pending changes]] on the named page (this page, which doesn't have one, is <kbd>{{PENDINGCHANGELEVEL}}</kbd>).
 
|-
 
|-
 
! scope=row id=PAGESINCATEGORY | <kbd>{<nowiki/>{PAGESINCATEGORY:''categoryname''}}</kbd>
 
! scope=row id=PAGESINCATEGORY | <kbd>{<nowiki/>{PAGESINCATEGORY:''categoryname''}}</kbd>
Line 336: Line 348:
 
| Number of users in the [[BattleTechWiki:User access levels|user group]] named ''groupname''.
 
| Number of users in the [[BattleTechWiki:User access levels|user group]] named ''groupname''.
 
|}
 
|}
Page IDs can be associated with articles via wikilinks.
+
Page IDs can be associated with articles via wikilinks (i.e. <code>[[Special:Redirect/page/3235121]]</code>goes to this page).
To output numbers without comma [[w:Delimiter|separator]]s (for example, as "123456789" rather than "123,456,789"), append the parameter <kbd>|R</kbd>.
+
To output numbers without comma [[Delimiter|separator]]s (for example, as "123456789" rather than "123,456,789"), append the parameter <kbd>|R</kbd>.
  
 
===Formatting===
 
===Formatting===
Line 361: Line 373:
 
|-
 
|-
 
! scope=row id=dateformat | <kbd>{<nowiki/>{#dateformat:''date''{{pipe}}''format''}}<br/>{<nowiki/>{#formatdate:''date''{{pipe}}''format''}}</kbd>
 
! scope=row id=dateformat | <kbd>{<nowiki/>{#dateformat:''date''{{pipe}}''format''}}<br/>{<nowiki/>{#formatdate:''date''{{pipe}}''format''}}</kbd>
| 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>[[w:ISO 8601|ISO 8601]]</code> formats, with the user's preference overriding the specified format.
+
| 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.
 
|-
 
|-
 
! scope=row id=padleft | <kbd>{<nowiki/>{padleft:''xyz''{{pipe}}''stringlength''}}<br/>{<nowiki/>{padright:''xyz''{{pipe}}''stringlength''}}<br><br>{<nowiki/>{padleft:''xyz''{{pipe}}''length''{{pipe}}''padstr''}}<br/>{<nowiki/>{padright:''xyz''{{pipe}}''length''{{pipe}}''padstr''}}</kbd>
 
! scope=row id=padleft | <kbd>{<nowiki/>{padleft:''xyz''{{pipe}}''stringlength''}}<br/>{<nowiki/>{padright:''xyz''{{pipe}}''stringlength''}}<br><br>{<nowiki/>{padleft:''xyz''{{pipe}}''length''{{pipe}}''padstr''}}<br/>{<nowiki/>{padright:''xyz''{{pipe}}''length''{{pipe}}''padstr''}}</kbd>
Line 370: Line 382:
 
|-
 
|-
 
! scope=row id=mwtime | <kbd>{<nowiki/>{#time:''format''{{pipe}}''object''}}</kbd><br/><kbd>{<nowiki/>{#timel:''format''{{pipe}}''object''}}<br><br>{<nowiki/>{#time:d F Y{{pipe}}''date''{{pipe}}''langcode''}}</kbd>
 
! scope=row id=mwtime | <kbd>{<nowiki/>{#time:''format''{{pipe}}''object''}}</kbd><br/><kbd>{<nowiki/>{#timel:''format''{{pipe}}''object''}}<br><br>{<nowiki/>{#time:d F Y{{pipe}}''date''{{pipe}}''langcode''}}</kbd>
| Used to format dates and times, for ISO format, dots or English month names. <kbd>#timel</kbd> is based on local time as defined for each wiki; for English Wikipedia, this is identical to <kbd>#time</kbd>.<br />The optional 3rd parameter is the output language code (French, German, Swedish: fr, de, sv, etc.). Example Finnish: <kbd><nowiki>{{#time:d F Y|June 30, 2016|fi}}</nowiki></kbd> shows: {{#time:d F Y|June 30, 2016|fi}} (June). ISO to German: <kbd><nowiki>{{#time:d. M Y|1987-10-31|de}}</nowiki></kbd> shows: {{#time:d. M Y|1987-10-31|de}}.<br />For format codes, see: [[mw:Help:Extension:ParserFunctions##time]]. Use the format <kbd><nowiki>{{#time: H:i, j F Y (e)|...}}</nowiki></kbd> to match the format used by timestamps in signatures.
+
| Used to format dates and times, for ISO format, dots or English month names. <kbd>#timel</kbd> is based on local time as defined for each wiki; for English BattleTechWiki, this is identical to <kbd>#time</kbd>.<br />The optional 3rd parameter is the output language code (French, German, Swedish: fr, de, sv, etc.). Example Finnish: <kbd><nowiki>{{#time:d F Y|June 30, 2016|fi}}</nowiki></kbd> shows: {{#time:d F Y|June 30, 2016|fi}} (June). ISO to German: <kbd><nowiki>{{#time:d. M Y|1987-10-31|de}}</nowiki></kbd> shows: {{#time:d. M Y|1987-10-31|de}}.<br />For format codes, see: [[mw:Help:Extension:ParserFunctions##time]]. Use the format <kbd><nowiki>{{#time: H:i, j F Y (e)|...}}</nowiki></kbd> to match the format used by timestamps in signatures.
 
|-
 
|-
 
! scope=row id=gender | <kbd>{<nowiki/>{gender:''user''{{pipe}}''m_out''{{pipe}}''f_out''{{pipe}}''u_out''}}</kbd>
 
! scope=row id=gender | <kbd>{<nowiki/>{gender:''user''{{pipe}}''m_out''{{pipe}}''f_out''{{pipe}}''u_out''}}</kbd>
| Outputs ''m_out'', ''f_out'' or ''u_out'' according to whether the gender specified in ''user''{{thinsp}}'s preferences is, respectively, male, female or unspecified. Other parameter permutations are available, see [[mw:Help:Magic words#gender]].
+
| Outputs ''m_out'', ''f_out'' or ''u_out'' according to whether the gender specified in ''user''{{thinsp}}'s preferences is, respectively, male, female or unspecified. Other parameter permutations are available, see [[mw:Help:Magic words#gender]] and [[translatewiki:Special:MyLanguage/Gender|translatewiki:Gender]].
 
|-
 
|-
! scope=row id=mwtag | <kbd>[[mw:Help:Magic words#Miscellaneous|{<nowiki/>{#tag:''tagname''{{pipe}}''content with magic''}}]]</kbd>
+
! scope=row id=mwtag | <kbd>[[mw:Help:Magic words#Miscellaneous|{<nowiki/>{#tag:''tag''{{pipe}}''content with magic''}}]]</kbd>
| Only way to [[w:eval|eval]]uate magic words ''inside a tag'', in order to generate <code>&lt;''tagname''>''magic''&lt;/''tagname''></code>. Also handles tag attributes. Details at [[mw:Help:Magic words#tag]].
+
| Only way to [[eval]]uate magic words ''inside a tag'', in order to generate <code>&lt;''tag''>''magic''&lt;/''tag''></code>. Also handles tag attributes.
 
|}
 
|}
  
Line 397: Line 409:
 
|-
 
|-
 
! scope=row id=urlencode | <kbd>{<nowiki/>{urlencode:''string''}}</kbd>
 
! scope=row id=urlencode | <kbd>{<nowiki/>{urlencode:''string''}}</kbd>
| Encodes ''string'' for use in URL query strings; <kbd>{{braces|urlencode:test string}}</kbd>, 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}}").
+
| [[w:WP:ENCODE|Encodes]] ''string'' for use in URL query strings; <kbd>{{braces|urlencode:test string}}</kbd>, 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}}").
 
|-
 
|-
 
! scope=row id=anchorencode | <kbd>{<nowiki/>{anchorencode:''string''}}</kbd>
 
! scope=row id=anchorencode | <kbd>{<nowiki/>{anchorencode:''string''}}</kbd>
| Input encoded for use in MediaWiki URL [[Help:Link#Section_linking_(anchors)|section anchor]]s.
+
| Input encoded for use in MediaWiki URL [[Help:Anchor|section anchor]]s.
 
|-
 
|-
 
! scope=row id=ns | <kbd>{<nowiki/>{ns:''n''}}</kbd>
 
! scope=row id=ns | <kbd>{<nowiki/>{ns:''n''}}</kbd>
Line 413: Line 425:
  
 
===Conditional===
 
===Conditional===
{{further|Help:Conditional expressions}}
+
{{further|w:Help:Conditional expressions}}
  
 
{| class="wikitable plainrowheaders"
 
{| class="wikitable plainrowheaders"
Line 420: Line 432:
 
|-
 
|-
 
! scope=row id=expr |<kbd>[[mw:Help:Extension:Parser functions##expr|{<nowiki/>{#expr:''expression''}}]] </kbd>
 
! scope=row id=expr |<kbd>[[mw:Help:Extension:Parser functions##expr|{<nowiki/>{#expr:''expression''}}]] </kbd>
| Evaluates ''expression'' (see [[mw:Help:Calculation]]).
+
| Evaluates ''expression'' (see [[w:Help:Calculation]]).
 
|-
 
|-
 
! scope=row id=if | <kbd>[[mw:Help:Extension:Parser functions##if|{<nowiki/>{#if:''string'' {{pipe}}''result1'' {{pipe}}''result2''}}]] </kbd>
 
! scope=row id=if | <kbd>[[mw:Help:Extension:Parser functions##if|{<nowiki/>{#if:''string'' {{pipe}}''result1'' {{pipe}}''result2''}}]] </kbd>
Line 442: Line 454:
  
 
If, in these conditional functions, [[w:Empty string|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. <kbd>{{(((}}1{{pipe}}{{)))}}</kbd>, <kbd>{{(((}}2{{pipe}}{{)))}}</kbd>, etc., rather than <kbd>{{(((}}1{{)))}}</kbd>, <kbd>{{(((}}2{{)))}}</kbd>, etc.).
 
If, in these conditional functions, [[w:Empty string|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. <kbd>{{(((}}1{{pipe}}{{)))}}</kbd>, <kbd>{{(((}}2{{pipe}}{{)))}}</kbd>, etc., rather than <kbd>{{(((}}1{{)))}}</kbd>, <kbd>{{(((}}2{{)))}}</kbd>, etc.).
* For the use of these functions in tables, see [[Help:Conditional tables]].
+
* For the use of these functions in tables, see [[w:Help:Conditional tables|Help:Conditional tables]].
  
 
===Other===
 
===Other===
Line 452: Line 464:
 
| List pages in a category, recursively.
 
| List pages in a category, recursively.
 
|-
 
|-
<!--
 
! scope=row | <kbd>[[mw:Extension:GeoData#Parser function|{<nowiki/>{#coordinates:''arg1''|''arg2''|...}}]]</kbd>
 
| Save the [[Geographic coordinate system|GeoData coordinates]] of the subject to the page's database. Used in {{tl|coord}}.
 
|-
 
-->
 
 
! scope=row style=white-space:nowrap | <kbd>[[mw:Extension:Scribunto#Usage|{<nowiki/>{#invoke:''module''|''function''|''arg1''|...}}]]</kbd>
 
! scope=row style=white-space:nowrap | <kbd>[[mw:Extension:Scribunto#Usage|{<nowiki/>{#invoke:''module''|''function''|''arg1''|...}}]]</kbd>
|| Use [[mw:Extension:Scribunto|Scribunto]] to transclude a [[BattleTechWiki:Lua|lua]] template, e.g. function ''replace'' in [[Module:String#replace|module ''String'']].
+
|| Use [[mw:Extension:Scribunto|Scribunto]] to transclude a [[w:Wikipedia:Lua|lua]] template, e.g. function ''replace'' in [[Module:String#replace|module ''String'']].
 
|-
 
|-
 
! scope=row id=lst | <kbd>[[mw:Extension:Labeled Section Transclusion|<nowiki>{{#lst:}}, {{#lsth:}}, {{#lstx:}}</nowiki>]]</kbd>
 
! scope=row id=lst | <kbd>[[mw:Extension:Labeled Section Transclusion|<nowiki>{{#lst:}}, {{#lsth:}}, {{#lstx:}}</nowiki>]]</kbd>
Line 468: Line 475:
 
! scope=row id=section | <kbd>[[Help:Labeled section transclusion|{<nowiki/>{#section:}}, {<nowiki/>{#section-h:}}, {<nowiki/>{#section-x:}}]]</kbd>
 
! scope=row id=section | <kbd>[[Help:Labeled section transclusion|{<nowiki/>{#section:}}, {<nowiki/>{#section-h:}}, {<nowiki/>{#section-x:}}]]</kbd>
 
| Aliases for <kbd><nowiki>{{#lst:}}, {{#lsth}}, {{#lstx}}</nowiki></kbd> (above).
 
| Aliases for <kbd><nowiki>{{#lst:}}, {{#lsth}}, {{#lstx}}</nowiki></kbd> (above).
 +
|-
 +
! scope=row id=target | <kbd>[[mw:Help:Extension:MassMessage#Parser function delivery lists|{<nowiki/>{#target:''fullpagename''}}]]</kbd>
 +
| Send a message to a list of talk pages on the fullpagename, using the [[mw:MassMessage|MassMessage function]].
 
|-
 
|-
 
! scope=row id=int | <kbd>[[mw:Help:Magic words#Localization|{<nowiki/>{int:''pagename''}}]] </kbd>
 
! scope=row id=int | <kbd>[[mw:Help:Magic words#Localization|{<nowiki/>{int:''pagename''}}]] </kbd>
Line 483: Line 493:
 
* [[mw:Manual:Extending wiki markup]]
 
* [[mw:Manual:Extending wiki markup]]
 
* [https://phabricator.wikimedia.org/diffusion/MW/history/master/includes/parser/CoreParserFunctions.php CoreParserFunctions.php]
 
* [https://phabricator.wikimedia.org/diffusion/MW/history/master/includes/parser/CoreParserFunctions.php CoreParserFunctions.php]
* [[w:User:Cacycle/wikEd|wikEd]], a MediaWiki editor with syntax highlighting for templates and parser functions
 
* {{myprefs|Gadgets|Editing|check=Syntax highlighter}}
 
* {{myprefs|Beta features|check=Wiki syntax highlighting}}
 
 
* [[Special:Version]], see last section "Parser function hooks":<!--(a #section link is not possible)-->a list that should include all of the magic words on this page
 
* [[Special:Version]], see last section "Parser function hooks":<!--(a #section link is not possible)-->a list that should include all of the magic words on this page
 
* {{tl|Ifexist not redirect}}, works with the <code><nowiki>{{#ifexist:}}</nowiki></code> expression while allowing redirects to be identified and parsed differently
 
* {{tl|Ifexist not redirect}}, works with the <code><nowiki>{{#ifexist:}}</nowiki></code> expression while allowing redirects to be identified and parsed differently
  
 
[[Category:BattleTechWiki features]]
 
[[Category:BattleTechWiki features]]

Please note that all contributions to BattleTechWiki are considered to be released under the GNU FDL 1.2 (see BattleTechWiki:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!

To edit this page, please answer the question that appears below (more info):

Cancel Editing help (opens in new window)

Advanced templates:

Editing: {{Merge}}   {{Moratorium}}   {{Otheruses| | | }}

Notices: {{NoEdit}}   {{Sign}}   {{Unsigned|name}}   {{Welcome}}

Administration: {{Essay}}   {{Policy}}   {{Procedure}}

Templates used on this page:

This page is a member of 1 hidden category: