local export = {}
local links = require("Module:links")
local gsub = mw.ustring.gsub
local lang = require("Module:languages").getByCode("lo")
local script = require("Module:scripts").getByCode("Laoo")
local PAGENAME = mw.title.getCurrentTitle().text
local conCls1 = ""
local conCls2 = "ຫ"
local toneCls = "?"
-- This must be imperfect since ຍ could appear at any position.
local datedSeq = {
= "%1ຽ", -- oey
= "%1ຽ",
)ຍ"] = "%1ຽ", -- uay, oay, aay
)ຍ"] = "%1ຽ",
"..toneCls..")ຍ"] = "%1ຽ", -- uey, uuey, uy, uuy
"..toneCls..")ຍ"] = "%1ຽ",
= "ຫນ",
= "ຫມ",
= "ຫລ",
}
local function preloadDatedForm()
local pdated = PAGENAME
for k, v in pairs(datedSeq) do
pdated = gsub(pdated, k, v)
end
return (pdated ~= PAGENAME and pdated or nil)
end
function export.show(frame)
local args = frame:getParent().args
local common = args or args or nil
local dated = args or args or preloadDatedForm()
local obsolete = args or args or args or nil
local altForms = {}
altForms.common = (common and mw.text.split(common, ",", true) or {})
altForms.dated = (dated and mw.text.split(dated, ",", true) or {})
altForms.obsolete = (obsolete and mw.text.split(obsolete, ",", true) or {})
local output = {}
if common then
table.insert(altForms.common, 1, "lo")
table.insert(output, "* " .. frame:expandTemplate{title = "alter", args = altForms.common})
end
if dated then
table.insert(altForms.dated, 1, "lo")
table.insert(altForms.dated, "")
table.insert(altForms.dated, "dated")
table.insert(output, "* " .. frame:expandTemplate{title = "alter", args = altForms.dated})
end
if obsolete then
table.insert(altForms.obsolete, 1, "lo")
table.insert(altForms.obsolete, "")
table.insert(altForms.obsolete, "obsolete")
table.insert(output, "* " .. frame:expandTemplate{title = "alter", args = altForms.obsolete})
end
return table.concat(output, "\n")
end
return export