(Translated by https://www.hiragana.jp/)
Template:Unichar - Wikipedia コンテンツにスキップ

Template:Unichar

Error using {{unichar}}: Input "" is not a hexadecimal value (expected: like "09AF")

このテンプレートは本文ほんぶんちゅうUnicode文字もじ書式しょしきされた記述きじゅつ生成せいせいするためにインラインで使用しようされます。

  • {{unichar|a9|Copyright sign}}著作ちょさくけん表示ひょうじのための記号きごうです。
U+00A9 © copyright sign著作ちょさくけん表示ひょうじのための記号きごうです。

使用しようほう

[編集へんしゅう]

つぎのようにUnicodeの16しん名称めいしょう入力にゅうりょくして使つかいます。{{unichar|00A9|Copyright sign}}U+00A9 © copyright sign.

このテンプレートは"U+00A9"のような文字もじ標準ひょうじゅんのUnicode提示ていじ形式けいしきしたがい、small caps使用しようすることにより、文字もじ名称めいしょうすべ大文字おおもじ表記ひょうきするUnicodeの命名めいめい習慣しゅうかん(これはウィキペディアの本文ほんぶんではのぞまれない)を許容きょようしています。16しん入力にゅうりょくれい:A9)は必須ひっすですが、そののパラメータの入力にゅうりょく任意にんいです。実際じっさいのグリフは該当がいとうする文字もじふくむフォントを使用しようしてレンダリングされます。これは、たとえば言語げんごまたはIPAにとくしたフォントにたいしてはもっと具体ぐたいてきしめされることがあります。グリフを表示ひょうじするために、フォントの文字もじ画像がぞうでオーバーライドされることがあります。記事きじへのウィキリンクとそれとはべつのUnicodeへのリンクが作成さくせいされることもあり、10しん変換へんかんされたやHTML文字もじ参照さんしょう注記ちゅうきを(括弧かっこないに)追加ついかすることを可能かのうにしています。

制御せいぎょ文字もじ空白くうはく文字もじのような、いくつかの特別とくべつなコードポイントには特別とくべつ注意ちゅういはらわれます。これらの特別とくべつなコードポイントはunichar/gcのサブテンプレートにより自動的じどうてき検知けんちされます。

使用しようれい

[編集へんしゅう]
  • {{unichar|00A9|Copyright sign}}U+00A9 © copyright sign
  • {{unichar|00A9|Copyright sign|nlink=著作ちょさくけんマーク}}U+00A9 © copyright sign
  • {{unichar|00A9|Copyright sign|nlink=|note=[[コピーレフト]]記号きごう参照さんしょう}}U+00A9 © copyright sign (コピーレフト記号きごう参照さんしょう)
  • {{unichar|00A9|Copyright sign|nlink=著作ちょさくけんマーク|dec=|html=}}U+00A9 © copyright sign (169decimal, HTML: © ©)
  • {{unichar|00A0|No-break space|note=NBSP}}U+00A0   no-break space (NBSP)
  • {{unichar|0007|nlink=Bell character}}U+0007 <control-0007> Bell character
  • {{unichar|0007|Bell character|nlink=}}U+0007 <control-0007> Error using {{unichar}}: Pagename expected in "nlink="

パラメータ

[編集へんしゅう]

すべてのパラメータきのそらのテンプレートは以下いかのとおり:

{{unichar
| <!-- 16しん、コードポイント("U+"はけないでください) -->
| <!-- Unicodeの名称めいしょう -->
| ulink	= 
| image	= 
| cwith = 
| size	= 
| use	= 
| use2	= 
| nlink	= 
| dec	= 
| html	= 
| note	= 
}}

インラインよう:

{{unichar| <!--16しん("U+"はけない)-->| <!--Unicodeの名称めいしょう-->|ulink= |image= |cwith= |size= |use= |use2= |nlink= |dec= |html= |note= }}
  • だい1パラメータ, 1= 名前なまえなし, 入力にゅうりょく必須ひっす(プレフィックスの "1=" は省略しょうりゃく)。コードポイントの16しん記入きにゅうれい00A9)。
