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")
local unpack = unpack or table.unpack -- Lua 5.2 compatibility
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 then
data.heads = {args}
end
if args and not args then
args = "-"
end
if not args then
table.insert(categories, "fi-adj with no 1 or 2")
elseif args == "-" then
data.inflections = {{ label = "]" }}
table.insert(categories, "Finnish uncomparable adjectives")
elseif not args then
table.insert(categories, "fi-adj with no 1 or 2")
else
local stem = args
local comp = {{term = stem .. args, accel = {form = "comparative"}}}
local sup = {}
for i = 3, 10 do
if not args then break end
table.insert(sup, {term = stem .. args, accel = {form = "superlative"}})
end
if args then
table.insert(comp, {term = args, accel = {form = "comparative"}})
elseif args then
table.insert(comp, {term = args, accel = {form = "comparative"}})
end
if args then
table.insert(comp, {term = args, accel = {form = "comparative"}})
elseif args then
table.insert(comp, {term = args, accel = {form = "comparative"}})
end
if args then
table.insert(sup, {term = args, accel = {form = "superlative"}})
elseif args then
table.insert(sup, {term = args, accel = {form = "superlative"}})
end
data.inflections = {{label = "comparative", unpack(comp)}, {label = "superlative", unpack(sup)}}
end
if args then
table.insert(data.inflections, {label = "]"})
table.insert(data.inflections, {label = "only used ]"})
table.insert(categories, "Finnish indeclinable adjectives")
end
data.categories = categories
return require("Module:headword").full_headword(data)
end
return export