Module:User:Santi2222/ruo-headword

local export = {} local lang = require("Module:languages").getByCode("ruo")

--nouns function export.show_noun(frame) local args = frame:getParent.args local data = {lang = lang, pos_category = frame.args.proper and "proper nouns" or "nouns", categories = {}, sort_key = args.sort, heads = {args.head}, genders, inflections = {}} local tracking_categories = {} local g = args[1] local pl = args[2] local pl2 = args["pl2"] local head = args.head or mw.title.getCurrentTitle.text local add_infl_data = true local gen_list = {m = true, n = true, f = true}

if not g then error("Please provide the grammatical gender") elseif gen_list[g] then data.genders = { g } elseif g == "m-n" then data.genders = {"m", "n"} else error("Please provide a valid grammatical gender") end if not pl then error("Please provide a plural form") elseif pl == "-" then infl_data = {label = "uncountable"} table.insert(data.categories, "Istro-Romanian uncountable nouns") elseif pl == "?" then add_infl_data = false table.insert(data.categories, "Istro-Romanian nouns with unknown plurals") else infl_data = {label = "plural", pl} end if pl2 and (pl == "-" or pl == "?") then error("No main plural form has been specified.") elseif pl2 then table.insert(infl_data, pl2) end if add_infl_data then data.inflections = {infl_data} end return require("Module:headword").full_headword(data) .. require("Module:utilities").format_categories(tracking_categories, lang, args.sort) end

return export