Difference between revisions of "Template:Charmap/doc"

From blackwiki
Jump to navigation Jump to search
imported>Vanisaac
(→‎Example: Introducing SMP character for UTF-16 functionality)
imported>Vanisaac
(→‎Example: Made second example with UTF-16, but no named character reference)
Line 48: Line 48:
 
For double byte, or other two code-unit encodings, each of the bytes can be separately converted to decimal if the code units are separated with a space. Greater than two code-unit input will erroneously convert only the first and last to decimal.
 
For double byte, or other two code-unit encodings, each of the bytes can be separately converted to decimal if the code units are separated with a space. Greater than two code-unit input will erroneously convert only the first and last to decimal.
  
==Example==
+
==Examples==
 +
 
 +
Example with automatic XML named character references, explicit named reference, single and double byte character mappings, alternate image, and mixed casing of inputs.
  
 
<div style="font-size:100%;">
 
<div style="font-size:100%;">
Line 54: Line 56:
 
  | 0398 | name1 = Greek Capital Letter Theta <br />
 
  | 0398 | name1 = Greek Capital Letter Theta <br />
 
  | 3b8 | name2 = Greek Small Letter Theta | image2=<nowiki>[[File:Greek lc theta.png|10px]]</nowiki><br />
 
  | 3b8 | name2 = Greek Small Letter Theta | image2=<nowiki>[[File:Greek lc theta.png|10px]]</nowiki><br />
| 10338 | name3 = Gothic Letter Thuth<br />
 
 
  | map1 = <nowiki>[[ISO 8859-7]]</nowiki> | map1char1 = c8 | map1char2 = E8 <br />
 
  | map1 = <nowiki>[[ISO 8859-7]]</nowiki> | map1char1 = c8 | map1char2 = E8 <br />
 
  | map2 = <nowiki>[[Code page 737|CP 737]]</nowiki> | map2char1 = 87 | map2char2 = 9F <br />
 
  | map2 = <nowiki>[[Code page 737|CP 737]]</nowiki> | map2char1 = 87 | map2char2 = 9F <br />
Line 70: Line 71:
 
  | 0398 | name1 = Greek Capital Letter Theta  
 
  | 0398 | name1 = Greek Capital Letter Theta  
 
  | 3b8 | name2 = Greek Small Letter Theta | image2=[[File:Greek lc theta.png|10px]]
 
  | 3b8 | name2 = Greek Small Letter Theta | image2=[[File:Greek lc theta.png|10px]]
| 10338 | name3 = Gothic Letter Thuth
 
 
  | map1 = [[ISO 8859-7]] | map1char1 = c8 | map1char2 = E8
 
  | map1 = [[ISO 8859-7]] | map1char1 = c8 | map1char2 = E8
 
  | map2 = [[Code page 737|CP 737]] (MS-DOS Greek) | map2char1 = 87 | map2char2 = 9F
 
  | map2 = [[Code page 737|CP 737]] (MS-DOS Greek) | map2char1 = 87 | map2char2 = 9F
Line 80: Line 80:
 
  | map8 = [[Shift JIS]] | map8char1 = 83 A6 | map8char2 = 83 C6
 
  | map8 = [[Shift JIS]] | map8char1 = 83 A6 | map8char2 = 83 C6
 
  | namedref1 = [[TeX]] | ref1char1 = \Theta | ref1char2 = \theta
 
  | namedref1 = [[TeX]] | ref1char1 = \Theta | ref1char2 = \theta
 +
}}
 +
 +
 +
Example with automatic UTF-16 mappings, but no XML named character reference.
 +
 +
<div style="font-size:100%;">
 +
<nowiki>{{</nowiki>charmap <br />
 +
| 2C90 | name1 = Coptic Capital Letter Thethe<br />
 +
| 2C91 | name2 = Coptic Small Letter Thethe<br />
 +
| 10338 | name3 = Gothic Letter Thuth<br />
 +
<nowiki>}}</nowiki>
 +
</div>
 +
{{charmap
 +
| 2C90 | name1 = Coptic Capital Letter Thethe
 +
| 2C91 | name2 = Coptic Small Letter Thethe
 +
| 10338 | name3 = Gothic Letter Thuth
 
  }}
 
  }}
  

