Revision as of 10:08, 4 April 2021 view sourceGKFX (talk | contribs)Extended confirmed users13,131 edits →top: add reason= to transclusionless← Previous edit | Revision as of 19:20, 16 June 2021 view source CJDOS (talk | contribs)Extended confirmed users9,057 editsm The link further down to the MediaWiki Help page is appropriate as it specifically talks about MediaWiki, but there needs to be an internal (Misplaced Pages) link also; added.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 | 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 | character.}} | ||
] | ] | ||
</includeonly><noinclude>{{transclusionless|reason=it was replaced with a magic word}}{{doc|heading=] Magic word documentation}} | </includeonly><noinclude>{{transclusionless|reason=it was replaced with a ]}}{{doc|heading=] Magic word documentation}} | ||
</noinclude> | </noinclude> |
Revision as of 19:20, 16 June 2021
This template may have no transclusions, because it was replaced with a magic word. |
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 {{!)}} }}
“ |
|
” |
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></nowiki>{{(!}}class{{=}}"wikitable" {{!}}+ Example table with two columns ! A column ! Another column {{!}}- {{!}} Some data {{!}} Some more data {{!)}}<nowiki></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
- This is a note before
-
Example table with two columns A column Another column Some data Some more data - This is a note after
See also
Template call (m for magic word) |
Output (delayed interpretation as wikimarkup) | HTML alternative (never interpreted as wikimarkup) |
---|---|---|
{{!}} (m) |
| | | or {{pipe}} |
{{=}} (m) |
= | = |
{{!!}} |
|| | || |
{{!(}} |
[ | [ |
{{)!}} |
] | ] |
{{!((}} |
[[ | [[ |
{{))!}} |
]] | ]] |
{{(}} |
{ | { |
{{)}} |
} | } |
{{((}} |
{{ | {{ |
{{))}} |
}} | }} |
{{(((}} |
{{{ | {{{ |
{{)))}} |
}}} | }}} |
{{(!}} |
{| | {| |
{{!+}} |
|+ | |+ |
{{!-}} |
|- | |- |
{{!)}} |
|} | |} |
Documentation for the magic word may be found in the MediaWiki documentation at mw:Help:Magic words#Other.
- {{pipe}}, a template that uses the numeric character reference for the vertical bar character
- m:Help:Template#A parameter value containing a pipe character
- Help:Conditional tables
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: