模板:Numcr2namecr
外观
表达式错误:预期外的and运算符。
![]() | 此模板的文档不存在、不全面或不能详细描述其功能及/或其代码中的参数。请帮助扩充并改进其文档。 |
Usage
[编辑]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}}
--> {{Numcr2namecr|160|base=dec}}
-->
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
Parameters
[编辑]- First parameter, 1= Unnamed, required. Numerical value in hex or decimal. Hexadecimal can have the prefix "0x". Input like   (expected output ) 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
Technical notes
[编辑]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}}
.
See also
[编辑]- List of XML and HTML character entity references gives background and an overview
上述文档嵌入自Template:Numcr2namecr/doc。 (编辑 | 历史) 编者可以在本模板的沙盒 (创建 | 镜像)和测试样例 (创建)页面进行实验。 请在/doc子页面中添加分类。本模板的子页面。 |