Module:Unicode data/derived core properties/make
local data = {}
data.default_ignorable = {
singles = {
[0x000AD] = true,
[0x0034F] = true,
[0x0061C] = true,
[0x03164] = true,
[0x0FEFF] = true,
[0x0FFA0] = true,
},
ranges = {
{ 0x0115F, 0x01160 },
{ 0x017B4, 0x017B5 },
{ 0x0180B, 0x0180E },
{ 0x0200B, 0x0200F },
{ 0x0202A, 0x0202E },
{ 0x02060, 0x0206F },
{ 0x0FE00, 0x0FE0F },
{ 0x0FFF0, 0x0FFF8 },
{ 0x1BCA0, 0x1BCA3 },
{ 0x1D173, 0x1D17A },
{ 0xE0000, 0xE0FFF },
},
}
return data
local p = {}
function p.main(frame)
local page = frame.args[1] or "User:Erutuon/Unicode/DerivedCoreProperties.txt"
local text = assert(mw.title.new(page):getContent())
local default_ignorable = text
:match("Derived Property: Default_Ignorable_Code_Point.-(%f[^\n]%x%x%x%x.-)%s*\n# Total code points")
local singles, ranges = {}, {}
for code_point1, code_point2 in default_ignorable:gmatch("%f[^\n%z](%x+)%.?%.?(%x*)") do
code_point1, code_point2 = tonumber(code_point1, 16), tonumber(code_point2, 16)
local last_range = ranges[#ranges]
if last_range and last_range[2] == code_point1 - 1 then
last_range[2] = code_point2 or code_point1
elseif singles[code_point1 - 1] then
singles[code_point1 - 1] = nil
table.insert(ranges, { code_point1 - 1, code_point2 or code_point1 })
else
if not code_point2 then
singles[code_point1] = true
else
table.insert(ranges, { code_point1, code_point2 })
end
end
end
local template = [[
local data = {}
data.default_ignorable = {
singles = {
...
},
ranges = {
...
},
}
return data
]]
local Array = require "Module:array"
local printed_ranges = Array()
for _, range in ipairs(ranges) do
local low, high, script_code = unpack(range)
printed_ranges:insert(('\t\t{ 0x%05X, 0x%05X },'):format(low, high))
end
local printed_singles = Array()
for codepoint in require 'Module:TableTools'.sortedPairs(singles) do
printed_singles:insert(('\t\t[0x%05X] = true,'):format(codepoint))
end
local data = template
:gsub('%.%.%.', printed_singles:concat('\n'), 1)
:gsub('%.%.%.', printed_ranges:concat('\n'), 1)
return mw.getCurrentFrame():extensionTag{
name = "syntaxhighlight",
content = data,
args = { lang = "lua" }
}
end
return p
Content Disclaimer
Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.
- The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
- There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
- It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
- Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
- Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.