[Mediawiki-l] #if: missbehaviour

Luis Mandel luismandel at gmail.com
Tue May 9 13:44:48 UTC 2006


Hi!
I've added the ParserFunctions extensions which allows to use #if: #ifexpr:
and so on.

I've wrote the following template

__NOEDITSECTION__
 {{ #if: {{{1}}} |'''From ''' [[:Category:{{{1}}} | {{{1}}}]]
[[Category:{{{1}}}]] }}
 {{ #if: {{{2}}} |, [[:Category:{{{2}}} | {{{2}}}]] [[Category:{{{2}}}]] }}
 {{ #if: {{{3}}} |, [[:Category:{{{3}}} | {{{3}}}]] [[Category:{{{3}}}]] }}
 {{ #if: {{{4}}} |, [[:Category:{{{4}}} | {{{4}}}]] [[Category:{{{4}}}]] }}
 {{ #if: {{{5}}} |, [[:Category:{{{5}}} | {{{5}}}]] [[Category:{{{5}}}]] }}

 When I call it with 5 parameters it is all OK, but
 When calling it with three parameters as follows:

 {{From | Ángel Gregorio Villoldo | Angel Labruna | pepe soriano}}

 I get

 From Ángel Gregorio Villoldo , Angel Labruna , pepe soriano ,
[[:Category:{{{4}}} | {{{4}}}]] :[[Category:{{{4}}}]] , [[:Category:{{{5}}}
| {{{5}}}]] [[Category:{{{5}}}]]

 Which is wrong. I've tried many work arounds like adding an as"else" in
this way:

 {{ #if: {{{2}}} |, [[:Category:{{{2}}} | {{{2}}}]] [[Category:{{{2}}}]] |
}}
 but it didn't work. Seems to bw that this function has some problems with
empty parameters.
 I believe that using named parameters might be the solution but I need
unnamed parameters.
 If anybody knows how to cope this issue please, let me know.

I've also tried to add a default empty value

{{ #if: {{{2|}}} |, [[:Category:{{{2}}} | {{{2}}}]] [[Category:{{{2}}}]] |
}}

with the same result.

Am I making a mistake? Is there any workaround for this?

Thanks,

Luis


--
-----------------------------
Dr. Luis Mandel
luismandel at gmail.com



More information about the MediaWiki-l mailing list