Módulo:Unicode data/doc
Esta es la página de documentación de Módulo:Unicode data
This Lua module is used on many pages and changes may be widely noticed. Test changes in the module's /sandbox or /testcases subpages. Consider discussing changes on the talk page before implementing them.
Tranclusion count updated automatically (see documentation). |
This module can only be edited by administrators because it is transcluded onto one or more cascade-protected pages. |
Usage
[revisa codigo]This module provides functions that access information on Unicode code points. The information is retrieved from data modules generated from the Unicode Character Database, or derived by rules given in the Unicode Specification. It and its submodules were copied from English Wiktionary and then modified; see there for more information.
Parameters and functions
[revisa codigo]code point
[revisa codigo]The code point is to be entered as hexadecimal value. For example, Error en la expresión: no se reconoce el carácter de puntuación «[».:
- |A9hex
- |0xA9hex
- |0x00A9hex
- |0x00a9hex
{{#invoke:Unicode data|lookup|name|0x00A9}}
→ COPYRIGHT SIGN
Incorrect or unintended results:
- 169dec:
{{#invoke:Unicode data|lookup|name|169}}
→ LATIN SMALL LETTER U WITH TILDE Plantilla:Nay —"U+00A9"©
expected; but is read as 00A9hex (that is, Plantilla:Hex2decdec - U+00A9
{{#invoke:Unicode data|lookup|name|U+00A9}}
Plantilla:Nay —do not use "U+" prefix - غ
{{#invoke:Unicode data|lookup|name|غ}}
Plantilla:Nay —cannot enter a character as codepoint
"lookup" and "is" functions
[revisa codigo]lookup, is
- Template-invokable functions that allow access to the functions starting with
lookup
andis
.For most of the functions, add the code point in hexadecimal base as the next parameter. Foris|Latin
,is|rtl
, andis|valid_pagename
, add character string. HTML character references in the text are decoded by the module into code points. - For example,
{{#invoke:Unicode data|is|Latin|àzàhàr̃iyyā̀}}
→ true.
- Internally, in modules, these functions are named using underscore:
lookup_name|code point
←lookup_name
- For
&A9;
©:{{#invoke:Unicode data|lookup|name|A9}}
→ COPYRIGHT SIGN
Functions overview
[revisa codigo]- Code points: enter hexadecimal value, for example |0x0061 or |61; not |U+0061.
Topic | Function | Parameter type (string=by character(s); c.p. by 0xHex value) |
Example | Returns | Character |
---|---|---|---|---|---|
Unicode character name | |lookup|name
|
code point | Plantilla:Ubl | Plantilla:Ubl | Plantilla:Ubl |
Scripts | |lookup|script
|
code point | {{#invoke:Unicode data|lookup|script|A061}}
|
Yiii | Plantilla:Ubl |
Blocks | |lookup|block
|
code point | {{#invoke:Unicode data|lookup|block|A061}}
|
Yi Syllables | Plantilla:Ubl |
Planes | |lookup|plane
|
code point | Plantilla:Ubl | Plantilla:Ubl | Plantilla:Ubl
|
General Category | |lookup|category
|
code point | Plantilla:Ubl | Plantilla:Ubl | Plantilla:Ubl |
Controls | |is|control
|
code point | Plantilla:Ubl | Plantilla:Ubl | Plantilla:Ubl |
Latin script | |is|Latin
|
string | Plantilla:Ubl | Plantilla:Ubl | |
WP:Article title (WP:NCTR) | |is|valid_pagename
|
string | Plantilla:Ubli | Plantilla:Ubl | |
Bidirectionality, right-to-left scripts | |is|rtl
|
string | Plantilla:Ubl | Plantilla:Ubli | Plantilla:Ubl |
Combining character | |is|combining
|
code point | Plantilla:Ubl | Plantilla:Ubl | Plantilla:Ubl |
Character assignation | |is|assigned
|
code point | Plantilla:Ubl | Plantilla:Ubl | Plantilla:Ubl |
Printable | |is|printable
|
code point | Plantilla:Ubl | Plantilla:Ubl | Plantilla:Ubl |
Whitespace character § Unicode | |is|whitespace
|
code point | Plantilla:Ubl | Plantilla:Ubl | Plantilla:Ubl |
Alias names | |aliases
|
[application unknown] | Plantilla:Ubl | ||
Combining class | |
|
[application unknown] | Plantilla:Ubl | ||
Age | |
|
[application unknown] | Plantilla:Ubl | ||
get_best_script | |get_best_script
|
[application unknown] | Plantilla:Ubl |
Data modules
[revisa codigo]The data used by functions in this module is found in submodules. Some are generated by AWK scripts shown at User:Kephir/Unicode on English Wiktionary, others by Lua scripts on the /make
subpages of the submodules.
- Module:Unicode data/age: 'Age' of a character, that is: version introduction number.
- Module:Unicode data/aliases: the formal name aliases for characters (from NameAliases.txt)
- Module:Unicode data/blocks: the list of Unicode blocks (from Blocks.txt)
- Module:Unicode data/category: data mapping characters to their General Category (from DerivedGeneralCategory.txt)
- Module:Unicode data/combining: data mapping characters to their Combining Classes (from DerivedCombiningClass.txt)
- Module:Unicode data/control: data for identifying characters that belong to the General Categories of Separator and Other (from DerivedGeneralCategory.txt)
- Module:Unicode data/derived core properties:
- Module:Unicode data/Hangul: data used to generate the names of Hangul syllables (from Jamo.txt)
- Module:Unicode data/names/* (000hh, .., 0E0hh; eg ../names/000): names
- Module:Unicode data/scripts: data mapping characters to their Unicode script properties (from Scripts.txt).
The name data modules (Module:Unicode data/names/xxx) were compiled from UnicodeData.txt. Each one contains, at maximum, code points U+xxx000 to U+xxxFFF. Error en la secuencia de órdenes: no existe el módulo «Unicode data/documentation functions».
Copyright
[revisa codigo]The Unicode database is released by Unicode Inc. under the following terms:
Copyright © 1991-2018 Unicode, Inc. All rights reserved. Distributed under the Terms of Use in https://www.unicode.org/copyright.html.
Permission is hereby granted, free of charge, to any person obtaining a copy of the Unicode data files and any associated documentation (the "Data Files") or Unicode software and any associated documentation (the "Software") to deal in the Data Files or Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, and/or sell copies of the Data Files or Software, and to permit persons to whom the Data Files or Software are furnished to do so, provided that either (a) this copyright and permission notice appear with all copies of the Data Files or Software, or (b) this copyright and permission notice appear in associated Documentation.
THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THE DATA FILES OR SOFTWARE.
Except as contained in this notice, the name of a copyright holder shall not be used in advertising or otherwise to promote the sale, use or other dealings in these Data Files or Software without prior written authorization of the copyright holder.
Known issues
[revisa codigo]- Reading data like
Module:Unicode data/aliases
not provided nor documented - Test fail:
lookup_category
U+FFFF (<noncharacter-FFFF>) expected: Cn.
{{#invoke:Unicode data|lookup|category|0xFFFF}}
→ [Nil]
See also
[revisa codigo]- Named entities: for example, Error en la expresión: no se reconoce el carácter de puntuación «[».:
{{#invoke:LoadData|Numcr2namecr|0x22C1}}
→ Error en la secuencia de órdenes: no existe el módulo «LoadData».