Lompat ke isi

Templat:Numcr2namecr/doc: Perbedaan antara revisi

Dari Wikipedia bahasa Indonesia, ensiklopedia bebas
Konten dihapus Konten ditambahkan
←Membuat halaman berisi '{{Documentation subpage}} <!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE --> === Usage === This template converses a '''''numerical'' character ...'
 
Tidak ada ringkasan suntingan
Baris 2: Baris 2:
<!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE -->
<!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE -->


=== Usage ===
=== Penggunaan ===
This template converses a '''''numerical'' character reference''' into a '''''named'' character reference'''. It converts a number to the named character reference for HTML, also often called a "character entity". The input number can be decimal or hexadecimal.
This template converses a '''''numerical'' character reference''' into a '''''named'' character reference'''. It converts a number to the named character reference for HTML, also often called a "character entity". The input number can be decimal or hexadecimal.
* <code><nowiki>{{Numcr2namecr|A0}}</nowiki></code> --> {{Numcr2namecr|A0}}
* <code><nowiki>{{Numcr2namecr|A0}}</nowiki></code> --> {{Numcr2namecr|A0}}
Baris 13: Baris 13:
* <code><nowiki>{{Numcr2namecr|61|notfoundmsg=Not named}}</nowiki></code> --> {{Numcr2namecr|61|notfoundmsg=Not named}}
* <code><nowiki>{{Numcr2namecr|61|notfoundmsg=Not named}}</nowiki></code> --> {{Numcr2namecr|61|notfoundmsg=Not named}}


===Parameters===
=== Parameter ===
* '''First parameter, 1=''' Unnamed, required. Numerical value in hex or decimal. Hexadecimal can have the prefix "0x". Input like ''&amp;#160;'' (expected output &amp;nbsp;) can not be processed.
* '''First parameter, 1=''' Unnamed, required. Numerical value in hex or decimal. Hexadecimal can have the prefix "0x". Input like ''&amp;#160;'' (expected output &amp;nbsp;) can not be processed.
* '''base=''' Required when base=decimal, default base=hex. When the input number (parameter 1) is ''decimal'', the base= ''must'' be defined through: "base=dec", "base=d", "base=10".
* '''base=''' Required when base=decimal, default base=hex. When the input number (parameter 1) is ''decimal'', the base= ''must'' be defined through: "base=dec", "base=d", "base=10".
Baris 21: Baris 21:
* <code><nowiki>{{numcr2namecr|61|notfoundmsg=Cannot find the name}}</nowiki></code> --> {{Numcr2namecr|61|notfoundmsg=Cannot find the name}}
* <code><nowiki>{{numcr2namecr|61|notfoundmsg=Cannot find the name}}</nowiki></code> --> {{Numcr2namecr|61|notfoundmsg=Cannot find the name}}


===Technical notes===
=== Catatan teknis ===
The template uses the subtemplate {{tlx|numcr2namecr/listbydec}}, which contains a list of all '''252''' character references. Hexadecimal-decimal calculations are performed by {{tlx|hex2dec}} and {{tlx|hexadecimal}}.
The template uses the subtemplate {{tlx|numcr2namecr/listbydec}}, which contains a list of all '''252''' character references. Hexadecimal-decimal calculations are performed by {{tlx|hex2dec}} and {{tlx|hexadecimal}}.


=== See also ===
=== Lihat pula ===
* [[List of XML and HTML character entity references]] gives background and an overview
* [[List of XML and HTML character entity references]] gives background and an overview



Revisi per 10 Mei 2013 17.16

Penggunaan

This template converses a numerical character reference into a named character reference. It converts a number to the named character reference for HTML, also often called a "character entity". The input number can be decimal or hexadecimal.

  • {{Numcr2namecr|A0}} --> &nbsp;
  • {{Numcr2namecr|160|base=dec}} --> &nbsp;

By default the numeric base is presumed to be hexadecimal. When the base is decimal, it needs to be specified using "base=dec"

When the number has no related named character, an blank is presented. This message can be overruled:

  • {{Numcr2namecr|61}} -->
  • {{Numcr2namecr|61|notfoundmsg=Not named}} --> Not named

Parameter

  • First parameter, 1= Unnamed, required. Numerical value in hex or decimal. Hexadecimal can have the prefix "0x". Input like &#160; (expected output &nbsp;) can not be processed.
  • base= Required when base=decimal, default base=hex. When the input number (parameter 1) is decimal, the base= must be defined through: "base=dec", "base=d", "base=10".
For clarity in code, the hex base may be defined as well: "base=hex", "base=h", "base=16". The base is also hexadecimal when the prefix "0x" is used with the number.
  • notfoundmsg= Optional message, default= (blank). Will be returned when the value does not have a named reference.
  • {{numcr2namecr|61}} -->
  • {{numcr2namecr|61|notfoundmsg=Cannot find the name}} --> Cannot find the name

Catatan teknis

The template uses the subtemplate {{numcr2namecr/listbydec}}, which contains a list of all 252 character references. Hexadecimal-decimal calculations are performed by {{hex2dec}} and {{hexadecimal}}.

Lihat pula