Revision as of 19:41, 31 January 2013

Template creates a standard computer encoding table for writing system character articles. It is based on the tables currently found on most Cyrillic letter pages.

Usage

{{charmap
| 1st character Unicode code point
| 2nd character Unicode code point
...
| 10th character Unicode code point

| image1 = alternate picture for 1st character
| image2 = alternate picture for 2nd character
...
| image10 = alternate picture for 10th character

| name1 = 1st character name
| name2 = 2nd character name
...
| name10 = 10th character name

| map1 = 1st alternate encoding name
| map1char1 = 1st character code in 1st alternate encoding
| map1char2 = 2nd character code in 1st alternate encoding
...
| map1char10 = 10th character code in 1st alternate encoding
...
| map2 = 2nd alternate encoding name
...
| map10 = 10th alternate encoding name
...
|map10char10 = 10th character code in 10th alternate encoding
| namedref1 = 1st named character reference
| ref1char1 = 1st character code in 1st named character reference
| ref1char2 = 2nd character code in 1st named character reference
...
| ref1char10 = 10th character code in 1st named character reference
...
| namedref2 = 2nd named character reference
...
| namedref5 = 5th named character reference
...
| ref5char10 = 10th character code in 5th named character reference
}}

All character codes should be entered as bare hexadecimal numbers, ie Unicode code points should not be preceded by "U+" and decimal convention encodings should still specify code points by hex value. Hex characters are case insensitive, and will always appear in the template as capitalized code points, no matter the casing of the input. HTML named character references are automatically generated, but any other named character references must be explicitly listed, with any special characters specified using the standard HTML &xxx; format.

All defined characters must be given a character name in order for the table to display that column. Characters not represented in a particular alternate encoding should have a blank or undefined parameter for that encoding.

For double byte, or other two code-unit encodings, each of the bytes can be separately converted to decimal if the code units are separated with a space. Greater than two code-unit input will erroneously convert only the first and last to decimal.

Examples

Example with automatic XML named character references, explicit named reference, single and double byte character mappings, alternate image, and mixed casing of inputs.

