From Meta, a Wikimedia project coordination wiki
{{ifdef/doc}} is a compact variant of {{Qif}} for simple "if defined then do" statements without else part. It's the opposite of {{ifndef}}.
{{Ifdef/doc|value|result}} yields result if value isn't blank.
This template is used to simplify the following equivalent but somewhat cryptic code variants:
{{{1{{{1|}}}|{{{2}}}}}}
{{{value{{{value|}}}|{{{result}}}}}}
{{{test{{{test|}}}|{{{then}}}}}}
[edit] Example
| Code |
Result |
1 {{Ifdef/doc| |empty}} |
1
{{ifdef/doc}} is a compact variant of {{Qif}} for simple "if defined then do" statements without else part. It's the opposite of {{ifndef}}.
{{Ifdef/doc|value|result}} yields result if value isn't blank.
This template is used to simplify the following equivalent but somewhat cryptic code variants:
{{{1{{{1|}}}|{{{2}}}}}}
{{{value{{{value|}}}|{{{result}}}}}}
{{{test{{{test|}}}|{{{then}}}}}}
[edit] Example
| Code |
Result |
1 {{Ifdef/doc| |empty}} |
1 Template loop detected: Template:Ifdef/doc |
2 {{Ifdef/doc|x|gotcha}} |
2 Template loop detected: Template:Ifdef/doc |
3 {{Ifdef/doc| {{{1| }}} | {{{1| }}} undefined}} |
3 Template loop detected: Template:Ifdef/doc |
4 {{Ifdef/doc| {{{1|x}}} | {{{1|x}}} for an u}} |
4 Template loop detected: Template:Ifdef/doc |
5 {{Ifdef/doc| {{{ 1 }}} | {{{1}}} bad idea}} |
5 Template loop detected: Template:Ifdef/doc |
6 {{Ifdef/doc| {{!}} |see also {{Tlx|Qif}} }} |
6 Template loop detected: Template:Ifdef/doc |
7 {{Ifdef/doc| okay | 2=see=[[#Caveats]] }} |
7 Template loop detected: Template:Ifdef/doc |
8 {{Ifdef/doc| oops | see=[[#Caveats]] }} |
8 Template loop detected: Template:Ifdef/doc |
See also a simpler example using ifdef. There's no default in ifdef for the second parameter, because this could hide problematic code.
[edit] Caveats
In templates the characters "=" (=) and "|" (|) cannot be used as is in parameters. The numeric character references = and | are often good enough, but for Wiki and XHTML markup the literal characters are required:
- For | template:! (edit•talk•links•history) offers a workaround.
- For = the template parameter mechanism allows {{ifdef|1|2=ok=yes}} resulting in "ok=yes
" instead of {{ifdef|1|bad=idea}} resulting in "{{{2}}} ".
Substitution works only for {{ifdef}}, but not for {{ifndef}} or {{qif}}.
[edit] See also
|
2 {{Ifdef/doc|x|gotcha}} |
2
{{ifdef/doc}} is a compact variant of {{Qif}} for simple "if defined then do" statements without else part. It's the opposite of {{ifndef}}.
{{Ifdef/doc|value|result}} yields result if value isn't blank.
This template is used to simplify the following equivalent but somewhat cryptic code variants:
{{{1{{{1|}}}|{{{2}}}}}}
{{{value{{{value|}}}|{{{result}}}}}}
{{{test{{{test|}}}|{{{then}}}}}}
[edit] Example
| Code |
Result |
1 {{Ifdef/doc| |empty}} |
1 Template loop detected: Template:Ifdef/doc |
2 {{Ifdef/doc|x|gotcha}} |
2 Template loop detected: Template:Ifdef/doc |
3 {{Ifdef/doc| {{{1| }}} | {{{1| }}} undefined}} |
3 Template loop detected: Template:Ifdef/doc |
4 {{Ifdef/doc| {{{1|x}}} | {{{1|x}}} for an u}} |
4 Template loop detected: Template:Ifdef/doc |
5 {{Ifdef/doc| {{{ 1 }}} | {{{1}}} bad idea}} |
5 Template loop detected: Template:Ifdef/doc |
6 {{Ifdef/doc| {{!}} |see also {{Tlx|Qif}} }} |
6 Template loop detected: Template:Ifdef/doc |
7 {{Ifdef/doc| okay | 2=see=[[#Caveats]] }} |
7 Template loop detected: Template:Ifdef/doc |
8 {{Ifdef/doc| oops | see=[[#Caveats]] }} |
8 Template loop detected: Template:Ifdef/doc |
See also a simpler example using ifdef. There's no default in ifdef for the second parameter, because this could hide problematic code.
[edit] Caveats
In templates the characters "=" (=) and "|" (|) cannot be used as is in parameters. The numeric character references = and | are often good enough, but for Wiki and XHTML markup the literal characters are required:
- For | template:! (edit•talk•links•history) offers a workaround.
- For = the template parameter mechanism allows {{ifdef|1|2=ok=yes}} resulting in "ok=yes
" instead of {{ifdef|1|bad=idea}} resulting in "{{{2}}} ".
Substitution works only for {{ifdef}}, but not for {{ifndef}} or {{qif}}.
[edit] See also
|
3 {{Ifdef/doc| {{{1| }}} | {{{1| }}} undefined}} |
3
{{ifdef/doc}} is a compact variant of {{Qif}} for simple "if defined then do" statements without else part. It's the opposite of {{ifndef}}.
{{Ifdef/doc|value|result}} yields result if value isn't blank.
This template is used to simplify the following equivalent but somewhat cryptic code variants:
{{{1{{{1|}}}|{{{2}}}}}}
{{{value{{{value|}}}|{{{result}}}}}}
{{{test{{{test|}}}|{{{then}}}}}}
[edit] Example
| Code |
Result |
1 {{Ifdef/doc| |empty}} |
1 Template loop detected: Template:Ifdef/doc |
2 {{Ifdef/doc|x|gotcha}} |
2 Template loop detected: Template:Ifdef/doc |
3 {{Ifdef/doc| {{{1| }}} | {{{1| }}} undefined}} |
3 Template loop detected: Template:Ifdef/doc |
4 {{Ifdef/doc| {{{1|x}}} | {{{1|x}}} for an u}} |
4 Template loop detected: Template:Ifdef/doc |
5 {{Ifdef/doc| {{{ 1 }}} | {{{1}}} bad idea}} |
5 Template loop detected: Template:Ifdef/doc |
6 {{Ifdef/doc| {{!}} |see also {{Tlx|Qif}} }} |
6 Template loop detected: Template:Ifdef/doc |
7 {{Ifdef/doc| okay | 2=see=[[#Caveats]] }} |
7 Template loop detected: Template:Ifdef/doc |
8 {{Ifdef/doc| oops | see=[[#Caveats]] }} |
8 Template loop detected: Template:Ifdef/doc |
See also a simpler example using ifdef. There's no default in ifdef for the second parameter, because this could hide problematic code.
[edit] Caveats
In templates the characters "=" (=) and "|" (|) cannot be used as is in parameters. The numeric character references = and | are often good enough, but for Wiki and XHTML markup the literal characters are required:
- For | template:! (edit•talk•links•history) offers a workaround.
- For = the template parameter mechanism allows {{ifdef|1|2=ok=yes}} resulting in "ok=yes
" instead of {{ifdef|1|bad=idea}} resulting in "{{{2}}} ".
Substitution works only for {{ifdef}}, but not for {{ifndef}} or {{qif}}.
[edit] See also
|
4 {{Ifdef/doc| {{{1|x}}} | {{{1|x}}} for an u}} |
4
{{ifdef/doc}} is a compact variant of {{Qif}} for simple "if defined then do" statements without else part. It's the opposite of {{ifndef}}.
{{Ifdef/doc|value|result}} yields result if value isn't blank.
This template is used to simplify the following equivalent but somewhat cryptic code variants:
{{{1{{{1|}}}|{{{2}}}}}}
{{{value{{{value|}}}|{{{result}}}}}}
{{{test{{{test|}}}|{{{then}}}}}}
[edit] Example
| Code |
Result |
1 {{Ifdef/doc| |empty}} |
1 Template loop detected: Template:Ifdef/doc |
2 {{Ifdef/doc|x|gotcha}} |
2 Template loop detected: Template:Ifdef/doc |
3 {{Ifdef/doc| {{{1| }}} | {{{1| }}} undefined}} |
3 Template loop detected: Template:Ifdef/doc |
4 {{Ifdef/doc| {{{1|x}}} | {{{1|x}}} for an u}} |
4 Template loop detected: Template:Ifdef/doc |
5 {{Ifdef/doc| {{{ 1 }}} | {{{1}}} bad idea}} |
5 Template loop detected: Template:Ifdef/doc |
6 {{Ifdef/doc| {{!}} |see also {{Tlx|Qif}} }} |
6 Template loop detected: Template:Ifdef/doc |
7 {{Ifdef/doc| okay | 2=see=[[#Caveats]] }} |
7 Template loop detected: Template:Ifdef/doc |
8 {{Ifdef/doc| oops | see=[[#Caveats]] }} |
8 Template loop detected: Template:Ifdef/doc |
See also a simpler example using ifdef. There's no default in ifdef for the second parameter, because this could hide problematic code.
[edit] Caveats
In templates the characters "=" (=) and "|" (|) cannot be used as is in parameters. The numeric character references = and | are often good enough, but for Wiki and XHTML markup the literal characters are required:
- For | template:! (edit•talk•links•history) offers a workaround.
- For = the template parameter mechanism allows {{ifdef|1|2=ok=yes}} resulting in "ok=yes
" instead of {{ifdef|1|bad=idea}} resulting in "{{{2}}} ".
Substitution works only for {{ifdef}}, but not for {{ifndef}} or {{qif}}.
[edit] See also
|
5 {{Ifdef/doc| {{{ 1 }}} | {{{1}}} bad idea}} |
5
{{ifdef/doc}} is a compact variant of {{Qif}} for simple "if defined then do" statements without else part. It's the opposite of {{ifndef}}.
{{Ifdef/doc|value|result}} yields result if value isn't blank.
This template is used to simplify the following equivalent but somewhat cryptic code variants:
{{{1{{{1|}}}|{{{2}}}}}}
{{{value{{{value|}}}|{{{result}}}}}}
{{{test{{{test|}}}|{{{then}}}}}}
[edit] Example
| Code |
Result |
1 {{Ifdef/doc| |empty}} |
1 Template loop detected: Template:Ifdef/doc |
2 {{Ifdef/doc|x|gotcha}} |
2 Template loop detected: Template:Ifdef/doc |
3 {{Ifdef/doc| {{{1| }}} | {{{1| }}} undefined}} |
3 Template loop detected: Template:Ifdef/doc |
4 {{Ifdef/doc| {{{1|x}}} | {{{1|x}}} for an u}} |
4 Template loop detected: Template:Ifdef/doc |
5 {{Ifdef/doc| {{{ 1 }}} | {{{1}}} bad idea}} |
5 Template loop detected: Template:Ifdef/doc |
6 {{Ifdef/doc| {{!}} |see also {{Tlx|Qif}} }} |
6 Template loop detected: Template:Ifdef/doc |
7 {{Ifdef/doc| okay | 2=see=[[#Caveats]] }} |
7 Template loop detected: Template:Ifdef/doc |
8 {{Ifdef/doc| oops | see=[[#Caveats]] }} |
8 Template loop detected: Template:Ifdef/doc |
See also a simpler example using ifdef. There's no default in ifdef for the second parameter, because this could hide problematic code.
[edit] Caveats
In templates the characters "=" (=) and "|" (|) cannot be used as is in parameters. The numeric character references = and | are often good enough, but for Wiki and XHTML markup the literal characters are required:
- For | template:! (edit•talk•links•history) offers a workaround.
- For = the template parameter mechanism allows {{ifdef|1|2=ok=yes}} resulting in "ok=yes
" instead of {{ifdef|1|bad=idea}} resulting in "{{{2}}} ".
Substitution works only for {{ifdef}}, but not for {{ifndef}} or {{qif}}.
[edit] See also
|
6 {{Ifdef/doc| {{!}} |see also {{Tlx|Qif}} }} |
6
{{ifdef/doc}} is a compact variant of {{Qif}} for simple "if defined then do" statements without else part. It's the opposite of {{ifndef}}.
{{Ifdef/doc|value|result}} yields result if value isn't blank.
This template is used to simplify the following equivalent but somewhat cryptic code variants:
{{{1{{{1|}}}|{{{2}}}}}}
{{{value{{{value|}}}|{{{result}}}}}}
{{{test{{{test|}}}|{{{then}}}}}}
[edit] Example
| Code |
Result |
1 {{Ifdef/doc| |empty}} |
1 Template loop detected: Template:Ifdef/doc |
2 {{Ifdef/doc|x|gotcha}} |
2 Template loop detected: Template:Ifdef/doc |
3 {{Ifdef/doc| {{{1| }}} | {{{1| }}} undefined}} |
3 Template loop detected: Template:Ifdef/doc |
4 {{Ifdef/doc| {{{1|x}}} | {{{1|x}}} for an u}} |
4 Template loop detected: Template:Ifdef/doc |
5 {{Ifdef/doc| {{{ 1 }}} | {{{1}}} bad idea}} |
5 Template loop detected: Template:Ifdef/doc |
6 {{Ifdef/doc| {{!}} |see also {{Tlx|Qif}} }} |
6 Template loop detected: Template:Ifdef/doc |
7 {{Ifdef/doc| okay | 2=see=[[#Caveats]] }} |
7 Template loop detected: Template:Ifdef/doc |
8 {{Ifdef/doc| oops | see=[[#Caveats]] }} |
8 Template loop detected: Template:Ifdef/doc |
See also a simpler example using ifdef. There's no default in ifdef for the second parameter, because this could hide problematic code.
[edit] Caveats
In templates the characters "=" (=) and "|" (|) cannot be used as is in parameters. The numeric character references = and | are often good enough, but for Wiki and XHTML markup the literal characters are required:
- For | template:! (edit•talk•links•history) offers a workaround.
- For = the template parameter mechanism allows {{ifdef|1|2=ok=yes}} resulting in "ok=yes
" instead of {{ifdef|1|bad=idea}} resulting in "{{{2}}} ".
Substitution works only for {{ifdef}}, but not for {{ifndef}} or {{qif}}.
[edit] See also
|
7 {{Ifdef/doc| okay | 2=see=[[#Caveats]] }} |
7
{{ifdef/doc}} is a compact variant of {{Qif}} for simple "if defined then do" statements without else part. It's the opposite of {{ifndef}}.
{{Ifdef/doc|value|result}} yields result if value isn't blank.
This template is used to simplify the following equivalent but somewhat cryptic code variants:
{{{1{{{1|}}}|{{{2}}}}}}
{{{value{{{value|}}}|{{{result}}}}}}
{{{test{{{test|}}}|{{{then}}}}}}
[edit] Example
| Code |
Result |
1 {{Ifdef/doc| |empty}} |
1 Template loop detected: Template:Ifdef/doc |
2 {{Ifdef/doc|x|gotcha}} |
2 Template loop detected: Template:Ifdef/doc |
3 {{Ifdef/doc| {{{1| }}} | {{{1| }}} undefined}} |
3 Template loop detected: Template:Ifdef/doc |
4 {{Ifdef/doc| {{{1|x}}} | {{{1|x}}} for an u}} |
4 Template loop detected: Template:Ifdef/doc |
5 {{Ifdef/doc| {{{ 1 }}} | {{{1}}} bad idea}} |
5 Template loop detected: Template:Ifdef/doc |
6 {{Ifdef/doc| {{!}} |see also {{Tlx|Qif}} }} |
6 Template loop detected: Template:Ifdef/doc |
7 {{Ifdef/doc| okay | 2=see=[[#Caveats]] }} |
7 Template loop detected: Template:Ifdef/doc |
8 {{Ifdef/doc| oops | see=[[#Caveats]] }} |
8 Template loop detected: Template:Ifdef/doc |
See also a simpler example using ifdef. There's no default in ifdef for the second parameter, because this could hide problematic code.
[edit] Caveats
In templates the characters "=" (=) and "|" (|) cannot be used as is in parameters. The numeric character references = and | are often good enough, but for Wiki and XHTML markup the literal characters are required:
- For | template:! (edit•talk•links•history) offers a workaround.
- For = the template parameter mechanism allows {{ifdef|1|2=ok=yes}} resulting in "ok=yes
" instead of {{ifdef|1|bad=idea}} resulting in "{{{2}}} ".
Substitution works only for {{ifdef}}, but not for {{ifndef}} or {{qif}}.
[edit] See also
|
8 {{Ifdef/doc| oops | see=[[#Caveats]] }} |
8
{{ifdef/doc}} is a compact variant of {{Qif}} for simple "if defined then do" statements without else part. It's the opposite of {{ifndef}}.
{{Ifdef/doc|value|result}} yields result if value isn't blank.
This template is used to simplify the following equivalent but somewhat cryptic code variants:
{{{1{{{1|}}}|{{{2}}}}}}
{{{value{{{value|}}}|{{{result}}}}}}
{{{test{{{test|}}}|{{{then}}}}}}
[edit] Example
| Code |
Result |
1 {{Ifdef/doc| |empty}} |
1 Template loop detected: Template:Ifdef/doc |
2 {{Ifdef/doc|x|gotcha}} |
2 Template loop detected: Template:Ifdef/doc |
3 {{Ifdef/doc| {{{1| }}} | {{{1| }}} undefined}} |
3 Template loop detected: Template:Ifdef/doc |
4 {{Ifdef/doc| {{{1|x}}} | {{{1|x}}} for an u}} |
4 Template loop detected: Template:Ifdef/doc |
5 {{Ifdef/doc| {{{ 1 }}} | {{{1}}} bad idea}} |
5 Template loop detected: Template:Ifdef/doc |
6 {{Ifdef/doc| {{!}} |see also {{Tlx|Qif}} }} |
6 Template loop detected: Template:Ifdef/doc |
7 {{Ifdef/doc| okay | 2=see=[[#Caveats]] }} |
7 Template loop detected: Template:Ifdef/doc |
8 {{Ifdef/doc| oops | see=[[#Caveats]] }} |
8 Template loop detected: Template:Ifdef/doc |
See also a simpler example using ifdef. There's no default in ifdef for the second parameter, because this could hide problematic code.
[edit] Caveats
In templates the characters "=" (=) and "|" (|) cannot be used as is in parameters. The numeric character references = and | are often good enough, but for Wiki and XHTML markup the literal characters are required:
- For | template:! (edit•talk•links•history) offers a workaround.
- For = the template parameter mechanism allows {{ifdef|1|2=ok=yes}} resulting in "ok=yes
" instead of {{ifdef|1|bad=idea}} resulting in "{{{2}}} ".
Substitution works only for {{ifdef}}, but not for {{ifndef}} or {{qif}}.
[edit] See also
|
See also a simpler example using ifdef. There's no default in ifdef for the second parameter, because this could hide problematic code.
[edit] Caveats
In templates the characters "=" (=) and "|" (|) cannot be used as is in parameters. The numeric character references = and | are often good enough, but for Wiki and XHTML markup the literal characters are required:
- For | template:! (edit•talk•links•history) offers a workaround.
- For = the template parameter mechanism allows {{ifdef|1|2=ok=yes}} resulting in "ok=yes
" instead of {{ifdef|1|bad=idea}} resulting in "{{{2}}} ".
Substitution works only for {{ifdef}}, but not for {{ifndef}} or {{qif}}.
[edit] See also