Content deleted Content added
Module:Table has been merged |
function to print data module for "default ignorable" property |
||
(2 intermediate revisions by the same user not shown) | |||
Line 1:
local p = {}
function p.show(frame)▼
local page = frame.args[1] or "User:Erutuon/Unicode/DerivedCoreProperties.txt"
local text = assert(mw.title.new(page):getContent())
local defaultIgnorable = text
:match("Derived Property: Default_Ignorable_Code_Point.-(%f[^\n]%x%x%x%x.-)%s*\n# Total code points")
local singles, ranges = {}, {}
for codePoint1, codePoint2 in defaultIgnorable:gmatch("%f[^\n%z](%x+)%.?%.?(%x*)") do
codePoint1, codePoint2 = tonumber(codePoint1, 16), tonumber(codePoint2, 16)
local lastRange = ranges[#ranges]
if lastRange and lastRange[2] == codePoint1 - 1 then
lastRange[2] = codePoint2 or codePoint1
else
if not codePoint2 then
singles[codePoint1] = true
table.insert(ranges, { codePoint1, codePoint2 })
end▼
end▼
end▼
local data = {}
data.defaultIgnorable = {
singles = {
...
},
ranges = {
...
},
}
return data
]]
local Array = require "Module:array"
local printedRanges = Array()
local low, high, script_code = unpack(range)
printedRanges:insert(('\t\t{ 0x%05X, 0x%05X },'):format(low, high))
end▼
local printedSingles = Array()
for codepoint in require 'Module:TableTools'.sortedPairs(singles) do
printedSingles:insert(('\t\t[0x%05X] = true,'):format(codepoint))
end▼
:gsub('%.%.%.', printedSingles:concat('\n'), 1)
:gsub('%.%.%.', printedRanges:concat('\n'), 1)
return data
end▼
local Unicode_data = require "Module:Unicode data/sandbox"
Line 366 ⟶ 421:
mw.log("Invalid private-use subtag in", parsed_subtags:get_tag())
end
▲end
▲local output_mt = {}
▲end
▲end
▲end
▲function p.show(frame)
▲ local output = Output()
▲ for _, prefix in ipairs(data.prefixes) do
▲ end
▲ end
▲ end
end
|