Module:fy-adjectives

local lang = require("Module:languages").getByCode("fy")

local export = {}

function export.adjective(frame) local params = { [1] = {},		[2] = {},		[3] = {},		["pred"] = {}, ["part"] = {}, }	local args = require("Module:parameters").process(frame:getParent.args, params) local make_auto_subtabler = require("Module:auto-subtable") local data = {forms = make_auto_subtabler, categories = {}, comparable = true} -- Get parameters local pred = args["pred"] local infl = args[1] local part = args["part"] if args[2] == "-" then data.comparable = false end local base = mw.title.getCurrentTitle.nsText == "Template" and "-" or mw.title.getCurrentTitle.text -- Positive degree if pred == "-" then pred = nil elseif not pred then pred = base end if not infl then infl = base .. "e" end if part == "-" then part = nil elseif not part then if base:find("s$") then part = base else part = base .. "s" end end data.forms["pred"] = {pred} data.forms["indef|c|s"] = {infl} data.forms["indef|n|s"] = {base} data.forms["indef|p"] = {infl} data.forms["def"] = {infl} data.forms["par"] = {part} if data.comparable then -- Comparative degree local comd_base = {args[2]} if not comd_base[1] then -- Adjectives ending in -r get an extra -d- in the comparative, -- disregarding the inflected form. if base:find("r$") then comd_base = {base .. "der"} -- Adjectives ending in -l or -n also get an extra -d-, -- but it's optional alongside the form without it. elseif base:find("[ln]$") then comd_base = {base .. "der", infl .. "r"} else comd_base = {infl .. "r"} end end for _, form in ipairs(comd_base) do			table.insert(data.forms["pred|comd"], form) table.insert(data.forms["indef|n|s|comd"], form) table.insert(data.forms["indef|c|s|comd"], form .. "e") table.insert(data.forms["indef|p|comd"], form .. "e") table.insert(data.forms["def|comd"], form .. "e") table.insert(data.forms["par|comd"], form .. "s") end -- Superlative degree local supd_base = {args[3]} if not supd_base[1] then if base:find("st$") then supd_base = {base} else supd_base = {part .. "t"} end end for _, form in ipairs(supd_base) do table.insert(data.forms["pred|supd"], "it " .. form .. "") table.insert(data.forms["pred|supd"], "it " .. form .. "e") table.insert(data.forms["indef|c|s|supd"], form .. "e") table.insert(data.forms["indef|n|s|supd"], form .. "e") table.insert(data.forms["indef|p|supd"], form .. "e") table.insert(data.forms["def|supd"], form .. "e") end end -- Remove metatable. data.forms:un_auto_subtable return make_table(data) end

-- Make the table function make_table(data) local function repl(param) local accel = true local no_store = false if param == "lemma" then return require("Module:links").full_link({lang = lang, alt = mw.title.getCurrentTitle.text}, "term") elseif param == "info" then return data.title and " (" .. data.title .. ")" or "" elseif string.sub(param, 1, 1) == "!" then no_store = true param = string.sub(param, 2) elseif string.sub(param, 1, 1) == "#" then accel = false param = string.sub(param, 2) end local forms = data.forms[param] if not forms then return "&mdash;" end local ret = {} for key, subform in ipairs(forms) do			table.insert(ret, require("Module:links").full_link({lang = lang, term = subform, accel = accel and {form = param, lemma = data.lemma, no_store = no_store} or nil})) end return table.concat(ret, " ") end local wikicode = [=[ return mw.ustring.gsub(wikicode, "", repl) .. require("Module:utilities").format_categories(data.categories, lang) end

return export