Template:Unichar2
| This template uses Lua: |
Like {{Unichar}}, this template produces a formatted description of a Unicode character, to be used inline or otherwise with regular text.
Usage
[edit]This template takes a Unicode character as input.
The character {{unichar2|©}} is about intellectual property.→- The character U+00A9 © COPYRIGHT SIGN is about intellectual property.
It otherwise behaves the same as {{unichar}} (where the primary input is a Unicode codepoint).
Parameters
[edit]The blank template, with all parameters, is as follows:
{{unichar2
| ulink =
| image =
| cwith =
| suffix =
| size =
| use =
| use2 =
| nlink =
| html =
| note =
| name =
| alias =
}}
Inline version:
{{unichar2| <!--character-->|ulink= |image= |cwith= |suffix= |size= |use= |use2= |nlink= |html= |note= }}
- First unnamed parameter or
|1=(Required) The character to be displayed.{{unichar2|u}}→ U+0075 u LATIN SMALL LETTER U
- Note: Only the first code point is read; any subsequent characters—even combining characters—are ignored
{{unichar2|uͤ}}→ U+0075 u LATIN SMALL LETTER U
|nlink=nameOptional hyperlink to the target article. Name of the Wikipedia page that will be linked to. If used, the Unicode name has a wikilink to the article.{{unichar|00A9|nlink=}}→ U+00A9 © COPYRIGHT SIGN{{unichar|00A9|nlink=Copyright symbol}}→ U+00A9 © COPYRIGHT SIGN- Notes:
- The form
nlink=(without any detail) is the most common way to use this option, to link to the article about the symbol using its canonical name. - When used without a name (i.e.,
|nlink=, blank with no value), the link points to the article about the character itself except when that causes a problem with technical restrictions on naming, in which case the name of the character is used or an error is produced if no such name exists (see § Presentation effects). - The name of the page is case-sensitive as with all Wikipedia pages.
- It is possible to give a Wiktionary page here, using the syntax
nlink=wikt:<target article>, which may be appropriate if there is no suitable Wikipedia article. For example:{{unichar|204A|nlink=wikt:⁊}}→ U+204A ⁊ TIRONIAN SIGN ET
- Use of this parameter to link to any article other than the one at the canonical name (even if that is a redirect) is potentially an intuitive linking violation, so such use is exceptional and must have a clear justification. ['Copyright sign' and 'copyright symbol' are used here for illustration only and
nlinkwould not normally be used in this case.]
- The form
|cwith=Optional. The only valid content is ◌ or (or its HTML code, ◌). It may also be used without any content (i.e.,|cwith=, blank with no value). This parameter is useful when the Unicode character is combining (such as a combining diacritic). Using|cwith=◌, the character will be combined with the placeholder symbol, U+25CC ◌ DOTTED CIRCLE.- without a
|cwith=:{{unichar|0485}}→ U+0485 ҅ COMBINING CYRILLIC DASIA PNEUMATA
|cwith=with dotted circle:{{unichar|0485|cwith=◌}}→ U+0485 ◌҅ COMBINING CYRILLIC DASIA PNEUMATA or{{unichar|0485|cwith=◌}}→ U+0485 ◌҅ COMBINING CYRILLIC DASIA PNEUMATA
|cwith=without an argument:{{unichar|0485|cwith=}}→ U+0485 ◌҅ COMBINING CYRILLIC DASIA PNEUMATA
- Note that
cwith=◌◌alone does not provide the desired result if the intention is to display a diacritic that spans two characters (such as those in the range U+035C to U+0362): the diacritic will be offset. In such cases, editors must usecwith=◌together withsuffix=◌to place two dotted circles – one on either side of the codepoint for the combining diacritic.{{unichar|035F|cwith=◌|suffix=◌}}→ U+035F ◌͟◌ COMBINING DOUBLE MACRON BELOW
- Use of any other character except dotted circle as input to
|cwith=is deprecated; this restriction is not currently enforced but if any other character is used, the output (grapheme and description) is at best misleading. - For scripts other than Latin, use of the parameters
use=langanduse2=may additionally be needed for better rendering.
- without a
|suffix=Optional. Its contents directly follow the character. The only supported uses of this parameter are for diacritics that span two characters (see|cwith=above) and for appending variation selectors to certain characters.- For example, using U+FE0E ︎ VARIATION SELECTOR-15 which forces emoji to display as text, one can have:
{{unichar|01F604|suffix=︎|note=with {{unichar|FE0E}}}}→ U+1F604 😄︎ SMILING FACE WITH OPEN MOUTH AND SMILING EYES (with U+FE0E ︎ VARIATION SELECTOR-15)- Since variation selectors change the appearance of the character, their presence should always be mentioned in a
|note=or in prose. - The Unicode Consortium has decided that it was a mistake to unify traditional and emoji forms, so the 'variation selector' method should be regarded as at best time-limited. It is already not fully functional on some plaforms such as Google Android, always preferring the emoji form. See Variation Selectors (Unicode block).
- Since variation selectors change the appearance of the character, their presence should always be mentioned in a
|html=Optional. If a named character reference exists, like" ", it is displayed after the character name. Otherwise nothing happens. In particular, numeric character references like are never displayed. Only the existence of an|html=parameter is checked, everything after the equal sign is ignored so you can leave it blank.{{unichar|160|html=}}→ U+0160 Š LATIN CAPITAL LETTER S WITH CARON (Š)
|note=Optional. Adds a comment such as a clarification or explanatory note. For example, as the canonical names of ideographs are not generally helpful, thenote=option permits an added comment such as U+4E95 井 CJK UNIFIED IDEOGRAPH-4E95 (jǐng)|ulink=Optional. Creates a wikilink from theU+prefix. When used without a name (i.e.,|ulink=, blank with no value), the article Unicode is used as the default value in the output:[[Unicode|U+]]producing U+. This only needs to change if you have a reason to link elsewhere than Unicode, e.g. to an article on a subset of Unicode characters.|use=Optional. Sets the font-hinting template to get the glyph, since the character may not be present in a regular browser font. By default no template is used; the available options are{{IPA}},{{lang}}and{{script}}.|use2=Optional. When setting|use=langor|use=script,|use2=should be used to set the language (e.g.|use2=fr) or the script (e.g.|use2=Cyrs). A glyph may still not show as expected due to browser effects. For a detailed description, see each template's documentation.|image=Optional. Allows for a graphic image file to represent the glyph; overrides the font completely. The filename should include the extension (like.svgor.png), but not the prefixFile:.- Depending on the image used,
class=skin-invertmight be needed so the image displays correctly in dark mode. Compare: - This option is rarely needed: it is intended for use with characters that have been given a codepoint but have yet to be included in mainstream system fonts. It is good practice to add a (hidden) comment to explain why its use has been needed, as in time that will cease to be the case. It is no longer appropriate to use it with the Indian Rupee sign, for example.
- Depending on the image used,
|size=Optional. Can be used to set the size of the glyph. The default value is125%. For the font, all CSS font-size style inputs are accepted:7px,150%,2em,larger.- For example,
{{unichar|0041|size=2em}}→ U+0041 A LATIN CAPITAL LETTER A - When using an image (file) instead of a font, this size can only accept sizes in
pxlike12px. Default for images is10px.
- For example,
|name=. Optional; if used, the only permitted content is none. This parameter is provided for the rare cases where only the code-point and the corresponding character are wanted.- For example,
{{unichar|a9|name=none}}produces U+00A9 © .
- For example,
|alias=. Optional; if used, the only permitted content is yes. The purpose of this parameter is to handle the very rare cases where the Unicode Consortium has identified that a name is seriously defective and misleading, or has a serious typographical error, and has defined a formal alias that applications are encouraged to use in place of the official character name. (See Unicode#Alias for details.)- For example, U+A015 YI SYLLABLE WU has the formal alias YI SYLLABLE ITERATION MARK. Thus, rather than
{{unichar|A015}}→ U+A015 ꀕ YI SYLLABLE WU, the style{{unichar|A015|alias=yes}}→ U+A015 ꀕ YI SYLLABLE ITERATION MARK is preferred in most contexts.
- For example, U+A015 YI SYLLABLE WU has the formal alias YI SYLLABLE ITERATION MARK. Thus, rather than
Limitations
[edit]MediaWiki applies Normalization Form C to every edit. This means that some characters cannot be displayed using this template because they will be converted to the corresponding normalized character(s). For example, putting the character U+2126 Ω OHM SIGN into this template and saving the edit will result in U+03A9 Ω GREEK CAPITAL LETTER OMEGA. The workaround for this is to simply use {{unichar}} instead.
Tracking
[edit]TemplateData
[edit]TemplateData for Unichar2
Formats a Unicode character description inline.
| Parameter | Description | Type | Status | |
|---|---|---|---|---|
| Character | 1 | A single Unicode character
| String | required |
| ulink | ulink | Add link to the Unicode HEX code point
| Line | optional |
| nlink | nlink | Add link to the Unicode character name | String | optional |
| cwith | cwith | (for combing characters only) add the following character before this combining character:
| String | optional |
| size | size | Relative size of rendered character
| String | optional |
| image | image | no description | Unknown | optional |
| use | use | no description | String | optional |
| use2 | use2 | no description | String | optional |
| HTML code | html | When present, shows HTML named entity
| String | optional |
| note | note | no description | Line | optional |
| alias | alias | no description
| Unknown | optional |
| name | name | Hide the name of the character
| Unknown | optional |
| suffix | suffix | no description | Unknown | optional |