Jump to content

Template:!/doc: Difference between revisions

From SeptemWiki
No edit summary
No edit summary
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{metatemplate}}
{{metatemplate}}


This template is used inside other templates to generate a vertical bar (<tt>|</tt>), since doing so would confuse the template syntax parser.  You would primarily use this if your template generated a table.
{{tx|!}}


  <nowiki>{{!}}</nowiki>
This template is used inside conditionals or parameter strings to generate a vertical bar (<code>|</code>), since using the vertical bar itself would confuse the template syntax parser. You would primarily use this if your template generated a table, but needed to put some of the table in a conditional like {{c|<nowiki>{{#if: ...}}</nowiki>}}


  <nowiki>{{{!}}class="wikitable"
  <nowiki>{|class="wikitable"
{{!}}-
|-
!Header 1
!Header 1
!Header 2
!Header 2
{{#if: {{{showcontent|}}}|
{{!}}-
{{!}}-
{{!}}Cell 1
{{!}}Cell 1
{{!}}Cell 2
{{!}}Cell 2 }}
{{!}}-
{{!}}}</nowiki>
 
would turn into:
 
<nowiki>{|class="wikitable"
|-
!Header 1
!Header 2
|-
|Cell 1
|Cell 2
|-
|}</nowiki>
|}</nowiki>


and thus render as:
Since the first vertical bar inside the {{c|#if:}} block introduces the content to use if the condition is met, and a second one would introduce the content to use if the condition is ''not'' met, we cannot use the vertical bar to begin the new row of the table, nor the cells within it, as we normally would in wiki table syntax.  So instead, we wrap the whole row in the {{c|#if:}} block and replace its vertical bars with the {{tx|!}} template.
 
{|class="wikitable"
|-
!Header 1
!Header 2
|-
|Cell 1
|Cell 2
|-
|}

Latest revision as of 18:13, 9 April 2016


{{!}}

This template is used inside conditionals or parameter strings to generate a vertical bar (|), since using the vertical bar itself would confuse the template syntax parser. You would primarily use this if your template generated a table, but needed to put some of the table in a conditional like {{#if: ...}}

{|class="wikitable"
|-
!Header 1
!Header 2
{{#if: {{{showcontent|}}}|
{{!}}-
{{!}}Cell 1
{{!}}Cell 2 }}
|}

Since the first vertical bar inside the #if: block introduces the content to use if the condition is met, and a second one would introduce the content to use if the condition is not met, we cannot use the vertical bar to begin the new row of the table, nor the cells within it, as we normally would in wiki table syntax. So instead, we wrap the whole row in the #if: block and replace its vertical bars with the

{{!}}

template.