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 editContent deleted Content addedVisualWikitext
Revision as of 02:05, 10 May 2006 view sourceCBDunkerson (talk | contribs)Administrators15,424 edits Putting in customized message box since the standard 'esoteric' does not really describe the situation with this template accurately.← Previous edit Latest revision as of 00:06, 2 December 2024 view source Kanashimi (talk | contribs)Extended confirmed users, Rollbackers3,411 edits fix 
(59 intermediate revisions by 42 users not shown)
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.}}
|<noinclude>
]
{| class="messagebox" style="clear: both;"
</includeonly><noinclude>{{Documentation|heading=] Magic word documentation}}
|-
| align="center" | ]
| align="left" width="95%" | This template is used in conjunction with '''''optional''''' parameters: see the ] for details.
----
This template is related to some extremely complicated and esoteric features of template syntax.
Please do not attempt to alter it unless you are certain that you understand the setup '''and''' are prepared to repair any consequent collateral damage if the results are unexpected. Any experiments should be conducted in the ] or your user space.
|}
]
----
This is an auxiliary template allowing to encode "<code>|</code>"
within template parameters. It is '''unnecessary''' to get a
"<code>|</code>" in these cases, better use "<code>&amp;#124;</code>"
for this purpose. However the "<code>|</code>" delimiter for a
Wiki table has to be escaped by a template if it's used
within a template, see also ].

Note that there's no such problem with "<code>!</code>" (exclamation mark), it
only affects "<code>|</code>" (vertical bar) in conjunction
with the ] mechanism within tables.

For obvious reasons this is a '''high risk template''',
and it cannot be ].

{{Lts|{{PAGENAME}}}}

]
]
]
]
</noinclude> </noinclude>

Latest revision as of 00:06, 2 December 2024

Magic word documentation[view] [edit] [history] [purge]
This template should have no transclusions, because it was replaced with a magic word.

The magic word {{!}} is used to escape a vertical bar character "|" in wikitext markup, causing the parser to temporarily not interpret it as a special character.

This used to be a template, but for speed reasons, the MediaWiki parser was changed in July 2014 to instantly interpret {{!}} as "|" and ignore this template, making {{!}} a magic word. You can continue to use the code in exactly the same way as before.

Do not use syntax like {{Template:!}}, and do not supply a parameter, for example {{!|foo}}. In those cases, the template transcludes as an error message: Error: The retired template {{!}} has been transcluded; see mw:Help:Magic words#Other for details. To fix this, use only the code {{!}} to generate the | character.


Usage

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

{{cquote|text=
{| class="wikitable"
|+ Caption text
|-
! Header text !! Header text
|-
| Example1 || Example2
|-
| Example3 || Example4
|}
}}

yields nonsense:

{

— Example1

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

{{cquote|text=
{{(!}} class{{=}}"wikitable"
{{!+}} Caption text
{{!-}}
! Header text !! Header text
{{!-}}
{{!}} Example1 {{!!}} Example2
{{!-}}
{{!}} Example3 {{!!}} Example4
{{!)}}
}}


Caption text
Header text Header text
Example1 Example2
Example3 Example4

For how to include a table in a footnote, do:

Example 1{{refn|group=note|This is a note before}}
Example 2{{refn|group=note|1=<nowiki />{{(!}}class{{=}}"wikitable"
{{!+}} Example table with two columns
! A column
! Another column
{{!-}}
{{!}} Some data
{{!}} Some more data
{{!)}}<nowiki />}}
Example 3{{refn|group=note|This is a note after}}
==Notes==
{{Reflist|group=note}}

Be careful to follow this formatting, otherwise the table may gobble up the subsequent footnote. This can be unnoticeable if there is only one footnote, only causing an issue if a second footnote is added.

Example 1

Example 2

Example 3

Notes

  1. This is a note before
  2. Example table with two columns
    A column Another column
    Some data Some more data
  3. This is a note after

See also

This table:
Template call
(m for magic word)
Output (delayed interpretation as wikimarkup) HTML alternative (never interpreted as wikimarkup)
{{!}} (m) | &#124; or {{pipe}}
{{=}} (m) = &#61;
{{!!}} || &#124;&#124;
{{!(}} [ &#91;
{{)!}} ] &#93;
{{!((}} [[ &#91;&#91;
{{))!}} ]] &#93;&#93;
{{(}} { &#123;
{{)}} } &#125;
{{((}} {{ &#123;&#123;
{{))}} }} &#125;&#125;
{{(((}} {{{ &#123;&#123;&#123;
{{)))}} }}} &#125;&#125;&#125;
{{(!}} {| &#123;&#124;
{{!+}} |+ &#124;&#43;
{{!-}} |- &#124;&#45;
{{!)}} |} &#124;&#125;

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

The above documentation is transcluded from Template:!/doc. (edit | history)
Editors can experiment in this template's sandbox (create | mirror) and testcases (create) pages.
Add categories to the /doc subpage. Subpages of this template. Categories: