Difference between revisions of "Template:Ifdef/doc"

From ISFDB
Jump to navigation Jump to search
(New page: ==Documentation== <code>{{[[Template:{{PAGENAME}}|{{lcfirst:{{PAGENAME}}}}]]}}</code> is a compact variant of {{Tl|Qif}} for simple "'''if''' ''defined'' '''then''' ''do''" sta...)
 
Line 68: Line 68:
 
* {{tl|Qif}}
 
* {{tl|Qif}}
 
* [[m:ParserFunctions|Parser functions]] '''#expr:''', '''#if:''', '''#ifeq:''', etc.
 
* [[m:ParserFunctions|Parser functions]] '''#expr:''', '''#if:''', '''#ifeq:''', etc.
 +
 +
==Source==
 +
Copied from [http://meta.wikimedia.org/wiki/Template:Ifdef the page on meta] where it is released under the GFDL.

Revision as of 01:48, 22 October 2008

Documentation

{{ifdef/doc}} is a compact variant of {{Qif}} for simple "if defined then do" statements without else part. It's the opposite of {{ifndef}}.

Usage

{{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}}}}}}


Example

Code Result
1 {{Ifdef/doc| |empty}} 1 ==Documentation==

{{ifdef/doc}} is a compact variant of {{Qif}} for simple "if defined then do" statements without else part. It's the opposite of {{ifndef}}.

Usage

{{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}}}}}}


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.

Caveats

In templates the characters "=" (&#61;) and "|" (&#124;) cannot be used as is in parameters. The numeric character references &#61; and &#124; are often good enough, but for Wiki and XHTML markup the literal characters are required:

  1. For | template:! (edittalklinkshistory) offers a workaround.
  2. For = the template parameter mechanism allows {{ifdef}} resulting in "ok=yes" instead of {{ifdef}} resulting in "{{{2}}}".

Substitution works only for {{ifdef}}, but not for {{ifndef}} or {{qif}}.

See also

Source

Copied from the page on meta where it is released under the GFDL.

2 {{Ifdef/doc|x|gotcha}} 2 ==Documentation==

{{ifdef/doc}} is a compact variant of {{Qif}} for simple "if defined then do" statements without else part. It's the opposite of {{ifndef}}.

Usage

{{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}}}}}}


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.

Caveats

In templates the characters "=" (&#61;) and "|" (&#124;) cannot be used as is in parameters. The numeric character references &#61; and &#124; are often good enough, but for Wiki and XHTML markup the literal characters are required:

  1. For | template:! (edittalklinkshistory) offers a workaround.
  2. For = the template parameter mechanism allows {{ifdef}} resulting in "ok=yes" instead of {{ifdef}} resulting in "{{{2}}}".

Substitution works only for {{ifdef}}, but not for {{ifndef}} or {{qif}}.

See also

Source

Copied from the page on meta where it is released under the GFDL.

3 {{Ifdef/doc| {{{1| }}} | {{{1| }}} undefined}} 3 ==Documentation==

{{ifdef/doc}} is a compact variant of {{Qif}} for simple "if defined then do" statements without else part. It's the opposite of {{ifndef}}.

Usage

{{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}}}}}}


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.

Caveats

In templates the characters "=" (&#61;) and "|" (&#124;) cannot be used as is in parameters. The numeric character references &#61; and &#124; are often good enough, but for Wiki and XHTML markup the literal characters are required:

  1. For | template:! (edittalklinkshistory) offers a workaround.
  2. For = the template parameter mechanism allows {{ifdef}} resulting in "ok=yes" instead of {{ifdef}} resulting in "{{{2}}}".

Substitution works only for {{ifdef}}, but not for {{ifndef}} or {{qif}}.

See also

Source

Copied from the page on meta where it is released under the GFDL.

4 {{Ifdef/doc| {{{1|x}}} | {{{1|x}}} for an u}} 4 ==Documentation==

{{ifdef/doc}} is a compact variant of {{Qif}} for simple "if defined then do" statements without else part. It's the opposite of {{ifndef}}.

Usage

{{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}}}}}}


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.

Caveats

