Module:User:Benwing2/category tree/poscatboiler/data/characters

Hello, you have come here looking for the meaning of the word Module:User:Benwing2/category tree/poscatboiler/data/characters. In DICTIOUS you will not only get to know all the dictionary meanings for the word Module:User:Benwing2/category tree/poscatboiler/data/characters, but we will also tell you about its etymology, its characteristics and you will know how to say Module:User:Benwing2/category tree/poscatboiler/data/characters in singular and plural. Everything you need to know about the word Module:User:Benwing2/category tree/poscatboiler/data/characters you have here. The definition of the word Module:User:Benwing2/category tree/poscatboiler/data/characters will help you to be more precise and correct when speaking or writing your texts. Knowing the definition ofModule:User:Benwing2/category tree/poscatboiler/data/characters, as well as those of other words, enriches your vocabulary and provides you with more and better linguistic resources.


local handlers = {}

local ulen = mw.ustring.len
local uupper = mw.ustring.upper
local ulower = mw.ustring.lower
local rfind = mw.ustring.find


-----------------------------------------------------------------------------
--                                                                         --
--                                 HANDLERS                                --
--                                                                         --
-----------------------------------------------------------------------------



-- 	If char is a combining character, returns a version with a dotted circle before it.
function add_dotted_circle(char, combining)
	return combining and "◌" .. char or char
end


table.insert(handlers, function(data)
	--[[
		"desc" is in reference to categories like "Hebrew terms spelled with gershayim",
		in which the title does not contain the character itself.
		Perhaps there is a better word for this.
	]]
	local desc = data.label:match("^terms spelled with (.+)$")
	if not desc then
		return nil
	end
	local ja_ryu = data.lang:getCode() == "ja" or data.lang:getCode() == "ryu"
	-- If Japanese or Okinawan, only fire on a single kanji character.
	if ja_ryu and (desc:find("") or ulen(desc) > 1) then
		return nil
	end
	local params = {
		 = {},
		 = {},
		-- Not sure what used to be done with the following parameters.
		 = {},
		 = {},
	}
	local args = require("Module:parameters").process(data.args, params)
	local char = args.char or desc
	if not args.char then
		desc = nil
	else
		require("Module:debug").track("charactercat/manual char")
	end

	local combining = ulen(char) == 1 and require("Module:Unicode_data").is_combining(mw.ustring.codepoint(char))
	
	local upper = uupper(char)
	if char ~= upper
			and ulen(char) == 1
			and not rfind(upper, "") then
		error("Category titles should use uppercase characters: '" .. data.label .. "'")
	end
	
	-- Compute description.

	-- If the letter has a lowercase form, show it.
	local character = require("Module:links").full_link(
		{
			term = char,
			alt = combining and add_dotted_circle(char, true) or nil,
			lang = data.lang,
			tr = combining and "-" or nil,
		},
		"term"
	)
	if ulower(char) ~= char then
		character = "upper case " .. character .. " or lower case " ..
			require("Module:links").full_link(
				{
					term = ulower(char),
					lang = data.lang
				},
				"term"
			)
	end
	
	if desc then
		character = character .. " (" .. desc .. ")"
	end

	local description = "{{{langname}}} terms spelled with " .. character .. "."

	-- Set displaytitle.

	local displaytitle
	local labelRegex = require("Module:string").pattern_escape(char)
	if rfind(data.label, labelRegex .. "$") then
		displaytitle = function(title, lang)
			return mw.ustring.gsub(
				title,
				labelRegex .. "$",
				require("Module:script utilities").tag_text(char, lang, nil, "term")
			)
		end
	end
	
	-- Compute sort key.

	local sortkey =
		args.sort or
		ja_ryu and ulen(char) == 1 and require("Module:zh-sortkey").makeSortKey(char, data.lang:getCode()) or
		data.lang:makeSortKey(char)
	if sortkey == "" then
		sortkey = char
	end

	return {
		description = description,
		displaytitle = displaytitle,
		parents = {{name = "terms by their individual characters", sort = sortkey }},
		breadcrumb = desc or require("Module:script utilities").tag_text(add_dotted_circle(char, combining), data.lang, nil, "term"),
		umbrella = false,
	}, true
end)


return {HANDLERS = handlers}