Difference between revisions of "User:Ericb/Sandbox"
From MHWiki
m (adjust to live template, to ensure it still works) |
m (convert to live templates) |
||
Line 20: | Line 20: | ||
Experiments with If: | Experiments with If: | ||
− | *no args: -{{ | + | *no args: -{{If}}- |
− | *1 empty arg: -{{ | + | *1 empty arg: -{{If|}}- |
− | *1 non-empty arg: -{{ | + | *1 non-empty arg: -{{If|text}}- |
− | *2 args, first empty: -{{ | + | *2 args, first empty: -{{If||true}}- |
− | *2 args, first text: -{{ | + | *2 args, first text: -{{if|text|true}}- |
− | *3 args, first empty: -{{ | + | *3 args, first empty: -{{if||true|false}}- |
− | *3 args, first text: -{{ | + | *3 args, first text: -{{If|text|true|false}}- |
Experiments with Ifeq: | Experiments with Ifeq: | ||
− | *no args: -{{ | + | *no args: -{{Ifeq}}- |
− | *2 args, equal: -{{ | + | *2 args, equal: -{{Ifeq|test|test}}- |
− | *2 args, differ: -{{ | + | *2 args, differ: -{{ifeq|test|test1}}- |
− | *4 args, equal: -{{ | + | *4 args, equal: -{{ifeq|test|test|hello|discard}}- |
− | *4 args, | + | *4 args, differ: -{{Ifeq|test|test1|discard|hello}}- |
+ | *4 args, both empty: -{{ifeq|||hello|discard}}- | ||
+ | *4 args, both undefined: -{{Ifeq|3=hello|4=discard}}- | ||
+ | *4 args, first empty: -{{Ifeq||test|discard|hello}}- | ||
+ | *4 args, second undefined: -{{ifeq|test|3=discard|4=hello}}- |
Revision as of 01:55, 26 October 2011
Next project(s):
- using my new conditional templates to add optional subgroup to Template:Mouse
- what else needs doing?
It looks like this wiki lacks Extension:ParserFunctions, which means no {{#if:test|if text|if empty}}. But I think I can work around it with my own template, using double template nesting. To test that...
What happens if I use a template:
- with no argument: --
- with no named argument: --
- with named argument empty: --
- with named argument first: -hello-
- with named argument second: -hello-
- with named argument twice: -second-
- with different named arg: --
- with two names: --
- with indirection: -hello-
- with indirection, swapped order: -hello-
- indirection without name: --
- indirection with empty name: --
Experiments with If:
- no args: --
- 1 empty arg: --
- 1 non-empty arg: --
- 2 args, first empty: --
- 2 args, first text: -true-
- 3 args, first empty: -false-
- 3 args, first text: -true-
Experiments with Ifeq:
- no args: --
- 2 args, equal: --
- 2 args, differ: --
- 4 args, equal: -hello-
- 4 args, differ: -hello-
- 4 args, both empty: -hello-
- 4 args, both undefined: -hello-
- 4 args, first empty: -hello-
- 4 args, second undefined: -hello-