Module:Unicode data/documentation: Difference between revisions
Djpwikiadmin (talk | contribs) (Created page with "This module is used for accessing the Unicode character database (version 11.0), derived from files found in http://www.unicode.org/Public/UNIDATA/ . ==Functions== All of the...") |
m (Text replacement - "(\[\[)w:(.+?\|.+?\]\])" to "\1Wikipedia:\2") |
||
(6 intermediate revisions by 2 users not shown) | |||
Line 37: | Line 37: | ||
* [[Module:Unicode data/blocks]]: the list of Unicode blocks (from [https://www.unicode.org/Public/UNIDATA/Blocks.txt Blocks.txt]); currently used by [[Module:Unicode data/sandbox]] | * [[Module:Unicode data/blocks]]: the list of Unicode blocks (from [https://www.unicode.org/Public/UNIDATA/Blocks.txt Blocks.txt]); currently used by [[Module:Unicode data/sandbox]] | ||
* [[Module:Unicode data/category]]: data mapping characters to their General Category (from [https://www.unicode.org/Public/UNIDATA/extracted/DerivedGeneralCategory.txt DerivedGeneralCategory.txt]) | * [[Module:Unicode data/category]]: data mapping characters to their General Category (from [https://www.unicode.org/Public/UNIDATA/extracted/DerivedGeneralCategory.txt DerivedGeneralCategory.txt]) | ||
* [[Module:Unicode data/control]]: data for identifying characters that belong to the [[ | * [[Module:Unicode data/control]]: data for identifying characters that belong to the [[Wikipedia:General Category|General Categories]] of Separator and Other (from [https://www.unicode.org/Public/UNIDATA/extracted/DerivedGeneralCategory.txt DerivedGeneralCategory.txt]) | ||
* [[Module:Unicode data/combining]]: data mapping characters to their Combining Classes (from [https://www.unicode.org/Public/UNIDATA/extracted/DerivedCombiningClass.txt DerivedCombiningClass.txt]) | * [[Module:Unicode data/combining]]: data mapping characters to their Combining Classes (from [https://www.unicode.org/Public/UNIDATA/extracted/DerivedCombiningClass.txt DerivedCombiningClass.txt]) | ||
* [[Module:Unicode data/Hangul]]: data used to generate the names of [[Hangul]] syllables (from [http://www.unicode.org/Public/UNIDATA/Jamo.txt Jamo.txt]); only used by [[Module:Unicode data/sandbox]] | * [[Module:Unicode data/Hangul]]: data used to generate the names of [[Wiktionary:Hangul|Hangul]] syllables (from [http://www.unicode.org/Public/UNIDATA/Jamo.txt Jamo.txt]); only used by [[Module:Unicode data/sandbox]] | ||
* [[Module:Unicode data/scripts]]: data mapping characters to their Wiktionary script code (not the official Unicode script property), generated from [[Module:scripts/data]] by [[Module:User:Erutuon/script recognition]]. | * [[Module:Unicode data/scripts]]: data mapping characters to their Wiktionary script code (not the official Unicode script property), generated from [[Module:scripts/data]] by [[Module:User:Erutuon/script recognition]]. | ||
Line 60: | Line 60: | ||
<includeonly> | <includeonly> | ||
[[Category:Lua metamodules]] | [[Category:Lua metamodules]] | ||
[[Category:Wiktionary modules]] | |||
</includeonly> | </includeonly> |
Latest revision as of 04:44, 30 August 2024
This module is used for accessing the Unicode character database (version 11.0), derived from files found in http://www.unicode.org/Public/UNIDATA/ .
Functions
All of these functions can only be used in a module. For template-invokable functions, see Module:Unicode data/templates.
lookup_name
- Look up the name of a code point. Used by Module:character info, Module:character list, Module:Template:also, and Module:mul-domino def.
lookup_image
- Look up the image for a codepoint. Used by Module:character info and Module:character list.
enum_blocks
- Used in a
for in
loop in Module:character list to iterate through the array of block ranges. lookup_plane
- Returns the name of the plane to which a codepoint belongs. Unused.
get_block_range
- Given a block name, returns the range of codepoints included in the block. Used by Module:character list.
is_valid_pagename
- Given a string, returns
true
orfalse
depending on whether the string can be used as a page title. Used by Module:template link. add_dotted_circle
- Given a string, places a dotted circle before every combining character in the string. Used by Module:category tree/charactercat and Module:grc-utilities.
char_to_script
- Given a character or a codepoint, returns the Wiktionary script code for the character, or else
"None"
, using Module:Unicode data/scripts. Used by Module:character info, Module:Template:also, Module:character list, and Module:games. get_entry_title
- Returns the title for the entry on a character, which is a subpage of Unsupported titles for characters that cannot appear in pagenames. See Manual:Page title on the MediaWiki website for more information. Used by Module:character info and Module:character list.
The following functions relate to a codepoint's General Category. They receive a codepoint and return two values: a boolean (which expresses whether the codepoint fulfills the condition) and a string describing the General Category, if the character is in the General Categories of Separator (Z) or Other (C), or the string "assigned"
. They use Module:Unicode data/control.
is_assigned
- Checks whether a codepoint's General Category is not Cn (Other, unassigned). Used by Module:character list.
is_printable
- Checks whether a codepoint is printable: that its General Category is not "Other" (C), "Separator, line" (Zl), or "Separator, paragraph" (Zp). Used by Module:character info and Module:character list.
is_whitespace
- Checks whether a codepoint's General Category is Zs ("Separator, space"). Used by Module:character list and Module:links/print data.
User:Kephir/Unicode contains scripts which may be helpful in maintaining this database.
Data modules
The data used by functions in this module is found on subpages. Most of them were constructed by the scripts given in User:Kephir/Unicode
- 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); currently used by Module:Unicode data/sandbox
- Module:Unicode data/category: data mapping characters to their General Category (from DerivedGeneralCategory.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/combining: data mapping characters to their Combining Classes (from DerivedCombiningClass.txt)
- Module:Unicode data/Hangul: data used to generate the names of Hangul syllables (from Jamo.txt); only used by Module:Unicode data/sandbox
- Module:Unicode data/scripts: data mapping characters to their Wiktionary script code (not the official Unicode script property), generated from Module:scripts/data by Module:User:Erutuon/script recognition.
The name and image data modules (Module:Unicode data/names/xxx and Module:Unicode data/images/xxx) were compiled from UnicodeData.txt. Each one contains, at maximum, code points U+xxx000 to U+xxxFFF. Script error: No such module "User:Erutuon/Unicode".
Copyright
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 http://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.