Module:war-headword

local export = {} local pos_functions = {}

local lang = require("Module:languages").getByCode("war") local PAGENAME = mw.title.getCurrentTitle.text local script = lang:findBestScript(PAGENAME) -- Latn

function export.show(frame)

local tracking_categories = {}

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 = {} -- supports multiple headword if args["head"] or args[1] then table.insert(head, args["head"] or args[1]) end if args["head2"] or args[2] then table.insert(head, args["head2"] or args[2]) end if args["head3"] or args[3] then table.insert(head, args["head3"] or args[3]) 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

local content = mw.title.new(PAGENAME):getContent local code = content and mw.ustring.match(content, "{{war%-IPA[^}]*}}")

--Categorize words without Template:war-IPA if script:getCode == "Latn" and not code then table.insert(tracking_categories, "Waray-Waray terms without war-IPA template") end

return require("Module:headword").full_headword(data) .. require("Module:utilities").format_categories(tracking_categories, lang)

end

pos_functions["verbs"] = function(args, data)

params = { [1] = {alias_of = 'head'}, [2] = {alias_of = 'real'}, --realis aspect [3] = {alias_of = 'imp'}, --imperative head = {list = true}, head2= {}, head3= {}, real = {list = true}, imp = {list = true}, dim = {list = true}, caus = {list = true}, freq = {list = true}, }

local args = require("Module:parameters").process(args,params) data.heads = args.head data.id = args.id	local pattern = args.pattern args.real.label = "realis" args.imp.label = "imperative" args.dim.label = "diminutive" args.caus.label = "causative" args.freq.label = "frequentative"

args.real.accel = {form = "realis"} args.imp.accel = {form = "imperative"}

if #args.real > 0 then table.insert(data.inflections, args.real) end if #args.imp > 0 then table.insert(data.inflections, args.imp) end if #args.dim > 0 then table.insert(data.inflections, args.dim) end if #args.caus > 0 then table.insert(data.inflections, args.caus) end if #args.freq > 0 then table.insert(data.inflections, args.freq) end

end

pos_functions["adjectives"] = function(args, data)

params = { [1] = {alias_of = 'head'}, [2] = {alias_of = 'sup'}, head = {list = true}, head2= {}, head3= {}, sup = {list = true}, caus = {list = true}, dim = {list = true} }	local args = require("Module:parameters").process(args,params) data.heads = args.head data.id = args.id	local pattern = args.pattern args.sup.label = "superlative" args.caus.label = "causative" args.dim.label = "diminutive"

args.sup.accel = {form = "superlative"}

if #args.sup > 0 then table.insert(data.inflections, args.sup) end if #args.caus > 0 then table.insert(data.inflections, args.caus) end if #args.dim > 0 then table.insert(data.inflections, args.dim) end

end

pos_functions["nouns"] = function(args, data)

params = { [1] = {alias_of = 'head'}, [2] = {alias_of = 'pl'}, -- Special plural cases only head = {list = true}, head2= {}, head3= {}, pl = {list =true}, dim = {list = true} }	local args = require("Module:parameters").process(args,params) data.heads = args.head data.id = args.id	local pattern = args.pattern args.pl.label = "plural" args.dim.label = "diminutive"

args.pl.accel = {form = "plural"}

if #args.pl > 0 then table.insert(data.inflections, args.pl) end if #args.dim > 0 then table.insert(data.inflections, args.dim) end

end

return export