Mô đun:id-headword
Giao diện
local export = {}
local pos_functions = {}
local lang = require("Module:languages").getByCode("id")
local script = require('Module:scripts').getByCode("Latn")
local PAGENAME = mw.title.getCurrentTitle().text
function export.show(frame)
-- FIXME: Use [[Module:parameters]].
local args = frame:getParent().args
local poscat = frame.args[1] or error("Part of speech has not been specified. Please pass parameter 1 to the module invocation.")
local head = args["head"]; if head == "" then head = nil end
local data = {lang = lang, sc = script, pos_category = poscat, categories = {}, heads = {head}, translits = {"-"}, inflections = {}}
if pos_functions[poscat] then
pos_functions[poscat](args, data)
end
return require("Module:headword").full_headword(data)
end
pos_functions["Danh từ"] = function(args, data)
local pl = {label = "số nhiều"}
if args["pl"] == nil then
table.insert(data.categories, "Requests for plural forms in Indonesian entries")
else
if args["pl"] == "-" then
table.insert(data.categories, "Indonesian uncountable nouns")
else
if args["pl"] == "duplication" then
-- common plural
local subwords = mw.text.split(PAGENAME, "%s")
local firstword = subwords[1]
subwords[1] = mw.ustring.gsub("[[" .. firstword .. "]]-[[" .. firstword .. "]]", "([a-z]+%-)%1%1", "banyak %1") -- reduplicate only first word
table.insert(pl, table.concat(subwords, " "))
else
table.insert(pl, args["pl"]) -- this is also used for 'para' type
if args["pl2"] then table.insert(pl, args["pl2"]) end
if args["pl3"] then table.insert(pl, args["pl3"]) end
end
table.insert(data.inflections, pl)
end
end
local ku = {label = "đại từ sở hữu ngôi thứ nhất"}
if args["ku"] ~= "-" or args["ku"] == nil then
table.insert(data.inflections, ku)
table.insert(ku, mw.ustring.format("%s[[-ku|ku]]", PAGENAME))
end
local mu = {label = "đại từ sở hữu ngôi thứ hai"}
if args["mu"] ~= "-" or args["mu"] == nil then
table.insert(data.inflections, mu)
table.insert(mu, mw.ustring.format("%s[[-mu|mu]]", PAGENAME))
end
local nya = {label = "đại từ sở hữu ngôi thứ ba"}
if args["nya"] ~= "-" or args["nya"] == nil then
table.insert(data.inflections, nya)
table.insert(nya, mw.ustring.format("%s[[-nya|nya]]", PAGENAME))
end
end
pos_functions["proper nouns"] = function(args, data)
local pl = {label = "plural"}
-- not necessary to have plural(s)
if args["pl"] then table.insert(pl, args["pl"]) end
if args["pl2"] then table.insert(pl, args["pl2"]) end
if args["pl3"] then table.insert(pl, args["pl3"]) end
if #pl > 0 then table.insert(data.inflections, pl) end
end
pos_functions["adjectives"] = function(args, data)
end
return export