local export = {}
local lang = require("Module:languages").getByCode("akk")
local links_module = "Module:links"
local string_utilities_module = "Module:string utilities"
local parse_interface_module = "Module:parse interface"
local parameter_utilities_module = "Module:parameter utilities"
local qualifier_module = "Module:qualifier"
local function format_list_items(terms, linked)
local result = {}
for _, term in ipairs(terms) do
if not linked then
term = term
term = nil
end
local link = require(links_module).full_link(term, nil, false, true)
table.insert(result, '\n* ' .. link)
end
return table.concat(result)
end
function export.create_list(args, paramname)
if type(args) ~= "table" then error("expected table, got " .. type(args)) end
local output = {}
table.insert(output, ])
if args.alphabetize then
require("Module:collation").sort(args, lang)
end
table.insert(output, format_list_items(args, paramname == "sum"))
table.insert(output, '</div>')
return table.concat(output)
end
function export.parse_params(args, paramname)
local terms = args
local param_mods = require("Module:parameter utilities").construct_param_mods {
{ default = true, require_index = true },
{ group = { "link", "q" } },
}
local function generate_obj(term, parse_err)
local termlang
if allow_explicit_lang then
local actual_term
actual_term, termlang = require(parse_interface_module).parse_term_with_lang {
term = term,
parse_err = parse_err,
paramname = paramname,
}
term = actual_term or term
end
return {
term = term,
lang = termlang or lang,
}
end
for i, term in ipairs(terms) do
terms = require(parse_interface_module).parse_inline_modifiers(term, {
param_mods = param_mods,
paramname = paramname,
generate_obj = generate_obj,
})
end
return export.create_list(terms, paramname)
end
function export.display(frame)
local parent_args = frame:getParent().args
local params = {
= { list = true },
= { list = true },
= { list = true }
}
local args = require("Module:parameters").process(parent_args, params)
local top = mw.getCurrentFrame():expandTemplate {
title = 'inflection-table-top',
args = {
title = 'Cuneiform spellings',
class = "tr-alongside"
}
}
local headers = ""
local data = ""
if next(args) ~= nil then
headers = headers .. [===[
! Logograms
]===]
data = data .. [===[
| style="text-align: start;" | {sum}
]===]
end
if next(args) ~= nil then
headers = headers .. [===[
! Phonetic
]===]
data = data .. [===[
| style="text-align: start;" | {phon}
]===]
end
if next(args) ~= nil then
headers = headers .. [===[
! Mixed
]===]
data = data .. [===[
| style="text-align: start;" | {mix}
]===]
end
local template = top .. headers .. [===[
|- valign="top"
]===] .. data .. mw.getCurrentFrame():expandTemplate {
title = 'inflection-table-bottom',
}
local forms = {}
forms = export.parse_params(args, "sum")
forms = export.parse_params(args, "phon")
forms = export.parse_params(args, "mix")
return require(string_utilities_module).format(template, forms)
end
return export