83,675
edits
Hoof Hearted (talk | contribs) ({{TOCright}}) |
Hoof Hearted (talk | contribs) ({{stub}} - needs more info, fix interwiki redirects) |
||
Line 1: | Line 1: | ||
A '''ParserFunction''' is a special kind of [[WikiIndex:Magic Words|magic word]] that is most useful for [[:Category:Templates|templates]]. | A '''ParserFunction''' is a special kind of [[WikiIndex:Magic Words|magic word]] that is most useful for [[:Category:Templates|templates]]. | ||
{{TOCright}} | {{TOCright}} | ||
{{stub}} | |||
==List== | ==List== | ||
*[[#expr]] | *[[#expr]] | ||
Line 10: | Line 12: | ||
*[[#switch]] | *[[#switch]] | ||
*[[#time]] | *[[#time]] | ||
==expr== | ==expr== | ||
coming soon. | coming soon. | ||
==if== | ==if== | ||
Shows different values when entered.<br> | Shows different values when entered.<br> | ||
Line 19: | Line 23: | ||
<pre>{{ #if: {{{1|}}} | The name of this site is {{{1}}}. | This site has an unknown name. }}</pre> | <pre>{{ #if: {{{1|}}} | The name of this site is {{{1}}}. | This site has an unknown name. }}</pre> | ||
Let's say this is included in the template ''[[Template:IfExample|ifExample]]''. If <nowiki>{{ifExample|WikiIndex}}</nowiki> is entered, "{{ifExample|WikiIndex}}" will show up because value was specified, as "WikiIndex". <nowiki>{{ifExample|not WikiIndex}}</nowiki> makes "{{ifExample|not WikiIndex}}", because value is specified, as "not WikiIndex". <nowiki>{{ifExample}}</nowiki> makes just "{{ifExample}}" because it was left blank. | Let's say this is included in the template ''[[Template:IfExample|ifExample]]''. If <nowiki>{{ifExample|WikiIndex}}</nowiki> is entered, "{{ifExample|WikiIndex}}" will show up because value was specified, as "WikiIndex". <nowiki>{{ifExample|not WikiIndex}}</nowiki> makes "{{ifExample|not WikiIndex}}", because value is specified, as "not WikiIndex". <nowiki>{{ifExample}}</nowiki> makes just "{{ifExample}}" because it was left blank. | ||
==ifeq== | ==ifeq== | ||
coming soon. | coming soon. | ||
==ifexist== | ==ifexist== | ||
coming soon. | coming soon. | ||
==ifexpr== | ==ifexpr== | ||
coming soon. | coming soon. | ||
==rel2abs== | ==rel2abs== | ||
coming soon. | coming soon. | ||
==switch== | ==switch== | ||
Compares values.<br> | Compares values.<br> | ||
Code: | Code: | ||
<pre>{{ #switch: value | <pre>{{ #switch: value | ||
| value1 = what to show if value1 is entered | | value1 = what to show if value1 is entered | ||
| value2 = what to show if value2 is entered | | value2 = what to show if value2 is entered | ||
| | what to show if something else is entered | | | what to show if something else is entered | ||
| #default = what to show if nothing is entered | | #default = what to show if nothing is entered | ||
}}</pre> | }}</pre> | ||
Example: | Example: | ||
<pre>{{ #switch: {{{1}}} | <pre>{{ #switch: {{{1}}} | ||
| a = argh | | a = argh | ||
| b = blah | | b = blah | ||
| c = cough | | c = cough | ||
| | anything | | | anything | ||
| #default = nothing | | #default = nothing | ||
}}</pre> | }}</pre> | ||
This is included in the template [[template:switchExample|switchExample]]. <nowiki>{{switchExample|a}}</nowiki> gives "{{switchExample|a}}" because a is entered. <nowiki>{{switchExample}}</nowiki> gives "{{switchExample}}", because the template was left blank. <nowiki>{{switchExample|d}}</nowiki> gives "{{switchExample|d}}", because d doesn't exist in the template. | This is included in the template [[template:switchExample|switchExample]]. <nowiki>{{switchExample|a}}</nowiki> gives "{{switchExample|a}}" because a is entered. <nowiki>{{switchExample}}</nowiki> gives "{{switchExample}}", because the template was left blank. <nowiki>{{switchExample|d}}</nowiki> gives "{{switchExample|d}}", because d doesn't exist in the template. | ||
Line 50: | Line 59: | ||
==See also== | ==See also== | ||
*[[ | *[[mw:Help:Extension:ParserFunctions|Help:Extension:ParserFunctions]] at [[MediaWiki.org]] | ||
[[Category:WikiIndex]] | [[Category:WikiIndex]] | ||
[[Category:Help]] | [[Category:Help]] |
edits