I've not done much template work since parser functions were new.  Grabbing
some old code examples, found it didn't work anymore.  Workaround?

===

Ancient code (expected single space):

{{{{{subst|}}}#if:{{{par1|}}}|[[Category:{{{par1}}}{{{{{subst|}}}#if:{{{key1|}}}{{{{{subst|}}}!}}{{{key1}}}}}]]
 <!-- bpar1 -->
}}{{{{{subst|}}}#if:{{{par2|}}}|[[Category:{{{par2}}}{{{{{subst|}}}#if:{{{key2|}}}{{{{{subst|}}}!}}{{{key2}}}}}]]
 <!-- bpar2 -->
}}{{{{{subst|}}}#if:{{{par3|}}}|[[Category:{{{par3}}}{{{{{subst|}}}#if:{{{key3|}}}{{{{{subst|}}}!}}{{{key3}}}}}]]
 <!-- bpar3 -->
}}

Also tried (expected double space, hoped for single space):

{{{{{subst|}}}#if:{{{par1|}}}|
[[Category:{{{par1}}}{{{{{subst|}}}#if:{{{key1|}}}{{{{{subst|}}}!}}{{{key1}}}}}]]
 <!-- bpar1 -->
}}{{{{{subst|}}}#if:{{{par2|}}}|
[[Category:{{{par2}}}{{{{{subst|}}}#if:{{{key2|}}}{{{{{subst|}}}!}}{{{key2}}}}}]]
 <!-- bpar2 -->
}}{{{{{subst|}}}#if:{{{par3|}}}|
[[Category:{{{par3}}}{{{{{subst|}}}#if:{{{key3|}}}{{{{{subst|}}}!}}{{{key3}}}}}]]
 <!-- bpar3 -->
}}

===

Each category should be on a new line. If the par* doesn't exist, then the }}
that begins the next line would slurp up the newline, leaving no blank line.

Example {{subst:testing|par1=A|par2=B|key2=C|subst=subst:}}

As I remember, should yield something like:

[[Category:A]] <!-- bpar1 -->
[[Category:B|C]] <!-- bpar2 -->

Currently output:

[[Category:A]] <!-- bpar1 -->[[Category:B]] <!-- bpar2 -->

Did the evaluation order change, so the inner {{subst:!}} happens first
instead of second, and loses the C parameter (interpreting it as "else")?

And the leading and trailing linebreaks are slurped up and ignored?

Any known work around? (I tried searching meta and elsewhere, but no joy.)

_______________________________________________
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Reply via email to