local export = {}
local pos_functions = {}
local twstyle = "font-family: 'Tengwar Annatar', 'Tengwar Eldamar', 'Tengwar Noldor', 'Tengwar Parmaite', 'Tengwar Formal', 'Tengwar Elfica', 'Tengwar Sindarin', 'Tengwar Quenya', 'Tengwar Gothika'"
-- If Not Empty
local function ine(arg)
if arg == "" then
return nil
else
return arg
end
end
local function handle_infl(args, data, argpref, label)
if args and args then
local forms = {}
local form = argpref
local i = 1
while args do
table.insert (forms, args)
i = i + 1
form = argpref..i
end
forms.label = mw.ustring.gsub(label, 'form', 'forms')
table.insert(data.inflections, forms )
elseif args then
table.insert(data.inflections, { label = label, args})
end
end
local lang = require("Module:languages").getByCode("qya")
local script = require('Module:scripts').getByCode("Latn")
local PAGENAME = mw.ustring.gsub(mw.title.getCurrentTitle().text, '+/', '')
local tengwar = require("Module:tengwar")
function export.show(frame)
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.")
poscat = string.gsub(poscat, 'form', 'forms')
local data = {lang = lang, sc = script, pos_category = poscat, categories = {}, heads = {args or PAGENAME}, inflections = {}, sort_key = args}
if args then
table.insert(data.categories, "Quenya " .. args)
end
if args then
table.insert(data.categories, "Quenya " .. args)
end
handle_infl(args, data, "stem", "stem")
if pos_functions then
pos_functions(args, data)
end
local tengw = tengwar.convert("qya", "annatar", args or args or args or PAGENAME)
data.heads = data.heads..' • <span style="'..twstyle..'">'..tengw..'</span>'
return require("Module:headword").full_headword(data)
end
pos_functions = function(args, data)
handle_infl(args, data, "du", "dual")
handle_infl(args, data, "pl", "plural")
end
pos_functions = function(args, data)
handle_infl(args, data, "encl", "enclitic form")
handle_infl(args, data, "ind", "independent form")
handle_infl(args, data, "emph", "emphatic form")
end
pos_functions = function(args, data)
handle_infl(args, data, "past", "past tense")
end
pos_functions = pos_functions
return export