Module:Lisu-translit

local export = {} local gsub = mw.ustring.gsub

local oneChar = { ["ꓐ"] = "b", ["ꓑ"] = "p", ["ꓒ"] = "pʰ", ["ꓓ"] = "d", ["ꓔ"] = "t", ["ꓕ"] = "tʰ", ["ꓖ"] = "g", ["ꓗ"] = "k", ["ꓘ"] = "kʰ", ["ꓙ"] = "dʒ", ["ꓚ"] = "tʃ", ["ꓛ"] = "tʃʰ", ["ꓜ"] = "dz", ["ꓝ"] = "ts", ["ꓞ"] = "tsʰ", ["ꓟ"] = "m", ["ꓠ"] = "n", ["ꓡ"] = "l", ["ꓢ"] = "s", ["ꓣ"] = "ʐ", ["ꓤ"] = "z", ["ꓥ"] = "ŋ", ["ꓦ"] = "h̃", ["ꓧ"] = "x", ["ꓨ"] = "h", ["ꓩ"] = "f", ["ꓪ"] = "w", ["ꓫ"] = "ʃ", ["ꓬ"] = "j", ["𑾰"] = "jʰ", ["ꓭ"] = "ɣ", ["ꓮ"] = "ɑ", ["ꓯ"] = "æ", ["ꓰ"] = "e", ["ꓱ"] = "ø", ["ꓲ"] = "i", ["ꓳ"] = "o", ["ꓴ"] = "u", ["ꓵ"] = "y", ["ꓶ"] = "ɯ", ["ꓷ"] = "ɤ", ["ꓸ"] = "́", ["ꓹ"] = "̌", ["ꓺ"] = "̱", ["ꓻ"] = "", ["ꓼ"] = "̱̀", ["ꓽ"] = "̀", ["ʼ"] = "̃", ["ˍ"] = "ɑ", ["꓾"] = ",", ["꓿"] = ".", }

local twoChars = { ["ꓠꓬ"] = "ɲ", }

local threeChars = { ["ꓙ\1ꓮ"] = "dʐɑ", ["ꓚ\1ꓮ"] = "tʂɑ", ["ꓛ\1ꓮ"] = "tʂʰɑ", ["ꓫ\1ꓮ"] = "ʂɑ", ["ꓙꓬꓮ"] = "dʒɑ", ["ꓚꓬꓮ"] = "tʃɑ", ["ꓛꓬꓮ"] = "tʃʰɑ", ["ꓫꓬꓮ"] = "ʃɑ", ["ꓺꓽ꓿"] = "ꓺꓽ?" }

function export.tr(text, lang, sc) local UTF8_char = "[%z\1-\127\194-\244][\128-\191]*" text = gsub(text, "([ꓮ-ꓷ])([ꓐ-ꓭ𑾰])([ꓸ-ꓽ]+)", "%1%3%2") text = gsub(text, "([ꓮ-ꓷ])([ꓮ-ꓷ])([ꓸ-ꓽ])", "%1%3%2") text = gsub(text, "%f[^%z%s%-꓾꓿][ꓐ-ꓭ𑾰]+%f[%z%s%-ꓸ-꓿ʼˍ]", "%0ꓮ") text = gsub(text, "ˍ%f[%z%s%-꓾꓿ʼ]", "%0ꓺ") text = gsub(text, "([ꓮ-ꓷˍ])([ꓸ-ꓽ])([ꓸ-ꓽ])", "%1%2%1%3") text = gsub(text, "%f[^%z%s꓾꓿]([ꓶꓷ])", "ɣ%1") text = gsub(text, "ꓮ([ꓸ-ꓽ]+)([ꓶꓷ])", "%2%1") text = gsub(text, "([ꓜꓝꓞꓢꓣꓤ])ꓲ", "%1ɨ") text = gsub(text, "([ꓙꓚꓛꓫ])ꓵ", "%1ɨ") text = gsub(text, "([ꓜꓝꓞꓢꓣꓤ])ꓬ(ꓲ)", "%1%2") text = gsub(text, "([ꓙꓚꓛꓫ])ꓬ(ꓵ)", "%1%2") text = gsub(text, "([ꓮ-ꓷ][ꓸ-ꓽ]?)ꓲ%f[%z%s]", "%1j") text = gsub(text, "([ꓮ-ꓷ][ꓸ-ꓽ]?)ꓳ%f[%z%s]", "%1w") text = gsub(text, "([ꓙꓚꓛꓫ])(ꓮ[ꓸ-ꓽ]?)%f[^ꓮ-ꓷjwɨꓸ-ꓽ]", "%1\1%2") for trigraph, replacement in pairs(threeChars) do		text = text:gsub(trigraph, replacement) end for digraph, replacement in pairs(twoChars) do		text = text:gsub(digraph, replacement) end return (text:gsub(UTF8_char, oneChar)) end

return export