Template:Escape template list/doc: Difference between revisions

From Xenharmonic Wiki
Jump to navigation Jump to search
ArrowHead294 (talk | contribs)
ArrowHead294 (talk | contribs)
mNo edit summary
Line 2: Line 2:


=== 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:
For example, to include a table within another table:


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

Revision as of 13:21, 25 January 2025

Template:Docheadwiki

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.

For example, to include a table within another table:

{| 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