Module:fi-headword
Jump to navigation
Jump to search
- The following documentation is located at Module:fi-headword/documentation. [edit]
- Useful links: subpage list • links • transclusions • testcases • sandbox
A module used to power some Finnish headword templates, currently only {{fi-adj}}
.
local export = {}
local lang = require("Module:languages").getByCode("fi")
local m_utilities = require("Module:utilities")
export.adj = function(frame)
local title = mw.title.getCurrentTitle().text
local args = frame:getParent().args
local data = {lang = lang, pos_category = "adjectives"}
local categories = {}
if args["head"] then
data.heads = {args["head"]}
end
if args["attr_only"] and not args[1] then
args[1] = "-"
end
if not args[1] then
table.insert(categories, "fi-adj with no 1 or 2")
elseif args[1] == "-" then
data.inflections = {{ label = "[[Appendix:Glossary#uncomparable|not comparable]]" }}
table.insert(categories, "Finnish uncomparable adjectives")
elseif not args[2] then
table.insert(categories, "fi-adj with no 1 or 2")
else
local stem = args[1]
local comp = {{term = stem .. args[2], accel = {form = "comparative"}}}
local sup = {}
for i = 3, 10 do
if not args[i] then break end
table.insert(sup, {term = stem .. args[i], accel = {form = "superlative"}})
end
if args["c2"] then
table.insert(comp, {term = args["c2"], accel = {form = "comparative"}})
elseif args["comp2"] then
table.insert(comp, {term = args["comp2"], accel = {form = "comparative"}})
end
if args["c3"] then
table.insert(comp, {term = args["c3"], accel = {form = "comparative"}})
elseif args["comp3"] then
table.insert(comp, {term = args["comp3"], accel = {form = "comparative"}})
end
if args["s2"] then
table.insert(sup, {term = args["s2"], accel = {form = "superlative"}})
elseif args["sup2"] then
table.insert(sup, {term = args["sup2"], accel = {form = "superlative"}})
end
data.inflections = {{label = "comparative", unpack(comp)}, {label = "superlative", unpack(sup)}}
end
if args["attr_only"] then
table.insert(data.inflections, {label = "[[Appendix:Glossary#indeclinable|indeclinable]]"})
table.insert(data.inflections, {label = "only used [[Appendix:Glossary#attributive|attributively]]"})
end
data.categories = categories
return require("Module:headword").full_headword(data)
end
return export