Module:nsk-utilities

From Wiktionary, the free dictionary
Jump to navigation Jump to search
This module needs documentation.
Please document this module by describing its purpose and usage on the documentation page.

local export={}

local long_to_short = {
	["ᐄ"] = "ᐃ",
	["ᐆ"] = "ᐅ",
	["ᐋ"] = "ᐊ",
	["ᐲ"] = "ᐱ",
	["ᐴ"] = "ᐳ",
	["ᐹ"] = "ᐸ",
	["ᑏ"] = "ᑎ",
	["ᑑ"] = "ᑐ",
	["ᑖ"] = "ᑕ",
	["ᑮ"] = "ᑭ",
	["ᑰ"] = "ᑯ",
	["ᑳ"] = "ᑲ",
	["ᒌ"] = "ᒋ",
	["ᒎ"] = "ᒍ",
	["ᒑ"] = "ᒐ",
	["ᒦ"] = "ᒥ",
	["ᒨ"] = "ᒧ",
	["ᒫ"] = "ᒪ",
	["ᓃ"] = "ᓂ",
	["ᓅ"] = "ᓄ",
	["ᓈ"] = "ᓇ",
	["ᓰ"] = "ᓯ",
	["ᓲ"] = "ᓱ",
	["ᓵ"] = "ᓴ",
	["ᔩ"] = "ᔨ",
	["ᔫ"] = "ᔪ",
	["ᔮ"] = "ᔭ",
	["ᕇ"] = "ᕆ",
	["ᕉ"] = "ᕈ",
	["ᕌ"] = "ᕋ",
	["ᔒ"] = "ᔑ",
	["ᔔ"] = "ᔓ",
	["ᔖ"] = "ᔕ",
	["ᕖ"] = "ᕕ",
	["ᕘ"] = "ᕗ",
	["ᕚ"] = "ᕙ",
	["ᕢ"] = "ᕡ",
	["ᕥ"] = "ᕤ",
	["ᕧ"] = "ᕦ",
	["ᓖ"] = "ᓕ",
	["ᓘ"] = "ᓗ",
	["ᓛ"] = "ᓚ",
	["ᐐ"] = "ᐏ",
	["ᐔ"] = "ᐓ",
	["ᐙ"] = "ᐘ",
	["ᖀ"] = "ᕿ",
	["ᖂ"] = "ᖁ",
	["ᖄ"] = "ᖃ",
}

local short_to_long = {
	["ᐗ"] = "ᐛ",
	["ᐘ"] = "ᐛ",
}

local long = "ᐄᐆᐋᐲᐴᐹᑏᑑᑖᑮᑰᑳᒌᒎᒑᒦᒨᒫᓃᓅᓈᓰᓲᓵᔩᔫᔮᕇᕉᕌᔒᔔᔖᕖᕘᕚᕢᕥᕧᓖᓘᓛᐐᐔᐙᖀᖂᖄ"
local short = "ᐗᐘ"

function export.remove_accents(text)
	if type(text) == "table" then
		text = text.args[1]
	end
	text = mw.ustring.gsub(text,"["..long.."]",long_to_short)
	text = mw.ustring.gsub(text,"["..short.."]",short_to_long)
	return text
end

export.translit = require("Module:nsk-translit").tr

return export