{{charmap 
| 0398 | name1 = Greek Capital Letter Theta
| 3b8 | name2 = Greek Small Letter Theta | image2=[[File:Greek lc theta.png|10px]]
| map1 = [[ISO 8859-7]] | map1char1 = c8 | map1char2 = E8
| map2 = [[Code page 737|CP 737]] | map2char1 = 87 | map2char2 = 9F
| map3 = [[Code page 860|CP 860]], [[Code page 861|861]], [[Code page 862|862]], [[Code page 863|863]], [[Code page 865|865]]
| map3char1 = E9
| map4 = [[Code page 869|CP 869]] | map4char1 = Ac | map4char2 = E2
| map5 = [[EBCDIC 875]] | map5char1 = 48 | map5char2 = 9B
| map6 = [[GSM 03.38]] | map6char1 = 19
| map7 = [[TI calculator character sets#TI-86|TI-86]] | map7char2 = c1
| map8 = [[Shift JIS]] | map8char1 = 83 A6 | map8char2 = 83 C6
| namedref1 = [[TeX]] | ref1char1 = \Theta | ref1char2 = \theta }}
Character information
Preview Template:PstpΘTemplate:Pstp&#x[[:Template:Remove;Template:Pstp&#x[[:Template:Remove;Template:Pstp&#x[[:Template:Remove; Greek lc theta.png
Unicode name Template:Smallcaps all Template:Smallcaps all
Encodings decimal hex decimal hex
Unicode Template:Pstp920Template:Pstp0Template:Pstp0Template:Pstp0 U+0398 Template:Pstp952Template:Pstp0Template:Pstp0Template:Pstp0 U+03B8
UTF-8 Template:PstpTemplate:UTF-8Template:PstpTemplate:UTF-8Template:PstpTemplate:UTF-8Template:PstpTemplate:UTF-8 Template:PstpTemplate:UTF-8Template:PstpTemplate:UTF-8Template:PstpTemplate:UTF-8Template:PstpTemplate:UTF-8
UTF-16Template:PstpTemplate:UTF-16Template:PstpTemplate:UTF-16Template:PstpTemplate:UTF-16Template:PstpTemplate:UTF-16 Template:PstpTemplate:UTF-16Template:PstpTemplate:UTF-16Template:PstpTemplate:UTF-16Template:PstpTemplate:UTF-16
Numeric character reference Template:Pstp&#x398;Template:Pstp&#x00;Template:Pstp&#x00;Template:Pstp&#x00; Template:Pstp&#x3B8;Template:Pstp&#x00;Template:Pstp&#x00;Template:Pstp&#x00;
Named character reference Template:Numcr2namecr Template:Numcr2namecr
ISO 8859-7 200 0 0 0 C8 232 0 0 0 E8
CP 737 (MS-DOS Greek) 135 0 0 0 87 159 0 0 0 9F
CP 860, 861, 862, 863, 865 233 0 0 0 E9
CP 869 (MS-DOS Greek 2) 172 0 0 0 AC 226 0 0 0 E2
EBCDIC 875 72 0 0 0 48 155 0 0 0 9B
GSM 03.38 25 0 0 0 19
TI-86 193 0 0 0 C1
Shift JIS 131 0 0 0 83 A6 131 0 0 0 83 C6
TeX \Theta \theta


Example with automatic UTF-16 mappings, but no XML named character reference.

{{charmap 
| 2C90 | name1 = Coptic Capital Letter Thethe
| 2C91 | name2 = Coptic Small Letter Thethe
| 10338 | name3 = Gothic Letter Thuth
}}
Character information
Preview Template:PstpTemplate:Pstp&#x[[:Template:Remove;Template:Pstp&#x[[:Template:Remove;Template:Pstp&#x[[:Template:Remove; Template:PstpTemplate:Pstp&#x[[:Template:Remove;Template:Pstp&#x[[:Template:Remove;Template:Pstp&#x[[:Template:Remove; Template:Pstp𐌸Template:Pstp&#x[[:Template:Remove;Template:Pstp&#x[[:Template:Remove;Template:Pstp&#x[[:Template:Remove;
Unicode name Template:Smallcaps all Template:Smallcaps all Template:Smallcaps all
Encodings decimal hex decimal hex decimal hex
Unicode Template:Pstp11408Template:Pstp0Template:Pstp0Template:Pstp0 U+2C90 Template:Pstp11409Template:Pstp0Template:Pstp0Template:Pstp0 U+2C91 Template:Pstp66360Template:Pstp0Template:Pstp0Template:Pstp0 U+10338
UTF-8 Template:PstpTemplate:UTF-8Template:PstpTemplate:UTF-8Template:PstpTemplate:UTF-8Template:PstpTemplate:UTF-8 Template:PstpTemplate:UTF-8Template:PstpTemplate:UTF-8Template:PstpTemplate:UTF-8Template:PstpTemplate:UTF-8 Template:PstpTemplate:UTF-8Template:PstpTemplate:UTF-8Template:PstpTemplate:UTF-8Template:PstpTemplate:UTF-8
UTF-16Template:PstpTemplate:UTF-16Template:PstpTemplate:UTF-16Template:PstpTemplate:UTF-16Template:PstpTemplate:UTF-16 Template:PstpTemplate:UTF-16Template:PstpTemplate:UTF-16Template:PstpTemplate:UTF-16Template:PstpTemplate:UTF-16 Template:PstpTemplate:UTF-16Template:PstpTemplate:UTF-16Template:PstpTemplate:UTF-16Template:PstpTemplate:UTF-16
Numeric character reference Template:Pstp&#x2C90;Template:Pstp&#x00;Template:Pstp&#x00;Template:Pstp&#x00; Template:Pstp&#x2C91;Template:Pstp&#x00;Template:Pstp&#x00;Template:Pstp&#x00; Template:Pstp&#x10338;Template:Pstp&#x00;Template:Pstp&#x00;Template:Pstp&#x00;
Named character reference Template:Numcr2namecr Template:Numcr2namecr Template:Numcr2namecr

Technical

This template uses several sub-templates, including

  • /head - displays the UTF-8/numeric character reference sections
  • /alt - displays alternate encodings
  • /named - displays named character references

It is dependent on the following transcluded templates

and the magic words / parser functions #if:, padleft:, and uc:.