Module:txg-translit

local export = {}

local LFW2008 = mw.loadData("Module:txg/data/LFW2008")

local meta = { [" "] = true, ["-"] = true, ["…"] = true }

local meta_concat = {} for char in pairs(meta) do	table.insert(meta_concat, char) end meta_concat = require("Module:string utilities").pattern_escape(table.concat(meta_concat))

function export.tr(text, lang, sc) local UTF8_char = "[%z\1-\127\194-\244][\128-\191]*" local trtab = {} local i = 0 for char in mw.ustring.gmatch(text, ".") do		i = i + 1 if meta[char] then table.insert(trtab, char) elseif char == "𖿠" and i > 1 then table.insert(trtab, trtab[i-1]) else table.insert(trtab, LFW2008[char] or "?") end end text = table.concat(trtab, " ") text = text:gsub(" ?([" .. meta_concat .. "]) ?", "%1")	local _, count = mw.ustring.gsub(text, "[" .. meta_concat .. "%?]", "") if count == mw.ustring.len(text) then return nil else return "*" .. text end end

return export