Parser 2011/Core parser functions
This page is obsolete. It is being retained for archival purposes. It may document extensions or features that are obsolete and/or no longer supported. Do not rely on the information here being up-to-date. |
Core parser functions
editWiki information
editint
editns
editnse
editnumberofpages
editnumberofusers
editnumberofactiveusers
editnumberofarticles
editnumberoffiles
editnumberofadmins
editnumberingroup
editnumberofedits
edit#special
edit?
pagesincategory
editpagesize
editprotectionlevel
editnamespace
editnamespacee
edittalkspace
edittalkspacee
editsubjectspace
editsubjectspacee
editpagename
editpagenamee
editfullpagename
editfullpagenamee
editbasepagename
editbasepagenamee
editsubpagename
editsubpagenamee
edittalkpagename
edittalkpagenamee
editsubjectpagename
editsubjectpagenamee
editpagesinnamespace
editLinking and files
editlocalurl
editlocalurle
editfullurl
editfullurle
editfilepath
editString manipulation
editurlencode
edit{{urlencode:Nepean—Carleton (provincial electoral district)}}
→ Nepean%E2%80%94Carleton+%28provincial+electoral+district%29
lc
edit{{lc:STRING SOMETHING}}
→ string something
lcfirst
edit{{lcfirst:STRING SOMETHING}}
→ sTRING SOMETHING
uc
edit{{uc:string something}}
→ STRING SOMETHING
ucfirst
edit{{ucfirst:string something}}
→ String something
formatnum
editgrammar
editgender
editplural
editlanguage
editpadleft
editpadright
editanchorencode
edit#formatDate
editPage meta-info
editdefaultsort
editSets the default category sort key for this page to the given value; this will then be recorded instead of the page name as the sort key for any Category link on the page that does not specify a sort key.
Expected rendering: none
todo: specify the existence of the default sort key value in parse metadata where it can be saved and used
displaytitle
editSets a string to override how the page title is displayed; there are some (specify me!) limits to what is acceptable for title usage.
Expected rendering: none.
todo: specify the existence of the default display title value in parse metadata where it can be saved and used
Transclusion
edit#tag
editExtension:ParserFunctions
editExtension:ParserFunctions provides many useful functions for logical control and such, which are widely used in Wikipedia templates.
#if
editUsage: {{#if:cond|then-part|else-part}}
If the cond parameter is non-empty, expand this node to include the then-part parsed as wikitext. Otherwise, expand this node to include the else-part parameter parsed as wikitext.
Expect to do some shortcutting—code in the trimmed branches won't need to be evaluated in later parsing stages.
#ifeq
editUsage: {{#ifeq:left-cond|right-cond|then-part|else-part}}
If the left-cond and right-cond parameters expand to equal source text, expand this node to include the then-part parsed as wikitext. Otherwise, expand this node to include the else-part parameter parsed as wikitext.
Expect to do some shortcutting—code in the trimmed branches won't need to be evaluated in later parsing stages.
#switch
editUsage: {{#if:var|test1|case1|test2|case2|...|default-case}}
If the var param expands to match one of the test* parameters, expand this node to include the matching case* parameter. Otherwise, expand this node to include the final default-case part if present.
Expect to do some shortcutting—code in the trimmed branches won't need to be evaluated in later parsing stages.
#ifexist
edit#ifexpr
edit#iferror
edit#expr
edit#time
edit#timel
edit#rel2abs
edit#titleparts
edit#convert
editExtension:ParserFunctions string extensions
editIf $wgPFEnableStringFunctions set...