Help talk:Parser functions in templates
From MediaWiki.org
I think there's a logical error here. It's easiest to see in the table at the bottom. In sample 1, {{{1}}} is true for both being defined and for being not defined. How can it both be defined and not defined? -Khono
- I think it is right. If you call {{foo | bar}}, then both {{{1}}} and {{{1|}}} will return "bar" (in template:foo), why the #if statement treat both as true. --79.136.98.249 23:13, 1 September 2009 (UTC)
[edit] White spaces
Is there any parser function that strip leading and tailing white spaces, or one that change them into "%20" or "_"? I try to make a template that includes a link to wikipedia.
- {{Wikipedia | phoo}} givs: See phoo Wikipedias article - NOK (.../wiki/).
- {{Wikipedia |phoo}} givs: See Wikipedias article - OK (.../wiki/phoo).
- {{Wikipedia |phoo bar}} givs: See bar Wikipedias article - NOK (.../wiki/phoo).
- {{Wikipedia}} givs: See functions in templates Wikipedias article - NOK (../wiki/Parser).
--Petter Källström, 79.136.98.249 23:13, 1 September 2009 (UTC)
[edit] parameter specified or not
One way to test whether a parameter was specified in a template call is thus: {{#ifeq:{{{v|}}}|{{{v|-}}}| v was specified (and may be empty) | v was not specified }}
Could an expert please check whether this is true? I find it returns "v was specified (and may be empty)" only when "|v=" or "|v=text" is in the template call code, otherwise "|v" (without any =) returns "v was not specified ". The latter behaviour is unexpected. -84user 18:20, 27 September 2009 (UTC)