Modul:nap-headword
A modult a Modul:nap-headword/doc lapon tudod dokumentálni
local export = {}
local pos_functions = {}
local lang = require("Module:languages").getByCode("nap")
function export.show(frame)
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, pos_category = poscat, categories = {}, heads = {head}, inflections = {}}
if pos_functions[poscat] then
pos_functions[poscat](args, data)
end
return require("Module:headword").full_headword(data)
end
pos_functions["adjectives"] = function(args, data)
local arg1 = args[1]
local arg2 = args[2]
local arg3 = args[3]
if arg3 then
table.insert(data.inflections,{label = "feminine singular", arg1, accel = {form = "f|s"}})
table.insert(data.inflections,{label = "masculine plural", arg2, accel = {form = "m|p"}})
table.insert(data.inflections,{label = "feminine plural", arg3, accel = {form = "f|p"}})
elseif arg2 then
table.insert(data.inflections,{label = "feminine singular", arg1, accel = {form = "f|s"}})
table.insert(data.inflections,{label = "plural", arg2, accel = {form = "p"}})
elseif arg1 then
table.insert(data.inflections,{label = "plural", arg1, accel = {form = "p"}})
else
PAGENAME = mw.title.getCurrentTitle().text
if mw.ustring.sub(PAGENAME,-1) == 'o' then
table.insert(data.inflections,{label = "feminine singular", mw.ustring.sub(PAGENAME,1,-2)..'a', accel = {form = "f|s"}})
if mw.ustring.sub(PAGENAME,-3) == 'cio' or mw.ustring.sub(PAGENAME,-3) == 'gio' then
table.insert(data.inflections,{label = "plural", mw.ustring.sub(PAGENAME,1,-3)..'e', accel = {form = "p"}})
elseif mw.ustring.sub(PAGENAME,-2) == 'co' or mw.ustring.sub(PAGENAME,-2) == 'go' then
table.insert(data.inflections,{label = "plural", mw.ustring.sub(PAGENAME,1,-2)..'he', accel = {form = "p"}})
else
table.insert(data.inflections,{label = "plural", mw.ustring.sub(PAGENAME,1,-2)..'e', accel = {form = "p"}})
end
elseif mw.ustring.sub(PAGENAME,-1) == 'e' then
table.insert(data.inflections,{label = "plural", "{{{p}}}"})
end
end
end
return export