Module:mul-letter

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

This module needs documentation.
Please document this module by describing its purpose and usage on the documentation page.

local export = {}
local PAGENAME = mw.title.getCurrentTitle().text

local function getCasing(char, variant)
	if not variant then
		variant = "common"
	end
	local casing = require("Module:mul-letter/data")
	if not casing then
		if mw.ustring.len(char) > 1 then
			casing = {mw.ustring.lower(char), mw.ustring.upper(mw.ustring.sub(char, 1, 1)) .. mw.ustring.lower(mw.ustring.sub(char, 2, -1)), mw.ustring.upper(char)}
		else
			casing = {mw.ustring.lower(char), mw.ustring.upper(char), mw.ustring.upper(char)}
		end
	end
	return casing
end

function export.show(frame)
	local args = frame:getParent().args
	local head = args or PAGENAME
	local lang = require("Module:languages").getByCode("mul")
	local scriptCode = args or args or require("Module:scripts").findBestScriptWithoutLang(head):getCode()
	local script = scriptCode and require("Module:scripts").getByCode(scriptCode) or lang:findBestScript(head)
	local variant = args
	
	if args.script then
		require("Module:debug").track("mul-letter/script-param")
	end

	local data = {
		lang = lang,
		sc = script,
		pos_category = "letters",
		categories = {},
		heads = {head},
		no_redundant_head_cat = not args.head,
		inflections = {}
	}

	local casing = getCasing(head, variant)
	if casing ~= head then
		table.insert(data.inflections, {label = "lower case", casing})
	end
	if casing ~= head and casing ~= casing then
		table.insert(data.inflections, {label = "mixed case", casing})
	end
	if casing ~= head then
		table.insert(data.inflections, {label = "upper case", casing})
	end

	return require("Module:headword").full_headword(data)
		.. require("Module:utilities").format_categories({
			script:getCategoryName() .. " characters",
		}, lang)
end

return export