Module:Category tree/poscatboiler/data/unicode
Documentation for this module may be created at Module:Category tree/poscatboiler/data/unicode/documentation
local raw_categories = {}
local raw_handlers = {}
-----------------------------------------------------------------------------
-- --
-- RAW CATEGORIES --
-- --
-----------------------------------------------------------------------------
raw_categories["Unicode blocks"] = {
intro = "{{shortcut|CAT:UC}}",
description = "Categories with blocks of particular Unicode characters.",
parents = {
"Fundamental",
"Category:Appendices",
},
}
raw_categories["Unicode blocks by number of entries"] = {
description = "Categories that group blocks of Unicode characters by the number of characters in those blocks.",
parents = {
{name = "Unicode blocks", sort = " "},
},
}
for _, block in ipairs({
{num = "0", desc = "no other", sort = "*000"},
{num = "1–10", desc = "1 to 10", sort = "*001"},
{num = "11–50", desc = "11 to 50", sort = "*011"},
{num = "51–100", desc = "51 to 100", sort = "*051"},
{num = "101+", desc = "at least 101", sort = "*101"},
}) do
raw_categories["Unicode blocks with " .. block.num .. " entries"] = {
description = "Unicode block categories containing 1 appendix + " .. block.desc .. " entries.",
parents = {{name = "Unicode blocks by number of entries", sort = block.sort}},
breadcrumb = block.num,
}
end
-----------------------------------------------------------------------------
-- --
-- RAW HANDLERS --
-- --
-----------------------------------------------------------------------------
table.insert(raw_handlers, function(data)
local block = data.category:match("^(.*) block$")
if block then
local pages_in_category = mw.site.stats.pagesInCategory(mw.title.getCurrentTitle().text, "pages")
local entry_bucket
-- At least 1 page is the appendix for the current Unicode block.
if pages_in_category == 1 then
entry_bucket = "0"
elseif pages_in_category <= 11 then
entry_bucket = "1–10"
elseif pages_in_category <= 51 then
entry_bucket = "11–50"
elseif pages_in_category <= 101 then
entry_bucket = "51–100"
else
entry_bucket = "101+"
end
return {
description = "Entries for characters in the '''[[Appendix:Unicode/" .. block .. "|" .. block .. "]]''' block, " ..
"as categorized by the character boxes.",
additional = "Some entries may define characters from multiple Unicode codepoints at once, so the page title " ..
"could be an entry that is not from this block.",
breadcrumb = block,
parents = {
"Unicode blocks",
"Unicode blocks with " .. entry_bucket .. " entries",
},
}
end
end)
return {RAW_CATEGORIES = raw_categories, RAW_HANDLERS = raw_handlers}