Module:headword/templates: Difference between revisions

No edit summary
No edit summary
Line 8: Line 8:
local boolean_list_allow_holes = {type = "boolean", list = true, allow_holes = true}
local boolean_list_allow_holes = {type = "boolean", list = true, allow_holes = true}
local list_allow_holes = {list = true, allow_holes = true}
local list_allow_holes = {list = true, allow_holes = true}
local plain = {}
return process_params(frame:getParent().args, {
return process_params(frame:getParent().args, {
[1] = {required = true, type = "language", default = "und"},
[1] = {required = true, type = "language", default = "und"},
["sc"] = {type = "script"},
["sc"] = {type = "script"},
["sort"] = plain,
["sort"] = true,


[2] = {required = true, default = "nouns"},
[2] = {required = true, default = "nouns"},
Line 22: Line 21:
["nolinkhead"] = boolean,
["nolinkhead"] = boolean,
["autotrinfl"] = boolean,
["autotrinfl"] = boolean,
["cat2"] = plain,
["altform"] = boolean, -- EXPERIMENTAL: see [[Wiktionary:Beer parlour/2024/June#Decluttering the altform mess]]
["cat3"] = plain,
["cat2"] = true,
["cat4"] = plain,
["cat3"] = true,
["cat4"] = true,
["head"] = list_allow_holes,
["head"] = list_allow_holes,
["id"] = plain,
["id"] = true,
["tr"] = list_allow_holes,
["tr"] = list_allow_holes,
["ts"] = list_allow_holes,
["ts"] = list_allow_holes,
["gloss"] = plain,
["gloss"] = true,
["g"] = {list = true},
["g"] = {list = true},
["g\1qual"] = list_allow_holes,
["g\1qual"] = list_allow_holes,
["affix"] = {list = true},
["affix"] = {list = true},
[3] = list_allow_holes,
[3] = list_allow_holes,
 
["f\1accel-form"] = list_allow_holes,
["f\1accel-translit"] = list_allow_holes,
["f\1accel-lemma"] = list_allow_holes,
["f\1accel-lemma-translit"] = list_allow_holes,
["f\1accel-gender"] = list_allow_holes,
["f\1accel-nostore"] = boolean_list_allow_holes,
["f\1request"] = list_allow_holes,
["f\1request"] = list_allow_holes,
["f\1alt"] = list_allow_holes,
["f\1alt"] = list_allow_holes,
Line 71: Line 76:
data.affix = args["affix"]
data.affix = args["affix"]


for k, v in pairs(args["gqual"]) do
if k ~= "maxindex" then
if data.genders[k] then
data.genders[k] = {spec = data.genders[k], qualifiers = {v}}
else
k = k == 1 and "" or tostring(k)
error(("g%squal= specified without g%s="):format(k, k))
end
end
end
-- EXPERIMENTAL: see [[Wiktionary:Beer parlour/2024/June#Decluttering the altform mess]]
data.altform = args["altform"]
-- Part-of-speech category
-- Part-of-speech category
local pos_category = args[2]
local pos_category = args[2]
Line 76: Line 95:
-- Check for headword aliases and then pluralize if the POS term does not have an invariable plural.
-- Check for headword aliases and then pluralize if the POS term does not have an invariable plural.
data.pos_category = m_headword.pluralize_pos(
data.pos_category = m_headword.canonicalize_pos(pos_category)
mw.loadData("Module:headword/data").pos_aliases[pos_category] or pos_category
)


-- Additional categories.
-- Additional categories.
Line 86: Line 103:
data.nogendercat = args["nogendercat"]
data.nogendercat = args["nogendercat"]
data.nopalindromecat = args["nopalindromecat"]
data.nopalindromecat = args["nopalindromecat"]
    table.insert(data.categories, "Contionary")
table.insert(data.categories, "Contionary")


if args["cat2"] then
if args["cat2"] then
Line 109: Line 126:
local infl_part = {
local infl_part = {
label    = args[3][i * 2 - 1],
label    = args[3][i * 2 - 1],
accel    = args["faccel-form"][i] and {
form      = args["faccel-form"][i],
translit  = args["faccel-translit"][i],
lemma    = args["faccel-lemma"][i],
lemma_translit = args["faccel-lemma-translit"][i],
gender    = args["faccel-gender"][i],
nostore  = args["faccel-nostore"][i],
} or nil,
request  = args["frequest"][i],
request  = args["frequest"][i],
enable_auto_translit = args["fautotr"][i],
enable_auto_translit = args["fautotr"][i],