Template:Escape template list/doc: Difference between revisions

From Xenharmonic Wiki
Jump to navigation Jump to search
ArrowHead294 (talk | contribs)
mNo edit summary
ArrowHead294 (talk | contribs)
mNo edit summary
 
(11 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{docheadwiki}}
{{dochead}}{{wikipedia}}
Certain characters and character sequences have special meanings in Wiki markup. Sometimes, they need to be escaped, and these templates are used to do so.
 
Escaping these characters using templates simply delays their interpretation as Wiki markup, but if you type them using HTML entities or wrap them in <code>&lt;nowiki&gt;</code> tags, they will never be interpreted as markup.
 
'''Note:''' These escape templates should only be used when absolutely necessary, as overuse of such templates can make pages hard to read and edit in the source editor.


=== Usage ===
=== Usage ===
These templates are used to escape special character sequences, so that they are interpreted later than they would otherwise be. They are most useful when trying to include tables in templates.
These templates are used to escape special character sequences, so that they are interpreted later than they would otherwise be. They are most useful when trying to include tables within other tables or templates.


For example, this table:
The following example shows an instance of including a Wikitable within another Wikitable. This markup:


{| class="wikitable"
<pre<includeonly />>
<nowiki>{| class="wikitable" style="text-align: center;"
|+ style="font-size: 105%;" | Caption text
|+ style="font-size: 105%;" | Caption text
|-
|-
! Header text !! colspan="2" | Header text !! Header text
! Header text !! Header text
|-
|-
| Example 0 || Example 1 || Example 2 || Example 3
| Example 1 || Example 2
|-
|-
| Example 4 || Example 5 || Example 6 || Example 7
| Example 3 || Example 4
|-
|-
| Example 8 || Example 9 || Example 10 || Example 11
| colspan="2" | </nowiki>{{tlx|(!|plaincode}} class{{tlx|{{=}}|plaincode}}"wikitable" style{{tlx|{{=}}|plaincode}}"text-align: center;"
|}
{{tlx|!+|plaincode}} style{{tlx|{{=}}|plaincode}}"font-size: 105%;" {{tlx|!|plaincode}} Caption text
{{tlx|!-|plaincode}}
! Header text !! Header text
{{tlx|!-|plaincode}}
{{tlx|!|plaincode}} Example 5 {{tlx|!!|plaincode}} Example 6
{{tlx|!-|plaincode}}
{{tlx|!|plaincode}} Example 7 {{tlx|!!|plaincode}} Example 8
{{tlx|!)|plaincode}}
<nowiki>|}</nowiki>
</pre>


is generated using:
gives:


<pre>
{| class="wikitable" style="text-align: center;"
{| class="wikitable"
|+ style="font-size: 105%;" | Caption text
|+ style="font-size: 105%;" | Caption text
|-
|-
! Header text !! colspan="2" | Header text !! Header text
! Header text !! Header text
|-
|-
| Example 0 || Example 1 || Example 2 || Example 3
| Example 1 || Example 2
|-
|-
| Example 4 || Example 5 || Example 6 || Example 7
| Example 3 || Example 4
|-
|-
| Example 8 || Example 9 || Example 10 || Example 11
| colspan="2" | {{(!}} class{{=}}"wikitable" style{{=}}"text-align: center;"
|}
</pre>
 
The below markup represents the same table, but with all of the special character sequences escaped. If you were to include this table in another table, or within a template, for example, this is how you would code it:
 
<pre>
{{(!}} class{{=}}"wikitable"
{{!+}} style{{=}}"font-size: 105%;" {{!}} Caption text
{{!+}} style{{=}}"font-size: 105%;" {{!}} Caption text
{{!-}}
{{!-}}
! Header text !! colspan{{=}}"2" {{!}} Header text !! Header text
! Header text !! Header text
{{!-}}
{{!-}}
{{!}} Example 0 {{!!}} Example 1 {{!!}} Example 2 {{!!}} Example 3
{{!}} Example 5 {{!!}} Example 6
{{!-}}
{{!-}}
{{!}} Example 4 {{!!}} Example 5 {{!!}} Example 6 {{!!}} Example 7
{{!}} Example 7 {{!!}} Example 8
{{!-}}
{{!}} Example 8 {{!!}} Example 9 {{!!}} Example 10 {{!!}} Example 11
{{!)}}
{{!)}}
</pre>
|}

Latest revision as of 14:10, 6 May 2025

English Wikipedia has an article on:

Certain characters and character sequences have special meanings in Wiki markup. Sometimes, they need to be escaped, and these templates are used to do so.

Escaping these characters using templates simply delays their interpretation as Wiki markup, but if you type them using HTML entities or wrap them in <nowiki> tags, they will never be interpreted as markup.

Note: These escape templates should only be used when absolutely necessary, as overuse of such templates can make pages hard to read and edit in the source editor.

Usage

These templates are used to escape special character sequences, so that they are interpreted later than they would otherwise be. They are most useful when trying to include tables within other tables or templates.

The following example shows an instance of including a Wikitable within another Wikitable. This markup:

{| class="wikitable" style="text-align: center;"
|+ style="font-size: 105%;" | Caption text
|-
! Header text !! Header text
|-
| Example 1 || Example 2
|-
| Example 3 || Example 4
|-
| colspan="2" | {{(!}} class{{=}}"wikitable" style{{=}}"text-align: center;"
{{!+}} style{{=}}"font-size: 105%;" {{!}} Caption text
{{!-}}
! Header text !! Header text
{{!-}}
{{!}} Example 5 {{!!}} Example 6
{{!-}}
{{!}} Example 7 {{!!}} Example 8
{{!)}}
|}

gives:

Caption text
Header text Header text
Example 1 Example 2
Example 3 Example 4
Caption text
Header text Header text
Example 5 Example 6
Example 7 Example 8