Misplaced Pages

Template:!: Difference between revisions

Article snapshot taken from Wikipedia with creative commons attribution-sharealike license. Give it a read and then ask your questions in the chat. We can research this topic together.
Browse history interactively← Previous editNext edit →Content deleted Content addedVisualWikitext
Revision as of 18:38, 28 November 2020 view sourceSeventyfiveyears (talk | contribs)Extended confirmed users4,114 edits Misplaced Pages:Templates for discussion/Log/2020 November 21#Template:! closed as keepTag: Manual revert← Previous edit Revision as of 21:00, 25 December 2020 view source GKFX (talk | contribs)Extended confirmed users13,131 edits Add actual documentation.Next edit →
Line 1: Line 1:
<includeonly>{{error|Error: The retired template {{tn|!}} has been transcluded; see ] for details. To fix this, use only the code {{Magic word|!}} to generate the &#124; character.}} <includeonly>{{error|Error: The retired template {{tn|!}} has been transcluded; see ] for details. To fix this, use only the code {{Magic word|!}} to generate the &#124; character.}}
</includeonly><noinclude>{{pp|small=yes}}{{Soft redirect|mw:Help:Magic words#Other}} </includeonly><noinclude>{{pp|small=yes}}
'''<nowiki>{{!}}</nowiki>''' is not a template; it is a magic word. It may be used exactly like a template however, with the caveat that you must not pass parameters.

The code <code><nowiki>{{!}}</nowiki></code> is used to ] the vertical bar character, &#124;, so that it is interpreted later than it otherwise would. This is mostly useful when trying to include a table in a template. For example,

<pre>
{{rquote|none|text=
{| class="wikitable"
|+ Caption text
|-
! Header text !! Header text
|-
| Example || Example
|-
| Example || Example
|}
}}
</pre>

yields nonsense:

{{rquote|none|text=
{| class="wikitable"
|+ Caption text
|-
! Header text !! Header text
|-
| Example || Example
|-
| Example || Example
|}
}}

However escaping the bars with this magic word and similar templates gives:

<pre>
{{rquote|none|<nowiki>
</nowiki>{{{!}} class{{=}}"wikitable"
{{!}}+ Caption text
{{!}}-
! Header text !! Header text
{{!}}-
{{!}} Example {{!!}} Example
{{!}}-
{{!}} Example {{!!}} Example
{{!}}}
}}
</pre>

{{rquote|none|<nowiki>
</nowiki>{{(!}} class{{=}}"wikitable"
{{!}}+ Caption text
{{!}}-
! Header text !! Header text
{{!}}-
{{!}} Example {{!!}} Example
{{!}}-
{{!}} Example {{!!}} Example
{{!)}}
}}

==See also==
Documentation for the magic word may be found in the MediaWiki documentation at ].
* ]
* {{tlx|(!}} Open table
* {{tlx|!)}} Close table
*]

]</noinclude> ]</noinclude>

Revision as of 21:00, 25 December 2020

{{!}} is not a template; it is a magic word. It may be used exactly like a template however, with the caveat that you must not pass parameters.

The code {{!}} is used to escape the vertical bar character, |, so that it is interpreted later than it otherwise would. This is mostly useful when trying to include a table in a template. For example,

{{rquote|none|text=
{| class="wikitable"
|+ Caption text
|-
! Header text !! Header text
|-
| Example || Example
|-
| Example || Example
|}
}}

yields nonsense:

{
— - Header text Header text

, -

However escaping the bars with this magic word and similar templates gives:

{{rquote|none|
{{{!}} class{{=}}"wikitable"
{{!}}+ Caption text
{{!}}-
! Header text !! Header text
{{!}}-
{{!}} Example {{!!}} Example
{{!}}-
{{!}} Example {{!!}} Example
{{!}}}
}}
Caption text
Header text Header text
Example Example
Example Example

See also

Documentation for the magic word may be found in the MediaWiki documentation at mw:Help:Magic words#Other.

Category: