Module:stq-headword

--Mostly based on the nl-headword module, with some changes.

local export = {} local pos_functions = {}

local lang = require("Module:languages").getByCode("stq")

-- The main entry point. -- This is the only function that can be invoked from a template. function export.show(frame) PAGENAME = mw.title.getCurrentTitle.text --Part of speech. local poscat = frame.args[1] or error("Part of speech has not been specified. Please pass parameter 1 to the module invocation.") local params = { ["head"] = {list = true}, }	if pos_functions[poscat] then for key, val in pairs(pos_functions[poscat].params) do			params[key] = val end end local args = require("Module:parameters").process(frame:getParent.args, params) local data = {lang = lang, pos_category = poscat, categories = {}, heads = args["head"], genders = {}, inflections = {}, tracking_categories = {}} if pos_functions[poscat] then pos_functions[poscat].func(args, data) end return require("Module:headword").full_headword(data) .. require("Module:utilities").format_categories(data.tracking_categories, lang, nil) end

-- Display information for a noun's gender -- This is separate so that it can also be used for proper nouns function noun_gender(args, data) for _, g in ipairs(args[1]) do		if g ~= "m" and g ~= "f" and g ~= "n" then g = nil end table.insert(data.genders, g)	end if #data.genders == 0 then table.insert(data.genders, "?") end end

-- Display proper noun pos_functions["proper nouns"] = { params = { [1] = {list = "g"}, },	func = function(args, data) noun_gender(args, data) end }

-- Display information for a noun pos_functions["nouns"] = { params = { [1] = {list = "g"}, ["g2"] = {list = true}, [2] = {list = "pl"}, ["m"] = {list = true}, ["f"] = {list = true}, },	func = function(args, data) noun_gender(args, data) local plurals = args[2] local mascforms = args["m"] local femforms = args["f"] --Uncountable if plurals[1] == "-" then table.insert(data.inflections, {label = "uncountable"}) table.insert(data.categories, "Saterland Frisian uncountable nouns") else -- Add the plural forms plurals.label = "plural" plurals.accel = {form = "p"} plurals.request = true table.insert(data.inflections, plurals) end -- Add the feminine forms if #femforms > 0 then femforms.label = "feminine" table.insert(data.inflections, femforms) end -- Add the masculine forms if #mascforms > 0 then mascforms.label = "masculine" table.insert(data.inflections, mascforms) end end }

return export