Module:category tree/poscatboiler/data/unicode
- පහත දැක්වෙන උපදෙස්, Template:poscatboiler data submodule documentation මගින් ජනනය කොට ඇත. [සංස්කරණය කරන්න]
- ප්රයෝජනවත් සබැඳි: root page • root page’s subpages • සබැඳි • transclusions • testcases • sandbox
This data submodule defines part of Wiktionary's category structure.
For an introduction to the poscatboiler
system and a description of how to add or modify categories, see Module:category tree/poscatboiler/data/documentation.
local raw_categories = {}
local raw_handlers = {}
-----------------------------------------------------------------------------
-- --
-- RAW CATEGORIES --
-- --
-----------------------------------------------------------------------------
raw_categories["Unicode blocks"] = {
topright = "{{shortcut|CAT:UC}}",
description = "Categories with blocks of particular Unicode characters.",
parents = {
"මූලධර්ම",
"ප්රවර්ගය:උපග්රන්ථ",
},
}
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}