Template talk:!: Difference between revisions
Morgan Blair (talk | contribs) (fix links) |
The Rooster (talk | contribs) No edit summary |
||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
==Documentation== | |||
If you want to display a pipe as plain text without it being parsed by the wiki, just use {{CodeInline||}}, which can be used in wiki tables and inside template variables without any problems. | |||
If you need to put wiki table code into the variable of a template, you will need to replace your pipes with a call to this template like so {{CodeInline|<nowiki>{{!}}</nowiki>}}. This will prevent the wiki from thinking there are pipes separating one variable from another when you set up the template, but will become a "real" pipe when the template is called, meaning the wiki will then treat it as part of your table syntax. This is often used as a reult of selection templates such as {{tl|if}}, {{tl|ifdef}} and {{tl|ifndef}}. | |||
For example, here we use {{tl|ifdef}} on two imaginary variables, the first is defined but the second is not. So only the first should appear in the table. | |||
<pre> | |||
{| style="border:1px solid black" | |||
{{ifdef|x|2={{!}} style="color:red" {{!}} If you see me, the first variable is defined.}} | |||
|- | |||
{{ifdef||2={{!}} style="color:blue" {{!}} If you see me, the second variable is defined.}} | |||
|} | |||
</pre> | |||
The result: | |||
{| style="border:1px solid black" | |||
{{ifdef|x|2={{!}} style="color:red" {{!}} If you see me, the first variable is defined.}} | |||
|- | |||
{{ifdef||2={{!}} style="color:blue" {{!}} If you see me, the second variable is defined.}} | |||
|} |
Latest revision as of 01:46, 22 September 2010
Documentation
If you want to display a pipe as plain text without it being parsed by the wiki, just use |, which can be used in wiki tables and inside template variables without any problems.
If you need to put wiki table code into the variable of a template, you will need to replace your pipes with a call to this template like so {{!}}. This will prevent the wiki from thinking there are pipes separating one variable from another when you set up the template, but will become a "real" pipe when the template is called, meaning the wiki will then treat it as part of your table syntax. This is often used as a reult of selection templates such as {{if}}, {{ifdef}} and {{ifndef}}.
For example, here we use {{ifdef}} on two imaginary variables, the first is defined but the second is not. So only the first should appear in the table.
{| style="border:1px solid black" {{ifdef|x|2={{!}} style="color:red" {{!}} If you see me, the first variable is defined.}} |- {{ifdef||2={{!}} style="color:blue" {{!}} If you see me, the second variable is defined.}} |}
The result:
If you see me, the first variable is defined. |