Editing
Help:Magic words
(section)
Jump to navigation
Jump to search
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.
Anti-spam check. Do
not
fill this in!
Advanced
Special characters
Help
Heading
Level 2
Level 3
Level 4
Level 5
Format
Insert
Latin
Latin extended
IPA
Symbols
Greek
Greek extended
Cyrillic
Arabic
Arabic extended
Hebrew
Bangla
Tamil
Telugu
Sinhala
Devanagari
Gujarati
Thai
Lao
Khmer
Canadian Aboriginal
Runes
Á
á
À
à
Â
â
Ä
ä
Ã
ã
Ǎ
ǎ
Ā
ā
Ă
ă
Ą
ą
Å
å
Ć
ć
Ĉ
ĉ
Ç
ç
Č
č
Ċ
ċ
Đ
đ
Ď
ď
É
é
È
è
Ê
ê
Ë
ë
Ě
ě
Ē
ē
Ĕ
ĕ
Ė
ė
Ę
ę
Ĝ
ĝ
Ģ
ģ
Ğ
ğ
Ġ
ġ
Ĥ
ĥ
Ħ
ħ
Í
í
Ì
ì
Î
î
Ï
ï
Ĩ
ĩ
Ǐ
ǐ
Ī
ī
Ĭ
ĭ
İ
ı
Į
į
Ĵ
ĵ
Ķ
ķ
Ĺ
ĺ
Ļ
ļ
Ľ
ľ
Ł
ł
Ń
ń
Ñ
ñ
Ņ
ņ
Ň
ň
Ó
ó
Ò
ò
Ô
ô
Ö
ö
Õ
õ
Ǒ
ǒ
Ō
ō
Ŏ
ŏ
Ǫ
ǫ
Ő
ő
Ŕ
ŕ
Ŗ
ŗ
Ř
ř
Ś
ś
Ŝ
ŝ
Ş
ş
Š
š
Ș
ș
Ț
ț
Ť
ť
Ú
ú
Ù
ù
Û
û
Ü
ü
Ũ
ũ
Ů
ů
Ǔ
ǔ
Ū
ū
ǖ
ǘ
ǚ
ǜ
Ŭ
ŭ
Ų
ų
Ű
ű
Ŵ
ŵ
Ý
ý
Ŷ
ŷ
Ÿ
ÿ
Ȳ
ȳ
Ź
ź
Ž
ž
Ż
ż
Æ
æ
Ǣ
ǣ
Ø
ø
Œ
œ
ß
Ð
ð
Þ
þ
Ə
ə
Formatting
Links
Headings
Lists
Files
References
Discussion
Description
What you type
What you get
Italic
''Italic text''
Italic text
Bold
'''Bold text'''
Bold text
Bold & italic
'''''Bold & italic text'''''
Bold & italic text
== Parser functions == {{Shortcut|CP:PF|CP:PARSER}} {{further|mw:Help:Magic words#Parser functions|mw:Help:Extension:ParserFunctions}} === Metadata === {| class="wikitable plainrowheaders" ! scope="col" | Function ! scope="col" | Description |- ! scope="row" id="PAGEID" | <kbd>{<nowiki/>{PAGEID}}</kbd> | Unique page identifier number (for example, this page's ID is <samp>{{PAGEID}}</samp>). |- ! scope="row" id="PAGESIZE" | <kbd>{<nowiki/>{PAGESIZE:''fullpagename''}}{{efn|name=expensive|This function is an [[CP:EXPENSIVE|expensive]] parser function.}}</kbd> | Size of named page in bytes (for example, this page is <samp>{{PAGESIZE:{{FULLPAGENAME}}}}</samp> bytes). |- ! scope="row" id="PROTECTIONLEVEL" | <kbd>{<nowiki/>{PROTECTIONLEVEL:''action''{{pipe}}''fullpagename''}}</kbd> | [[Chabadpedia:Protection policy|Protection level]] assigned to ''action'' ("edit", "move", etc.) on named page (this page's protection level for "edit" is <kbd>{{PROTECTIONLEVEL:edit|Help:Magic words}}</kbd>). |- ! scope="row" id="PROTECTIONEXPIRY" | <kbd>{<nowiki/>{PROTECTIONEXPIRY:''action''{{pipe}}''fullpagename''}}</kbd> | [[Chabadpedia: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 [[CP: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> | Number of pages in the category named ''categoryname''. Each subcategory is counted as one item. |- ! scope="row" id="NUMBERINGROUP" | <kbd>{<nowiki/>{NUMBERINGROUP:''groupname''}}</kbd> | Number of users in the [[Chabadpedia:User access levels|user group]] named ''groupname''. |} 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 [[Delimiter|separator]]s (for example, as "123456789" rather than "123,456,789"), append the parameter <kbd>|R</kbd>. === Formatting === {{further|mw:Help:Magic words#Formatting}} {| class="wikitable plainrowheaders" ! scope="col" | Function ! scope="col" | Description |- ! scope="row" id="lc" | <kbd>{<nowiki/>{lc:''string''}}</kbd> | Converts all characters in ''string'' to lower case. |- ! scope="row" id="lcfirst" | <kbd>{<nowiki/>{lcfirst:''string''}}</kbd> | Converts first character of ''string'' to lower case. |- ! scope="row" id="uc" | <kbd>{<nowiki/>{uc:''string''}}</kbd> | Converts all characters in ''string'' to upper case. |- ! scope="row" id="ucfirst" | <kbd>{<nowiki/>{ucfirst:''string''}}</kbd> | Converts first character of ''string'' to upper case. |- ! scope="row" id="formatnum" | <kbd>{<nowiki/>{formatnum:''unformatted_number''}}<br />{<nowiki/>{formatnum:''formatted_num'' {{pipe}}R}}</kbd> | Adds comma separators to an ''unformatted_number'' (e.g. 123456789 becomes {{formatnum:123456789}}). To remove such formatting, use <kbd>{<nowiki/>{formatnum:''formatted_number''{{pipe}}R}}</kbd> (i.e. <kbd>{{braces|formatnum:7,654,321{{pipe}}R}}</kbd>, for example, produces {{formatnum:7,654,321|R}}). |- ! 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>[[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> | Pad with zeroes '0' to the right or left, to fill the given length; an alternative padding string can be given as a third parameter; the repeated padding string (''padstr'') will be truncated if its length does not evenly divide the required number of characters. |- ! scope="row" id="mCPlural" | <kbd>{<nowiki/>{plural:''N''{{pipe}}''singular''{{pipe}}''plural''}}</kbd> | 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. |- ! 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''}}<br /><br />{<nowiki/>{#timef:object{{pipe}}''format type''{{pipe}}''langcode''}}</kbd> | Used to format dates and times, for ISO format, dots or English month names. <kbd>#timel</kbd> and <kbd>#timefl</kbd> are based on local time as defined for each wiki; for English Chabadpedia, this is identical to <kbd>#time</kbd> and <kbd>#timef</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.<br /><kbd>#timef</kbd> formats a date using a standard format for the selected language, see: [[mw:Help:Extension:ParserFunctions##timef]]. |- ! 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]] 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> | Only way to [[eval]]uate magic words ''inside a tag'', in order to generate <code><''tagname''>''magic''</''tagname''></code>. Also handles tag attributes. Details at [[mw:Help:Magic words#tag]]. |} === Paths === {| class="wikitable plainrowheaders" ! scope="col" | Function ! scope="col" | Description |- ! scope="row" id="localurl" | <kbd>{<nowiki/>{localurl:''fullpagename'' {{pipe}}''query''}}</kbd> | Relative [[Path (computing)|path]] to page name. The ''query'' parameter is optional. |- ! scope="row" id="fullurl" | <kbd>{<nowiki/>{fullurl:''fullpagename'' {{pipe}}''query''}}</kbd> | Absolute path, without [[Application layer|protocol prefix]] (i.e. without "{{thinsp}}<nowiki>http:</nowiki>{{thinsp}}" etc.), to page name. The ''query'' parameter is optional. |- ! scope="row" id="canonicalurl" | <kbd>{<nowiki/>{canonicalurl:''fullpagename'' {{pipe}}''query''}}</kbd> | Absolute path, including protocol prefix, to page name. The ''query'' parameter is optional. |- ! scope="row" id="filepath" | <kbd>{<nowiki/>{filepath:''filename''}}</kbd> | Absolute path to the media file ''filename''. |- ! scope="row" id="urlencode" | <kbd>{<nowiki/>{urlencode:''string''}}</kbd> | [[CP: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> | Input encoded for use in MediaWiki URL [[Help:Anchor|section anchor]]s. |- ! scope="row" id="ns" | <kbd>{<nowiki/>{ns:''n''}}</kbd> | Returns the name of the [[CP:Namespace|namespace]] whose index is the number ''n''. For MediaWiki URLs, use <kbd>{<nowiki/>{nse:}}</kbd>. |- ! scope="row" id="rel2abs" | <kbd>[[mw:Help:Extension:ParserFunctions##rel2abs|{<nowiki/>{#rel2abs:''path''}}]] </kbd> | Converts a relative file path to an absolute path. |- ! scope="row" id="titleparts" | <kbd>[[mw:Help:Extension:ParserFunctions##titleparts|{<nowiki/>{#titleparts:''fullpagename''{{pipe}}''number''{{pipe}}''first segment''}}]]</kbd> | Splits the fullpagename (title) into that number of segments. |} ===Conditional=== {{further|Help:Conditional expressions}} {| class="wikitable plainrowheaders" ! scope="col" | Function ! scope="col" | Description |- ! scope="row" id="expr" |<kbd>[[mw:Help:Extension:Parser functions##expr|{<nowiki/>{#expr:''expression''}}]] </kbd> | Evaluates ''expression'' (see [[mw:Manual:Expr parser function syntax]]). |- ! scope="row" id="if" | <kbd>[[mw:Help:Extension:Parser functions##if|{<nowiki/>{#if:''string'' {{pipe}}''result1'' {{pipe}}''result2''}}]] </kbd> | Outputs ''result2'' if ''string'' is [[Empty string|empty]], otherwise outputs ''result1''. |- ! scope="row" id="ifeq" | <kbd>[[mw:Help:Extension:Parser functions##ifeq|{<nowiki/>{#ifeq:''string1''{{pipe}}''string2'' {{pipe}}''result1'' {{pipe}}''result2''}}]] </kbd> | Outputs ''result1'' if ''string1'' and ''string2'' are equal (alphabetically or numerically), otherwise outputs ''result2''. |- ! scope="row" id="iferror" | <kbd>[[mw:Help:Extension:Parser functions##iferror|{<nowiki/>{#iferror:''test_string'' {{pipe}}''result1'' {{pipe}}''result2''}}]] </kbd> | Outputs ''result1'' if ''test_string'' generates a parsing error, otherwise outputs ''result2''. |- ! scope="row" id="ifexpr" | <kbd>[[mw:Help:Extension:Parser functions##ifexpr|{<nowiki/>{#ifexpr:''expression'' {{pipe}}''result1'' {{pipe}}''result2''}}]] </kbd> | Outputs ''result1'' if ''expression''{{thinsp}} is true, otherwise outputs ''result2''. |- ! scope="row" id="ifexist" | <kbd>[[mw:Help:Extension:Parser functions##ifexist|{<nowiki/>{#ifexist:''pagetitle'' {{pipe}}''result1'' {{pipe}}''result2''}}]]{{efn|name=expensive|This function is an [[CP:EXPENSIVE|expensive]] parser function.}}</kbd> | Outputs ''result1'' if the page [<nowiki/>[''pagetitle'']] exists, otherwise outputs ''result2''. Note that underscores are needed for spaces in namespaces. |- ! scope="row" style="white-space: nowrap;" | <kbd>[[mw:Help:Extension:Parser functions##switch|{<nowiki/>{#switch:''string'' {{pipe}}''c1''=''r1'' {{pipe}}''c2''=''r2'' ... {{pipe}}''default''}}]] </kbd> | Outputs ''r1'' if ''string'' is ''c1'', ''r2'' if ''string'' is ''c2'', etc., otherwise outputs ''default'' (if provided). |} 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. <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]]. === Other === {| class="wikitable plainrowheaders" ! scope="col" | Function ! scope="col" | Description |- ! scope="row" id="babel" | <kbd>[[mw:Extension:Babel#Usage|{<nowiki/>{#babel:''code1''|''code2''|...}}]]</kbd> | Render [[Chabadpedia:Userboxes|userboxes]] telling your language skills. Improves upon {{tl|Babel}} (an alternative). |- ! scope="row" id="categorytree" | <kbd>[[mw:Extension:CategoryTree|{<nowiki/>{#categorytree:''category''|...}}]]</kbd> | 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> || Use [[mw:Extension:Scribunto|Scribunto]] to transclude a [[Chabadpedia:Lua|lua]] template, e.g. function ''replace'' in [[Module:String#replace|module ''String'']]. |- ! scope="row" id="language" | <kbd>[[mw:Help:Magic words#Miscellaneous|{<nowiki/>{#language]]:[[ISO 639|''code1''|''code2''}}]]</kbd> | Print the name represented by the language code, e.g. '''en''' → '''English'''. Print in language 2 if given, e.g. <kbd><nowiki>{{#language:en|zh}}</nowiki></kbd> prints {{#language:en|zh}} |- ! scope="row" id="lst" | <kbd>[[mw:Extension:Labeled Section Transclusion|<nowiki>{{#lst:}}, {{#lsth:}}, {{#lstx:}}</nowiki>]]</kbd> | Three ways to [[Help:Labeled section transclusion|transclude a section of a page]]. |- ! scope="row" id="mentor" | <kbd>[[Chabadpedia:Growth Team features|<nowiki>{{#mentor:Username}}</nowiki>]]</kbd> | Display the currently assigned mentor for target Username, if set. |- ! scope="row" id="property" | <kbd>[[m:Wikidata/Notes/Inclusion syntax v0.4|{<nowiki/>{#property:''arg1''|''arg2''|...}}]]</kbd> | Include a [[d:Help:FAQ#Terminology|property]] ([[Chabadpedia:Wikidata|Wikidata]]) from a named entity, instead of the default on the page. |- ! scope="row" id="related" | <kbd>[[mw:Reading/Web/Projects/Read more|{<nowiki/>{#related:...}}]]</kbd> | Links to similar topics, to engage readers. (Beta feature.) |- ! 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). |- ! scope="row" id="statements" | <kbd>[[d:Wikidata:How to use data on Wikimedia projects|{<nowiki/>{#statements:''arg1''|...}}]]</kbd> | Display the value of any statement (Wikidata) included in an item. |- ! 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 [[m:MassMessage|MassMessage function]]. |- ! scope="row" id="int" | <kbd>[[mw:Help:Magic words#Localization|{<nowiki/>{int:''pagename''}}]] </kbd> | [[Chabadpedia:Transclusion|Transclude]] an ''interface'' message, i.e. a [[Special:PrefixIndex/MediaWiki:|pagename in MediaWiki namespace]] |- ! scope="row" id="bang" | <kbd>[[mw:Help:Magic_words#Other|{<nowiki/>{!}}]] </kbd> | Used to include a pipe character as part of a template argument or table cell contents. Before this was added as a magic word, many wikis implemented this by creating [[:Template:!]] with <code>{{!}}</code> as the content. |- ! scope="row" id="equals" | <kbd>[[mw:Help:Magic_words#Other|{<nowiki/>{=}}]] </kbd> | Used to include an equal sign as part of a template argument or table cell contents. Before this was added as a magic word, many wikis implemented this by creating [[:Template:=]] with <code>{{=}}</code> as the content. |} === Substituting and nesting === Magic words can sometimes behave weirdly when [[CP:SUBST|substituted]] or nested. It's possible to subst some magic words (so that the page stops being updated if the value of the word changes). Here are some examples of how this works: {| class="wikitable plainrowheaders" ! scope="col" | {{idkc}} ! scope="col" | Code ! scope="col" | Output |- | {{nayc}} | <syntaxhighlight lang="wikitext" inline>{{PAGESIZE}}</syntaxhighlight> | {{suppress categories|{{PAGESIZE}}}}<!--To suppress the category "Pages which use a template in place of a magic word" generated by this erroneous usage--> |- | {{yeac}} | <syntaxhighlight lang="wikitext" inline>{{PAGESIZE:Help:Magic words}}</syntaxhighlight> | {{PAGESIZE:Help:Magic words}} |- | {{yeac}} | <syntaxhighlight lang="wikitext" inline>{{subst:PAGESIZE:Help:Magic words}}</syntaxhighlight> | {{PAGESIZE:Help:Magic words}} |- | {{yeac}} | <syntaxhighlight lang="wikitext" inline>{{PAGESIZE:{{FULLPAGENAME}}}}</syntaxhighlight> | {{PAGESIZE:{{FULLPAGENAME}}}} |- | {{nayc}} | <syntaxhighlight lang="wikitext" inline>{{subst:PAGESIZE:{{FULLPAGENAME}}}}</syntaxhighlight> | 0 |- | {{yeac}} | <syntaxhighlight lang="wikitext" inline>{{PAGESIZE:{{subst:FULLPAGENAME}}}}</syntaxhighlight> | {{PAGESIZE:Help:Magic words}} |- | {{yeac}} | <syntaxhighlight lang="wikitext" inline>{{subst:PAGESIZE:{{subst:FULLPAGENAME}}}}</syntaxhighlight> | {{PAGESIZE:{{FULLPAGENAME}}}} |}
Edit summary
(Briefly describe your changes)
Please note that all contributions to Chabadpedia are considered to be released under the GNU Free Documentation License 1.3 or later (see
Chabadpedia: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!
Cancel
Editing help
(opens in new window)
Category:Chabadpedia pages with incorrect protection templates
Category:Pages with missing files
Category:Pages with script errors
Category:Pages with syntax highlighting errors
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Create account
Log in
Namespaces
Help page
Discussion
English
Views
Read
Edit source
View history
More
Navigation
Main page
Recent changes
Random page
Tools
What links here
Related changes
Special pages
Page information