User:Ericb/If

From MHWiki
< User:Ericb
Revision as of 03:36, 24 October 2011 by Ericb (talk | contribs) (another new template)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

A conditional template. The first argument cannot be "use=". If the first argument contains any text, then we end up calling the {{Use}} template with two arguments, one named "use" with our second argument as its value, and the other will be unnamed or have an unrelated name, so the overall expansion is our one use of the name "use" - our second argument. But if the first argument is empty (or missing), then we provide a default expansion such that we end up using the {{Use}} template with use= specified twice, and the last use wins, giving the overall expansion of our third argument.

That is, I implemented {{#if:test|if text|if empty}}, with a slightly different syntax:
{{if|test|if text|if empty}}