local export = {}
local pos_functions = {}
local lang = require("Module:languages").getByCode("got")
-- 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
local args = frame:getParent().args
local poscat = frame.args or error("Part of speech has not been specified. Please pass parameter 1 to the module invocation.")
local cat = args; if cat == "" then cat = nil end
local cat2 = args; if cat2 == "" then cat2 = nil end
local cat3 = args; if cat3 == "" then cat3 = nil end
local head = args; if head == "" then head = nil end
local tr = args; if tr == "" then tr = nil end
local data = {lang = lang, pos_category = cat or poscat, categories = {}, heads = {head}, translits = {tr}, genders = {}, inflections = {}}
if cat2 then table.insert(data.categories, "Gothic " .. cat2) end
if cat3 then table.insert(data.categories, "Gothic " .. cat3) end
if pos_functions then
pos_functions(args, data)
end
return require("Module:headword").full_headword(data)
end
pos_functions = function(args, data)
-- Iterate over all gn parameters (g2, g3 and so on) until one is empty
local g = args or ""; if g == "" then g = "?" end
local i = 2
while g ~= "" do
-- If any of the specifications is a "?", add the entry
-- to a cleanup category.
if g == "m-p" or g == "f-p" or g == "n-p" then
table.insert(data.categories, "Gothic pluralia tantum")
end
table.insert(data.genders, g)
g = args or ""
i = i + 1
end
if #data.genders == 0 then
table.insert(data.genders, "?")
end
end
pos_functions = pos_functions
pos_functions = function(args, data)
local adverb = args; if adverb == "" then adverb = nil end
local comparative = args; if comparative == "" then comparative = nil end
local superlative = args; if superlative == "" then superlative = nil end
if adverb then
table.insert(data.inflections, {label = "adverb", adverb})
end
if comparative then
table.insert(data.inflections, {label = "comparative", comparative})
end
if superlative then
table.insert(data.inflections, {label = "superlative", superlative})
end
end
pos_functions = function(args, data)
local adjective = args; if adjective == "" then adjective = nil end
local comparative = args; if comparative == "" then comparative = nil end
local superlative = args; if superlative == "" then superlative = nil end
if adjective then
table.insert(data.inflections, {label = "adjective", adjective})
end
if comparative then
table.insert(data.inflections, {label = "comparative", comparative})
end
if superlative then
table.insert(data.inflections, {label = "superlative", superlative})
end
end
return export