Templat:!: Perbedaan antara revisi

Dari Wiki Javasatu
Loncat ke navigasi Loncat ke pencarian
(Created page with "|<noinclude>{{historical|This was a common template on just about every wiki which was replaced in mid 2014 (for 1.24 release) in favour of a parser function doing the same thing. See gerrit:136234}}{{ {{TNTN|documentation}} |content= ''As of 2014 this is now a "magic word", the template can be deleted or kept as dummy.'' This template existed to provide a way to easily escape the raw pipe character (<code><nowiki>|</nowiki></code>) in a situation where markup cont...")
 
Tidak ada ringkasan suntingan
 
Baris 1: Baris 1:
|<noinclude>{{historical|This was a common template on just about every wiki which was replaced in mid 2014 (for 1.24 release) in favour of a parser function doing the same thing. See [[gerrit:136234]]}}{{ {{TNTN|documentation}} |content=
<includeonly>{{error|Error: The retired template {{tn|!}} has been transcluded; see [[mw:Help:Magic words#Other]] for details. To fix this, use only the code {{Magic word|!}} to generate the &#124; character.}}
 
[[Category:Pages which use a template in place of a magic word|M{{PAGENAME}}]]
''As of 2014 this is now a "magic word", the template can be deleted or kept as dummy.''
</includeonly><noinclude>{{Documentation|heading=[[File:Test Template Info-Icon - Version (2).svg|50px|link=|alt=]] Magic word documentation}}
 
</noinclude>
This template existed to provide a way to easily escape the raw pipe character (<code><nowiki>|</nowiki></code>) in a situation where markup containing it (i.e. a {{ll|Help:Tables|wikitable}}) needs to be passed as a parameter to a template. Parser functions will mangle wikitable syntax and pipe characters, treating all the raw pipe characters as parameter dividers. This template 'hides' the pipe from the MediaWiki parser, ensuring that it is not considered until after all the templates and variables on a page have been expanded. It will then be interpreted as a table row or column separator.
 
== See also ==
 
* {{ll|Help:Extension:ParserFunctions#Escaping_pipe_characters_in_tables|Escaping pipe characters in tables}}
 
[[Category:Workaround templates]]
 
}}</noinclude>

Revisi terkini sejak 4 Oktober 2023 17.32

[lihat] [sunting] [riwayat] [hapus singgahan] Magic word documentation

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 Templat:Tn has been transcluded; see mw:Help:Magic words#Other for details. To fix this, use only the code Templat:Magic word to generate the | character.


Usage[sunting sumber]

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:

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[note 1]

Example 2[note 2]

Example 3[note 3]

Notes[sunting sumber]

  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[sunting sumber]

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;&#45;
{{!)}} |} &#124;&#125;

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