Parser 2011/Core parser functions
Core parser functions[edit]
Wiki information[edit]
int[edit]
ns[edit]
nse[edit]
numberofpages[edit]
numberofusers[edit]
numberofactiveusers[edit]
numberofarticles[edit]
numberoffiles[edit]
numberofadmins[edit]
numberingroup[edit]
numberofedits[edit]
#special[edit]
?
pagesincategory[edit]
pagesize[edit]
protectionlevel[edit]
namespace[edit]
namespacee[edit]
talkspace[edit]
talkspacee[edit]
subjectspace[edit]
subjectspacee[edit]
pagename[edit]
pagenamee[edit]
fullpagename[edit]
fullpagenamee[edit]
basepagename[edit]
basepagenamee[edit]
subpagename[edit]
subpagenamee[edit]
talkpagename[edit]
talkpagenamee[edit]
subjectpagename[edit]
subjectpagenamee[edit]
pagesinnamespace[edit]
Linking and files[edit]
localurl[edit]
localurle[edit]
fullurl[edit]
fullurle[edit]
filepath[edit]
String manipulation[edit]
urlencode[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[edit]
grammar[edit]
gender[edit]
plural[edit]
language[edit]
padleft[edit]
padright[edit]
anchorencode[edit]
#formatDate[edit]
Page meta-info[edit]
defaultsort[edit]
Sets 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[edit]
Sets 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[edit]
Extension:ParserFunctions[edit]
Extension:ParserFunctions provides many useful functions for logical control and such, which are widely used in Wikipedia templates.
#if[edit]
Usage: {{#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[edit]
Usage: {{#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[edit]
Usage: {{#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[edit]
Extension:ParserFunctions string extensions[edit]
If $wgPFEnableStringFunctions set...