備考びこう: このパラメータはA9a900A9のような16しんけます。10しんは10しんであることが検知けんちされず、予期よきしない結果けっかかえすことになります(後述こうじゅつのエラーメッセージを参照さんしょう)。
  • だい2パラメータ, 2= 名前なまえなし(プレフィックスの "2=" は省略しょうりゃく)。その文字もじのUnicodeでの名称めいしょう。このテンプレートはこの入力にゅうりょくname in small capsとして使用しようし、いかなる入力にゅうりょく強制きょうせいてきちいさな文字もじにされます。この名称めいしょうはウィキペディアの記事きじ対応たいおうする名称めいしょうことなる場合ばあいがあります(以下いかのnlink=を参照さんしょう)。
  • nlink= 任意にんい入力にゅうりょく。ウィキリンク。リンクさきとなるウィキペディアの記事きじめい記入きにゅう記入きにゅうすると、Unicodeめいだい2パラメータ)にウィキリンクが付与ふよされます。もし記事きじめいとUnicodeめい同一どういつならば、だい2パラメータを使つかわずに "nlink=" の指定していだけで十分じゅうぶんです。
制御せいぎょ文字もじについては nlink パラメータを使用しようしてください。Unicodeめいのパラメータ(だい2パラメータ)は使つかわれません。 nlink パラメータがちいさな文字もじにされることなくわりに表示ひょうじされます。
備考びこう: ページめいすべてのウィキページと同様どうよう大文字おおもじ小文字こもじ区別くべつします。
{{unichar|00A9|Copyright sign|nlink=Copyright symbol}}U+00A9 © copyright sign
{{unichar|00A3|Pound sign|nlink=}}U+00A3 £ pound sign.
  • ulink 任意にんい入力にゅうりょく。"U+" プレフィックスにウィキリンクが付与ふよされます。名前なまえ ({{{1}}}) を記入きにゅうせずに使用しようすると、既定きていUnicode適用てきようされ、つぎのようになります: U+
  • dec= 任意にんい入力にゅうりょく。テキストの括弧かっこないに10しん追加ついかします。
  • html= 任意にんい入力にゅうりょく。テキストの括弧かっこないにHTML文字もじ参照さんしょう追加ついかします(れい&#160;)。"&nbsp;"のような「名前なまえ文字もじ参照さんしょう」が存在そんざいする場合ばあいはそれも追加ついかされます。
  • use= 任意にんい入力にゅうりょく通常つうじょうのブラウザフォントに文字もじ出現しゅつげんしないかもしれないとき、グリフを取得しゅとくするためにフォントヒンティングのテンプレートを指定していします。既定きていは{{unicode}}で、に{{IPA}}、{{lang}}、{{script}}の選択肢せんたくしがあります。"use=lang" または "use=script" を指定していすると、use2使用しようされ、言語げんご ("use2=fr") またはスクリプト ("use2=Cyrs") が指定していされるはずです。それでも、ブラウザの影響えいきょうのため、グリフが期待きたいされたとおりに表示ひょうじされないままであることもあります。くわしい説明せつめいかくテンプレートの説明せつめいしょをご参照さんしょうください。
{{unichar|0485|COMBINING CYRILLIC DASIA PNEUMATA|cwith=|use=script|use2=Cyrs}}U+0485  ҅  combining cyrillic dasia pneumata
  • image= 任意にんい入力にゅうりょく。グリフを表現ひょうげんするために、フォントを完全かんぜん無効むこうにしてファイル(画像がぞうイメージ)を使用しようできるようにします。ファイルめいは".svg"のような拡張子かくちょうしまでふくめて記入きにゅうしてください。ただし、"File:"のプレフィックスは不要ふようです。
  • cwith= 任意にんい入力にゅうりょく。Unicode文字もじが「結合けつごうしている」ときに有効ゆうこうです。cwith=使用しようして文字もじまえ空白くうはく追加ついかし、結合けつごう効果こうかあらわします。そのため、cwith=aのような文字もじとも使用しようするとき、その文字もじは "a" という文字もじ結合けつごうされます。Unicodeで結合けつごう文字もじくために使つかわれる一般いっぱんてきなグリフはU+25CC dotted circle (HTML: &#9676;)です。
cwith=使用しようれい:
{{unichar|0485|COMBINING CYRILLIC DASIA PNEUMATA}}U+0485 ҅ combining cyrillic dasia pneumata
cwith= パラメータ記入きにゅうれい:
{{unichar|0485|COMBINING CYRILLIC DASIA PNEUMATA|cwith=}}U+0485  ҅  combining cyrillic dasia pneumata
cwith= パラメータにDOTTED CIRCLEを記入きにゅうしたときれい:
{{unichar|0485|COMBINING CYRILLIC DASIA PNEUMATA|cwith=&#9676;}}U+0485 ◌҅ combining cyrillic dasia pneumata
  • size= 任意にんい入力にゅうりょく。グリフのサイズを指定していしたいときに使用しようします。既定きていは "size=125%" です。フォントについては、"7px", "150%", "2em", "larger"など、すべてのフォントサイズ指定してい様式ようしきけます。
{{unichar|0041|LATIN CAPITAL LETTER A|size=2em}}U+0041 A latin capital letter a
フォントのわりに画像がぞう(ファイル)を使用しようするときは、"12px"のようなピクセル単位たんいでのサイズ指定してい様式ようしきしかけません。画像がぞうもちいる場合ばあい既定きていは "10px" です。
{{unichar
| A9
| Copyright sign
| ulink = Universal Character Set characters
| image = 
| size  = 150%
| nlink = Copyright symbol
| note  = Example
}}
出力しゅつりょく結果けっか:

提示ていじ形式けいしき効果こうか

[編集へんしゅう]

Since this template is aimed at presenting a formatted, inline description, some effects are introduced to sustain this target.

  • Showing space characters: All space characters (those with General Category: Zs) are presented with a light-blue background, to show their actual presence and width: U+00A0   no-break space.
Incidentally, the regular space is replaced with &#00A0; (NBSP) to prevent wiki-markup deleting it as repeated spaces.
  • Removing formatting characters: Formatting characters (those with General Category: Cf, Zl and Zp) are removed from the output. By definition, formatting characters have no glyph. By removing them they cannot have a formatting effect.

Exception: five Arabic Cf/formatting number markings U+0600..U+0603 and U+60DD, are shown. While Cf formatting characters usually have no glyph, these five have. By internally adding "(visible)" to the category, these characters are shown.

  • Removing whitespace: The template removes formatting code and surrounding whitespace from the input. A <Return> in the Name-input (possibly unintended) would frustrate the in-line behaviour expectation.
  • Showing a label like <control-0007>: Unicode states that a code point has no name when it is one of these: a control character, a private use character, a surrogate, a not assigned code point (reserved), or a non-character. These code points instead should be referred to by using a "Code Point Label", such as <private-use> or <private-use-E000>. In this situation, this template replaces the glyph with that label. This way, the correct presentation wins it over Unicode-usage to the letter of the law.
  • "Control" general category=Cc: <control> or <control-0007>
  • "Surrogate" general category=Cs: <surrogate> or <surrogate-D800>
  • "Private Use": general category=Co: <private-use> or <private-use-FFA0>
  • "Not a character" (minus the reserved code points, see below): general category=Cn: <not-a-character>, <non-character> or <not-a-character-FFA0>

The second parameter (Unicode name) is not presented, since it cannot exist. It is possible to create a link to an article.

Note: A <reserved> (unassigned) code point cannot be detected yet, and so is not presented with this label. These code points too are given Cn category.
(Background on <>-labels: A Name can never have <>-brackets at all. These rules prevent mixing up a name with an actual control-character. So it will not happen that a bell rings when a page is opened that contains a Name of U+0007).

こりうるエラー

[編集へんしゅう]
  • このテンプレートはだい1パラメータ(16しん)に記入きにゅうれがあるときにError-messageかえします。
  • 00G9のように無効むこうな16しん入力にゅうりょくするとエラーをかえします(G/gは16しんほうにない数値すうちであるため)。
  • U+00A9のようにプレフィックス U+さないでください。まさしく認識にんしきされません。
  • もしもテンプレートが "2038" のようなコードポイントの数値すうちだけを表示ひょうじする場合ばあいは、おそらく{{unichar}}とはことなるテンプレート{{unicode}}を使用しようしていることがかんがえられます。
  • グリフは無効むこうにされ、<control-0007>のような label変更へんこうされることがあるかもしれません。これらの文字もじにはUnicodeめいがありません。nlinkは記事きじ直接ちょくせつリンクします("nlink=Bell signal"と入力にゅうりょくしたときなど)。"nlink="(これはポンド記号きごうのような通常つうじょう文字もじについては問題もんだいなくリンクします)のように空欄くうらんにした場合ばあいは<labeled>文字もじのために機能きのうしません(リンクとする文字もじ名称めいしょうまったくありません)。これはエラーをかえします。
  • 1=98 のような10しん入力にゅうりょくは16しんの0098としてまれます。もしあなたが9810=6216のつもりで入力にゅうりょくしたとしても、テンプレートがそれを検知けんちできることは絶対ぜったいにありません。これについては警告けいこく一切いっさいはっせられず、U+0062ではなく、意図いとした文字もじことなるU+009816あやまって表示ひょうじされます。

テクニカルノート

[編集へんしゅう]

The word "unichar" is used only in this English Wikipedia, as a name for this template. It has no meaning outside.

The template uses these subtemplates:

  • {{unichar/main}} Accepts all the input from {{unichar}}. Calls several subtemplates to produce the textstrings, and then strings them together. Also checks for the error non-hex input.
  • {{unichar/ulink}} creates a piped link for the "U+" prefix.
  • {{unichar/gc}} determines the Unicode general category, when this category is special (like, for control characters).
  • {{unichar/glyph}} for rendering the glyph by font. Accepts "image=" that overrules the font. Uses also "use", "use2", "size", "cwith".
  • {{unichar/na}} Produces the formatted name of the character in smallcaps. Accepts the "nlink=" to create a piped wikilink to an article. When the general category (gc) is special, the name will change into a <label-hhhh>.
  • {{unichar/notes}} - Produces the three optional notes in brackets: decimal value, HTML-character reference (both decimal and by name like &amp;nbsp; if that exists using {{numcr2namecr}}) and the free text note as provided by the editor. Also does the brackets themselves.
  • Using the main template as an input-easy feature, there are few calculations done (actually only two hex2dec), and allows for adding default values not too deep in the templates.
  • The value "<#salted#>" is used internally to pass through a non-defined input parameter. This value is correct when about the Name, because a Unicode name cannot have the characters <##>, and so salted is the right word (meaning uninhibitable). For ease of code maintenance it is used in more places around.

しょ問題もんだい

[編集へんしゅう]
  • Unassigned code points, to be labelled <reserved>, cannot be detected.
  • When using use-script, use2 needs lowercase (e.g. 0485, Cyrs or cyrs)
  • When using for one off the RTL formatting marks, its effect may break out of the template (text following goed rtl too). As it is now, this requires extra code.

関連かんれん項目こうもく

[編集へんしゅう]
  • {{unicode}} - Unicodeをよりひろあつかうフォントを使用しようして特殊とくしゅ文字もじ表示ひょうじさせたいときに使つかえます。

外部がいぶリンク

[編集へんしゅう]

Unicode文字もじ調査ちょうさ役立やくだつリンク:

  • Unicode charts - Unicodeの文字もじコードひょう(PDF形式けいしき
  • Fileformat.com search - 名称めいしょう、U+16しんまたはU+10しん、フォントの記号きごう(コピー&ペースト)で検索けんさくできる。
  • Unicode Converter - 複数ふくすう文字もじコンバータ