Editing Help:Magic words

Jump to: navigation, search

Warning: You are not logged in.

Your IP address will be recorded in this page's edit history.
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 248: Line 248:
 
  | Outputs ''singular'' if ''N'' is equal to 1, otherwise outputs ''plural''. See the [[mw:Help:Magic words#Localization|documentation at mediawiki.org]] for more details.
 
  | Outputs ''singular'' if ''N'' is equal to 1, otherwise outputs ''plural''. See the [[mw:Help:Magic words#Localization|documentation at mediawiki.org]] for more details.
 
|-
 
|-
  | <code> {{((}}#time:''format''{{pipe}}''object''{{))}} </code><br/><code> {{braces|#timel:}} </code> (for local time)
+
  | <code> {{((}}#time:''format''{{pipe}}''object''{{))}} </code><br/><code> {{braces|#timel:}} </code> {{smaller|(for local time)}}
  | Used to format dates and times. <code>#timel</code> is based on local time as defined for the entire wiki; for the English Wikipedia, where local time is set to UTC, this is identical to <code>#time</code>. (See [[mw:Help:Extension:ParserFunctions##time]].)
+
  | Used to format dates and times. <code>#timel</code> is based on local time as defined for the entire wiki; for the English Wikipedia, where local time is set to [[Coordinated Universal Time|UTC]], this is identical to <code>#time</code>. (See [[mw:Help:Extension:ParserFunctions##time]].)
 
|-
 
|-
 
  | <code> {{((}}gender:''user'' {{pipe}}''m_out'' {{pipe}}''f_out'' {{pipe}}''u_out''{{))}} </code>
 
  | <code> {{((}}gender:''user'' {{pipe}}''m_out'' {{pipe}}''f_out'' {{pipe}}''u_out''{{))}} </code>
  | Outputs ''m_out'', ''f_out'' or ''u_out'' according to whether the gender specified in user's preferences is, respectively, male, female or unspecified. Other parameter permutations are available, see [[mw:Help:Magic words#gender]].
+
  | 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]].
 
|-
 
|-
 
  | <code> {{((}}#tag:''tag''{{pipe}}''content'' {{pipe}}''p1''=''v1'' {{pipe}}''p2''=''v2''{{))}} </code>
 
  | <code> {{((}}#tag:''tag''{{pipe}}''content'' {{pipe}}''p1''=''v1'' {{pipe}}''p2''=''v2''{{))}} </code>
  | An equivalent to the HTML <code>&lt;''tag''>...&lt;/''tag''><code> that is useful when e.g. [[wikipedia:WP:REFNEST|nesting references]].
+
  | An equivalent to the HTML <code>&lt;''tag''>...&lt;/''tag''><code> that is useful when e.g. [[WP:REFNEST|nesting references]].
 
|}
 
|}
  
Line 292: Line 292:
  
 
===Conditional===
 
===Conditional===
: ''Some parameters are optional. For documentation, see [[mw:Help:Extension:ParserFunctions]]. For #switch specifically, see [[Wikipedia:Help:Switch parser function]].
+
{{hatnote|Some parameters are optional. For documentation, see [[mw:Help:Extension:ParserFunctions]]. For #switch specifically, see [[Help:Switch parser function]].}}
 
+
 
{| class="wikitable"
 
{| class="wikitable"
 
! Code
 
! Code
Line 299: Line 298:
 
|-
 
|-
 
  |<code> {{((}}#expr:''expression''{{))}} </code>
 
  |<code> {{((}}#expr:''expression''{{))}} </code>
  | Evaluates ''expression'' (see [https://meta.wikimedia.org/wiki/Help:Calculation m:Help:Calculation]).
+
  | Evaluates ''expression'' (see [[m:Help:Calculation]]).
 
|-
 
|-
 
  | <code> {{((}}#if:''string'' {{pipe}}''result1'' {{pipe}}''result2''{{))}} </code>
 
  | <code> {{((}}#if:''string'' {{pipe}}''result1'' {{pipe}}''result2''{{))}} </code>
  | Outputs ''result2'' if ''string'' is empty, otherwise outputs ''result1''.
+
  | Outputs ''result2'' if ''string'' is [[Empty string|empty]], otherwise outputs ''result1''.
 
|-
 
|-
 
  | <code> {{((}}#ifeq:''string1''{{pipe}}''string2'' {{pipe}}''result1'' {{pipe}}''result2''{{))}} </code>
 
  | <code> {{((}}#ifeq:''string1''{{pipe}}''string2'' {{pipe}}''result1'' {{pipe}}''result2''{{))}} </code>
Line 320: Line 319:
 
|}
 
|}
  
If, in these conditional functions, empty unnamed parameters are to be parsed as empty rather than as text (i.e. as empty rather than as the text "{{{1}}}", "{{{2}}}", etc.), they will require trailing pipes (i.e. <code>{{{1{{pipe}}}}}</code>, <code>{{{2{{pipe}}}}}</code>, etc., rather than <code>{{{1}}}</code>, <code>{{{2}}}</code>, etc.).
+
If, in these conditional functions, [[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. <code>{{(((}}1{{pipe}}{{)))}}</code>, <code>{{(((}}2{{pipe}}{{)))}}</code>, etc., rather than <code>{{(((}}1{{)))}}</code>, <code>{{(((}}2{{)))}}</code>, etc.).
 
* For the use of these functions in tables, see [[Wikipedia:Conditional tables]].
 
* For the use of these functions in tables, see [[Wikipedia:Conditional tables]].
* For examples and further explanations, see [[Wikipedia:Help:Conditional expressions]] and [[Wikipedia:Help:Switch parser function]].
+
* For examples and further explanations, see [[Help:Conditional expressions]] and [[Help:Switch parser function]].
  
 
===Other===
 
===Other===
 +
{| class="wikitable"
 +
! Code
 +
! Notes
 +
|-
 +
| <code> {{((}}#babel:''code1''{{pipe}}''code2''{{pipe}}...{{))}} </code>
 +
| {{tl|Babel}} template replacement (see [[mw:Extension:Babel#Usage|Extension:Babel]]).
 +
|-
 +
| <code> {{((}}#coordinates:''arg1''{{pipe}}''arg2''{{pipe}}...{{))}} </code>
 +
| GeoData coordinates function (see [[mw:Extension:GeoData|Extension:GeoData]]).
 +
|-
 +
| <code> {{((}}#invoke:''mod''{{pipe}}''func'' {{pipe}}''arg1'' {{pipe}}''arg2'' {{pipe}}...{{))}} </code>
 +
| Calls the function ''func'' within the [[mw:Extension:Scribunto|Scribunto]] module ''mod''. (See [[Wikipedia:Lua]].)
 +
|-
 +
| <code> {{((}}#language:''code1''{{pipe}}''code2''{{))}} </code>
 +
| Outputs the name of the language identified by the [[language code]] ''code1'' in the language identified by ''code2''. If ''code2'' is not supplied, the name of the language identified by ''code1'' will be output in that language. For example, "<code>{{braces|#language:ar}}</code>" outputs "{{thinsp|{{#language:ar}}}}" while "<code>{{braces|#language:ar{{pipe}}en}}</code>" and "<code>{{braces|#language:ar{{pipe}}fr}}</code>" output, respectively, "{{#language:ar|en}}" and "{{#language:ar|fr}}". (See [[mw:Help:Magic words#Miscellaneous]].)
 +
|-
 +
| <code> {{((}}#property:''arg1''{{pipe}}''arg2''{{pipe}}...{{))}} </code>
 +
| (See [[m:Wikidata/Notes/Inclusion syntax v0.4]].)
 +
|-
 +
| <code> {{((}}#target:''noticeboard''{{))}} </code>
 +
| MassMessage function (see [[m:MassMessage]] and [[mw:Help:Extension:MassMessage]]).
 +
|-
 +
| <code> {{((}}int:''messagename''{{))}} </code>
 +
| [[Wikipedia:Transclusion|Transcludes]] a page (such as a system message) in [[Help:MediaWiki namespace|MediaWiki namespace]] according to the user's language preferences.
 +
|}
  
 
== See also ==
 
== See also ==
Line 330: Line 354:
 
* [[mw:Manual:Extending wiki markup]]
 
* [[mw:Manual:Extending wiki markup]]
 
* [http://svn.wikimedia.org/viewvc/mediawiki/trunk/phase3/includes/parser/CoreParserFunctions.php?view=log CoreParserFunctions.php]
 
* [http://svn.wikimedia.org/viewvc/mediawiki/trunk/phase3/includes/parser/CoreParserFunctions.php?view=log CoreParserFunctions.php]
* [[wikipedia:User:Cacycle/wikEd|wikEd]], a MediaWiki editor with syntax highlighting for templates and parser functions
+
* [[User:Cacycle/wikEd|wikEd]], a MediaWiki editor with syntax highlighting for templates and parser functions
 +
* {{myprefs|9|Editing|check=Syntax highlighter}}
 +
 
 +
{{Gunsopedia technical help|collapsed}}
  
 
[[Category:help pages]]
 
[[Category:help pages]]

Please note that all contributions to Gunsopedia may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, 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 (see Gunsopedia:Copyrights for details). Do not submit copyrighted work without permission!

Cancel | Editing help (opens in new window)
Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox