< Parser 2011

Core parser functions

Wiki information

int

ns

nse

numberofpages

numberofusers

numberofactiveusers

numberofarticles

numberoffiles

numberofadmins

numberingroup

numberofedits

#special

?

pagesincategory

pagesize

protectionlevel

namespace

namespacee

talkspace

talkspacee

subjectspace

subjectspacee

pagename

pagenamee

fullpagename

fullpagenamee

basepagename

basepagenamee

subpagename

subpagenamee

talkpagename

talkpagenamee

subjectpagename

subjectpagenamee

pagesinnamespace

Linking and files

localurl

localurle

fullurl

fullurle

filepath


String manipulation

urlencode

{{urlencode:Nepean—Carleton (provincial electoral district)}} Nepean%E2%80%94Carleton+%28provincial+electoral+district%29

lc

{{lc:STRING SOMETHING}} string something

lcfirst

{{lcfirst:STRING SOMETHING}} sTRING SOMETHING

uc

{{uc:string something}} STRING SOMETHING

ucfirst

{{ucfirst:string something}} String something

formatnum

grammar

gender

plural

language

padleft

padright

anchorencode

#formatDate

Page meta-info

defaultsort

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

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

#tag

Extension:ParserFunctions

Extension:ParserFunctions provides many useful functions for logical control and such, which are widely used in Wikipedia templates.

#if

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

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

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

#ifexpr

#iferror

#expr

#time

#timel

#rel2abs

#titleparts

#convert

Extension:ParserFunctions string extensions

If $wgPFEnableStringFunctions set...

#len

#pos

#rpos

#sub

#count

#replace

#explode

#urldecode

This article is issued from Mediawiki. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.