In templates the characters "=" (&#61;) and "|" (&#124;) cannot be used as is in parameters. The numeric character references &#61; and &#124; are often good enough, but for Wiki and XHTML markup the literal characters are required:

  1. For | template:! (edittalklinkshistory) offers a workaround.
  2. For = the template parameter mechanism allows {{ifdef}} resulting in "ok=yes" instead of {{ifdef}} resulting in "{{{2}}}".

Substitution works only for {{ifdef}}, but not for {{ifndef}} or {{qif}}.

See also

Source

Copied from the page on meta where it is released under the GFDL.

5 {{Ifdef/doc| {{{ 1 }}} | {{{1}}} bad idea}} 5 ==Documentation==

{{ifdef/doc}} is a compact variant of {{Qif}} for simple "if defined then do" statements without else part. It's the opposite of {{ifndef}}.

Usage

{{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}}}}}}


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.

Caveats

In templates the characters "=" (&#61;) and "|" (&#124;) cannot be used as is in parameters. The numeric character references &#61; and &#124; are often good enough, but for Wiki and XHTML markup the literal characters are required:

  1. For | template:! (edittalklinkshistory) offers a workaround.
  2. For = the template parameter mechanism allows {{ifdef}} resulting in "ok=yes" instead of {{ifdef}} resulting in "{{{2}}}".

Substitution works only for {{ifdef}}, but not for {{ifndef}} or {{qif}}.

See also

Source

Copied from the page on meta where it is released under the GFDL.

6 {{Ifdef/doc| {{!}} |see also {{Tlx|Qif}} }} 6 ==Documentation==

{{ifdef/doc}} is a compact variant of {{Qif}} for simple "if defined then do" statements without else part. It's the opposite of {{ifndef}}.

Usage

{{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}}}}}}


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.

Caveats

In templates the characters "=" (&#61;) and "|" (&#124;) cannot be used as is in parameters. The numeric character references &#61; and &#124; are often good enough, but for Wiki and XHTML markup the literal characters are required:

  1. For | template:! (edittalklinkshistory) offers a workaround.
  2. For = the template parameter mechanism allows {{ifdef}} resulting in "ok=yes" instead of {{ifdef}} resulting in "{{{2}}}".

Substitution works only for {{ifdef}}, but not for {{ifndef}} or {{qif}}.

See also

Source

Copied from the page on meta where it is released under the GFDL.

7 {{Ifdef/doc| okay | 2=see=[[#Caveats]] }} 7 ==Documentation==

{{ifdef/doc}} is a compact variant of {{Qif}} for simple "if defined then do" statements without else part. It's the opposite of {{ifndef}}.

Usage

{{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}}}}}}


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.

Caveats

In templates the characters "=" (&#61;) and "|" (&#124;) cannot be used as is in parameters. The numeric character references &#61; and &#124; are often good enough, but for Wiki and XHTML markup the literal characters are required:

  1. For | template:! (edittalklinkshistory) offers a workaround.
  2. For = the template parameter mechanism allows {{ifdef}} resulting in "ok=yes" instead of {{ifdef}} resulting in "{{{2}}}".

Substitution works only for {{ifdef}}, but not for {{ifndef}} or {{qif}}.

See also

Source

Copied from the page on meta where it is released under the GFDL.

8 {{Ifdef/doc| oops | see=[[#Caveats]] }} 8 ==Documentation==

{{ifdef/doc}} is a compact variant of {{Qif}} for simple "if defined then do" statements without else part. It's the opposite of {{ifndef}}.

Usage

{{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}}}}}}


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.

Caveats

In templates the characters "=" (&#61;) and "|" (&#124;) cannot be used as is in parameters. The numeric character references &#61; and &#124; are often good enough, but for Wiki and XHTML markup the literal characters are required:

  1. For | template:! (edittalklinkshistory) offers a workaround.
  2. For = the template parameter mechanism allows {{ifdef}} resulting in "ok=yes" instead of {{ifdef}} resulting in "{{{2}}}".

Substitution works only for {{ifdef}}, but not for {{ifndef}} or {{qif}}.

See also

Source

Copied from the page on meta where it is released under the GFDL.

See also a simpler example using ifdef. There's no default in ifdef for the second parameter, because this could hide problematic code.

Caveats

In templates the characters "=" (&#61;) and "|" (&#124;) cannot be used as is in parameters. The numeric character references &#61; and &#124; are often good enough, but for Wiki and XHTML markup the literal characters are required:

  1. For | template:! (edittalklinkshistory) offers a workaround.
  2. For = the template parameter mechanism allows {{ifdef}} resulting in "ok=yes" instead of {{ifdef}} resulting in "{{{2}}}".

Substitution works only for {{ifdef}}, but not for {{ifndef}} or {{qif}}.

See also

Source

Copied from the page on meta where it is released under the GFDL.