local export = {}
local output = {}
local concat = table.concat
local insert = table.insert
local lang = require("Module:languages").getByCode("se")
local function postprocess(args, data)
data.lemma = data.forms
data.forms = nil -- Remove until there's a reliable way to determine which verbs have it
-- Check if the lemma form matches the page name
if (lang:makeEntryName(data.lemma)) ~= mw.title.getCurrentTitle().text then
insert(data.categories, lang:getCanonicalName() .. " entries with inflection not matching pagename")
end
end
-- Inflection functions
function export.even(frame)
local params = {
= {required = true, default = "{{{1}}}"},
= {default = "table"},
}
local args = require("Module:parameters").process(frame:getParent().args, params)
local stem = require("Module:se-common").Stem(args, true)
local data = {
forms = {},
info = "even " .. require("Module:links").full_link({lang = lang, alt = stem.uvowel}, "term") .. "-stem",
categories = {},
}
if stem.gradation then
data.info = data.info .. ", " ..
require("Module:links").full_link({lang = lang, alt = stem.gradation.strong.scons}, "term") .. "-" ..
require("Module:links").full_link({lang = lang, alt = stem.gradation.weak.scons}, "term") .. " gradation"
else
data.info = data.info .. ", no gradation"
end
if not mw.ustring.find(stem.uvowel, "^$") and mw.title.getCurrentTitle().nsText ~= "Template" then
error("The final vowel(s) of the stem must be one of a, i, u.")
end
insert(data.categories, lang:getCanonicalName() .. " even verbs")
insert(data.categories, lang:getCanonicalName() .. " even " .. (stem.uvowel or "") .. "-stem verbs")
data.forms = {stem:make_form{grade = "strong", ending = "t"}}
data.forms = {stem:make_form{grade = "extra", variant = "j_contr_final"}}
data.forms = {stem:make_form{grade = "strong", ending = "n", variant = "e"}}
data.forms = {stem:make_form{grade = "strong", ending = "n"}}
data.forms = {stem:make_form{grade = "strong", ending = "n"}}
data.forms = {stem:make_form{grade = "strong", ending = "min"}, stem:make_form{grade = "strong", ending = "me"}}
data.forms = {stem:make_form{grade = "strong", ending = "mis"}}
data.forms = {stem:make_form{grade = "strong", ending = "miin"}}
data.forms = {stem:make_form{grade = "weak", ending = "keahttá", variant = "short"}}
data.forms = {stem:make_form{grade = "weak", ending = "n", variant = "pres_12sg"}}
data.forms = {stem:make_form{grade = "weak", ending = "t", variant = "pres_12sg"}}
data.forms = {stem:make_form{grade = "strong", variant = "pres_3sg"}}
data.forms = {stem:make_form{grade = "strong", variant = "j_contr"}}
data.forms = {stem:make_form{grade = "strong", ending = "beahtti"}}
data.forms = {stem:make_form{grade = "strong", ending = "ba"}}
data.forms = {stem:make_form{grade = "strong", ending = "t"}}
data.forms = {stem:make_form{grade = "strong", ending = "bēhtet"}}
data.forms = {stem:make_form{grade = "strong", ending = "t", variant = "j_contr"}}
data.forms = {stem:make_form{grade = "weak", variant = "short"}}
data.forms = {stem:make_form{grade = "strong", ending = "n", variant = "j_contr"}}
data.forms = {stem:make_form{grade = "strong", ending = "t", variant = "j_contr"}}
data.forms = {stem:make_form{grade = "weak", ending = "i", variant = "j"}}
data.forms = {stem:make_form{grade = "weak", ending = "ime", variant = "j"}}
data.forms = {stem:make_form{grade = "weak", ending = "ide", variant = "j"}}
data.forms = {stem:make_form{grade = "weak", ending = "iga", variant = "j"}}
data.forms = {stem:make_form{grade = "weak", ending = "imet", variant = "j"}}
data.forms = {stem:make_form{grade = "weak", ending = "idet", variant = "j"}}
data.forms = {stem:make_form{grade = "strong", variant = "j_contr"}}
data.forms = {stem:make_form{grade = "strong", ending = "n", variant = "e"}}
data.forms = {stem:make_form{grade = "strong", ending = "n", variant = "impr"}}
data.forms = {stem:make_form{grade = "weak", variant = "short"}}
data.forms = {stem:make_form{grade = "strong", ending = "s", variant = "impr"}}
data.forms = {stem:make_form{grade = "extra", variant = "impr_final"}}
data.forms = {stem:make_form{grade = "extra", variant = "j_contr_final"}}
data.forms = {stem:make_form{grade = "strong", ending = "ska", variant = "impr"}}
data.forms = {stem:make_form{grade = "strong", ending = "t", variant = "impr"}, stem:make_form{grade = "extra", ending = "t", variant = "impr_final"}}
data.forms = {stem:make_form{grade = "strong", ending = "t", variant = "j_contr"}, stem:make_form{grade = "extra", ending = "t", variant = "j_contr_final"}}
data.forms = {stem:make_form{grade = "strong", ending = "set", variant = "impr"}}
data.forms = {stem:make_form{grade = "weak", variant = "short"}}
data.forms = {stem:make_form{grade = "weak", ending = "šin", variant = "e"}, stem:make_form{grade = "weak", ending = "šedjen", variant = "e"}}
data.forms = {stem:make_form{grade = "weak", ending = "šit", variant = "e"}, stem:make_form{grade = "weak", ending = "šedjet", variant = "e"}}
data.forms = {stem:make_form{grade = "weak", ending = "šii", variant = "e"}}
data.forms = {stem:make_form{grade = "weak", ending = "šeimme", variant = "e"}}
data.forms = {stem:make_form{grade = "weak", ending = "šeidde", variant = "e"}}
data.forms = {stem:make_form{grade = "weak", ending = "šeigga", variant = "e"}}
data.forms = {stem:make_form{grade = "weak", ending = "šeimmet", variant = "e"}}
data.forms = {stem:make_form{grade = "weak", ending = "šeiddet", variant = "e"}}
data.forms = {stem:make_form{grade = "weak", ending = "še", variant = "e"}, stem:make_form{grade = "weak", ending = "šedje", variant = "e"}}
data.forms = {stem:make_form{grade = "weak", ending = "še", variant = "e"}}
data.forms = {stem:make_form{grade = "weak", ending = "lin", variant = "e"}, stem:make_form{grade = "weak", ending = "ledjen", variant = "e"}}
data.forms = {stem:make_form{grade = "weak", ending = "lit", variant = "e"}, stem:make_form{grade = "weak", ending = "ledjet", variant = "e"}}
data.forms = {stem:make_form{grade = "weak", ending = "lii", variant = "e"}}
data.forms = {stem:make_form{grade = "weak", ending = "leimme", variant = "e"}}
data.forms = {stem:make_form{grade = "weak", ending = "leidde", variant = "e"}}
data.forms = {stem:make_form{grade = "weak", ending = "leigga", variant = "e"}}
data.forms = {stem:make_form{grade = "weak", ending = "leimmet", variant = "e"}}
data.forms = {stem:make_form{grade = "weak", ending = "leiddet", variant = "e"}}
data.forms = {stem:make_form{grade = "weak", ending = "le", variant = "e"}, stem:make_form{grade = "weak", ending = "ledje", variant = "e"}}
data.forms = {stem:make_form{grade = "weak", ending = "le", variant = "e"}}
data.forms = {stem:make_form{grade = "weak", ending = "žan", variant = "i"}}
data.forms = {stem:make_form{grade = "weak", ending = "žat", variant = "i"}}
data.forms = {stem:make_form{grade = "weak", ending = "ža", variant = "i"}, stem:make_form{grade = "weak", ending = "š", variant = "i"}}
data.forms = {stem:make_form{grade = "weak", ending = "žetne", variant = "i"}}
data.forms = {stem:make_form{grade = "weak", ending = "žeahppi", variant = "i"}}
data.forms = {stem:make_form{grade = "weak", ending = "žeaba", variant = "i"}}
data.forms = {stem:make_form{grade = "weak", ending = "žit", variant = "i"}, stem:make_form{grade = "weak", ending = "žat", variant = "i"}}
data.forms = {stem:make_form{grade = "weak", ending = "žēhpet", variant = "i"}}
data.forms = {stem:make_form{grade = "weak", ending = "žit", variant = "i"}}
data.forms = {stem:make_form{grade = "weak", ending = "š", variant = "i"}}
postprocess(args, data)
return output](data)
end
function export.odd(frame)
local params = {
= {required = true, default = "{{{1}}}"},
= {},
= {default = "table"},
}
local args = require("Module:parameters").process(frame:getParent().args, params)
local stem = require("Module:se-common").Stem(args)
local data = {
forms = {},
info = "odd, no gradation",
categories = {},
}
if stem.ucons == "" and mw.title.getCurrentTitle().nsText ~= "Template" then
error("The stem must end in a consonant.")
end
insert(data.categories, lang:getCanonicalName() .. " odd verbs")
data.forms = {stem:make_form{ending = "it"}}
data.forms = {stem:make_form{ending = "eaddji"}}
data.forms = {stem:make_form{ending = "an"}}
data.forms = {stem:make_form{ending = "an"}}
data.forms = {stem:make_form{ending = "eapmi"}}
data.forms = {stem:make_form{ending = "eamen"}, stem:make_form{ending = "eame"}}
data.forms = {stem:make_form{ending = "eamis"}}
data.forms = {stem:make_form{ending = "ēmiin"}}
data.forms = {stem:make_form{ending = "keahttá"}}
data.forms = {stem:make_form{ending = "an"}}
data.forms = {stem:make_form{ending = "at"}}
data.forms = {stem:make_form{ending = "a"}}
data.forms = {stem:make_form{ending = "etne"}}
data.forms = {stem:make_form{ending = "eahppi"}}
data.forms = {stem:make_form{ending = "eaba"}}
data.forms = {stem:make_form{ending = "it"}, stem:make_form{ending = "at"}}
data.forms = {stem:make_form{ending = "ēhpet"}}
data.forms = {stem:make_form{ending = "it"}}
data.forms = {stem:make_form{}}
data.forms = {stem:make_form{ending = "in"}, stem:make_form{ending = "edjen"}}
data.forms = {stem:make_form{ending = "it"}, stem:make_form{ending = "edjet"}}
data.forms = {stem:make_form{ending = "ii"}}
data.forms = {stem:make_form{ending = "eimme"}}
data.forms = {stem:make_form{ending = "eidde"}}
data.forms = {stem:make_form{ending = "eigga"}}
data.forms = {stem:make_form{ending = "eimmet"}}
data.forms = {stem:make_form{ending = "eiddet"}}
data.forms = {stem:make_form{ending = "e"}, stem:make_form{ending = "edje"}}
data.forms = {stem:make_form{ending = "an"}}
data.forms = {stem:make_form{ending = "ēhkon"}}
data.forms = {stem:make_form{}}
data.forms = {stem:make_form{ending = "ēhkos"}, stem:make_form{ending = "us"}}
data.forms = {stem:make_form{ending = "eadnu"}}
data.forms = {stem:make_form{ending = "eahkki"}}
data.forms = {stem:make_form{ending = "ēhkoska"}}
data.forms = {stem:make_form{ending = "ēhkot"}, stem:make_form{ending = "eatnot"}}
data.forms = {stem:make_form{ending = "ēhket"}}
data.forms = {stem:make_form{ending = "ēhkoset"}}
data.forms = {stem:make_form{}}
data.forms = {stem:make_form{ending = "ivččen"}}
data.forms = {stem:make_form{ending = "ivččet"}}
data.forms = {stem:make_form{ending = "ivččii"}}
data.forms = {stem:make_form{ending = "ivččiime"}}
data.forms = {stem:make_form{ending = "ivččiide"}}
data.forms = {stem:make_form{ending = "ivččiiga"}}
data.forms = {stem:make_form{ending = "ivččiimet"}}
data.forms = {stem:make_form{ending = "ivččiidet"}}
data.forms = {stem:make_form{ending = "ivčče"}}
data.forms = {stem:make_form{ending = "ivčče"}}
data.forms = {stem:make_form{ending = "eaččan"}}
data.forms = {stem:make_form{ending = "eaččat"}}
data.forms = {stem:make_form{ending = "eš"}, stem:make_form{ending = "eaš"}, stem:make_form{ending = "eažžá"}}
data.forms = {stem:make_form{ending = "ežže"}}
data.forms = {stem:make_form{ending = "eažžabeahtti"}}
data.forms = {stem:make_form{ending = "eažžaba"}}
data.forms = {stem:make_form{ending = "eažžat"}}
data.forms = {stem:make_form{ending = "eažžabehtet"}}
data.forms = {stem:make_form{ending = "ežžet"}}
data.forms = {stem:make_form{ending = "eš"}, stem:make_form{ending = "eaš"}, stem:make_form{ending = "eačča"}}
postprocess(args, data)
return output](data)
end
function export.contr(frame)
local params = {
= {required = true, default = "{{{1}}}"},
= {default = "table"},
}
local args = require("Module:parameters").process(frame:getParent().args, params)
local stem = require("Module:se-common").Stem(args)
local data = {
forms = {},
info = "contracted " .. require("Module:links").full_link({lang = lang, alt = stem.uvowel}, "term") .. "-stem, no gradation",
categories = {},
}
if not mw.ustring.find(stem.uvowel, "^$") and mw.title.getCurrentTitle().nsText ~= "Template" then
error("The final vowel(s) of the stem must be one of á, e, o.")
end
insert(data.categories, lang:getCanonicalName() .. " contracted verbs")
insert(data.categories, lang:getCanonicalName() .. " contracted " .. (stem.uvowel or "") .. "-stem verbs")
data.forms = {stem:make_form{ending = "t"}}
data.forms = {stem:make_form{ending = "jeaddji"}}
data.forms = {stem:make_form{ending = "n"}}
data.forms = {stem:make_form{ending = "n"}}
data.forms = {stem:make_form{ending = "n"}}
data.forms = {stem:make_form{ending = "min"}, stem:make_form{ending = "me"}}
data.forms = {stem:make_form{ending = "mis"}}
data.forms = {stem:make_form{ending = "miin"}}
data.forms = {stem:make_form{ending = "keahttá"}}
data.forms = {stem:make_form{ending = "n"}}
data.forms = {stem:make_form{ending = "t"}}
data.forms = {stem:make_form{}}
data.forms = {stem:make_form{ending = "jetne"}}
data.forms = {stem:make_form{ending = "beahtti"}}
data.forms = {stem:make_form{ending = "ba"}}
data.forms = {stem:make_form{ending = "t"}}
data.forms = {stem:make_form{ending = "bēhtet"}}
data.forms = {stem:make_form{ending = "jit"}}
data.forms = {stem:make_form{}}
data.forms = {stem:make_form{ending = "jin"}}
data.forms = {stem:make_form{ending = "jit"}}
data.forms = {stem:make_form{ending = "i", variant = "j"}}
data.forms = {stem:make_form{ending = "ime", variant = "j"}}
data.forms = {stem:make_form{ending = "ide", variant = "j"}}
data.forms = {stem:make_form{ending = "iga", variant = "j"}}
data.forms = {stem:make_form{ending = "imet", variant = "j"}}
data.forms = {stem:make_form{ending = "idet", variant = "j"}}
data.forms = {stem:make_form{ending = "jedje"}}
data.forms = {stem:make_form{ending = "n"}}
data.forms = {stem:make_form{ending = "jēhkon"}}
data.forms = {stem:make_form{}}
data.forms = {stem:make_form{ending = "jēhkos"}}
data.forms = {stem:make_form{ending = "jeadnu"}, stem:make_form{ending = "jeahkku"}}
data.forms = {stem:make_form{ending = "jeahkki"}}
data.forms = {stem:make_form{ending = "jēhkoska"}}
data.forms = {stem:make_form{ending = "jētnot"}, stem:make_form{ending = "jēhkot"}, stem:make_form{ending = "jeahkkot"}, stem:make_form{ending = "jeadnot"}}
data.forms = {stem:make_form{ending = "jēhket"}}
data.forms = {stem:make_form{ending = "jēhkoset"}}
data.forms = {stem:make_form{}}
data.forms = {stem:make_form{ending = "šin"}, stem:make_form{ending = "šedjen"}}
data.forms = {stem:make_form{ending = "šit"}, stem:make_form{ending = "šedjet"}}
data.forms = {stem:make_form{ending = "šii"}}
data.forms = {stem:make_form{ending = "šeimme"}}
data.forms = {stem:make_form{ending = "šeidde"}}
data.forms = {stem:make_form{ending = "šeigga"}}
data.forms = {stem:make_form{ending = "šeimmet"}}
data.forms = {stem:make_form{ending = "šeiddet"}}
data.forms = {stem:make_form{ending = "še"}, stem:make_form{ending = "šedje"}}
data.forms = {stem:make_form{ending = "še"}}
data.forms = {stem:make_form{ending = "lin"}, stem:make_form{ending = "ledjen"}}
data.forms = {stem:make_form{ending = "lit"}, stem:make_form{ending = "ledjet"}}
data.forms = {stem:make_form{ending = "lii"}}
data.forms = {stem:make_form{ending = "leimme"}}
data.forms = {stem:make_form{ending = "leidde"}}
data.forms = {stem:make_form{ending = "leigga"}}
data.forms = {stem:make_form{ending = "leimmet"}}
data.forms = {stem:make_form{ending = "leiddet"}}
data.forms = {stem:make_form{ending = "le"}, stem:make_form{ending = "ledje"}}
data.forms = {stem:make_form{ending = "le"}}
data.forms = {stem:make_form{ending = "žan"}}
data.forms = {stem:make_form{ending = "žat"}}
data.forms = {stem:make_form{ending = "ža"}, stem:make_form{ending = "š"}}
data.forms = {stem:make_form{ending = "žetne"}}
data.forms = {stem:make_form{ending = "žeahppi"}}
data.forms = {stem:make_form{ending = "žeaba"}}
data.forms = {stem:make_form{ending = "žit"}, stem:make_form{ending = "žat"}}
data.forms = {stem:make_form{ending = "žēhpet"}}
data.forms = {stem:make_form{ending = "žit"}}
data.forms = {stem:make_form{ending = "š"}}
postprocess(args, data)
return output](data)
end
function export.leat(frame)
local params = {
= {default = "table"},
}
local args = require("Module:parameters").process(frame:getParent().args, params)
local data = {
forms = {},
info = "odd, no gradation, irregular",
categories = {lang:getCanonicalName() .. " odd verbs", lang:getCanonicalName() .. " irregular verbs"},
}
data.forms = {"leat", "leahkit"}
data.forms = {"leahkki"}
data.forms = {"leamaš"}
data.forms = nil
data.forms = {"leapmi"}
data.forms = {"leamen", "leame", "leahkime"}
data.forms = {"leames"}
data.forms = nil
data.forms = nil
data.forms = {"lean"}
data.forms = {"leat"}
data.forms = {"lea"}
data.forms = {"letne"}
data.forms = {"leahppi"}
data.forms = {"leaba"}
data.forms = {"leat"}
data.forms = {"lēhpet"}
data.forms = {"leat"}
data.forms = {"leat"}
data.forms = {"ledjen"}
data.forms = {"ledjet"}
data.forms = {"lei", "leai"}
data.forms = {"leimme"}
data.forms = {"leidde"}
data.forms = {"leigga", "leaigga"}
data.forms = {"leimmet"}
data.forms = {"leiddet"}
data.forms = {"ledje"}
data.forms = {"lean"}
data.forms = {"lēhkon"}
data.forms = {"leagẹ"}
data.forms = {"lēhkos"}
data.forms = {"leadnu", "leahkku"}
data.forms = {"leahkki"}
data.forms = {"lēhkoska"}
data.forms = {"lēhkot", "leatnot"}
data.forms = {"lēhket"}
data.forms = {"lēhkoset"}
data.forms = {"leagẹ"}
data.forms = {"livččen"}
data.forms = {"livččet"}
data.forms = {"livččii"}
data.forms = {"livččiime"}
data.forms = {"livččiide"}
data.forms = {"livččiiga"}
data.forms = {"livččiimet"}
data.forms = {"livččiidet"}
data.forms = {"livčče"}
data.forms = {"livčče"}
data.forms = {"leaččan"}
data.forms = {"leaččat"}
data.forms = {"leš", "leaš", "leažžá"}
data.forms = {"ležže"}
data.forms = {"leažžabeahtti"}
data.forms = {"leažžaba"}
data.forms = {"leažžat"}
data.forms = {"leažžabehtet"}
data.forms = {"ležžet"}
data.forms = {"leš", "leaš", "leačča"}
postprocess(args, data)
return output](data)
end
-- Make the table
output.table = function(data)
local function repl(param)
local accel = true
local no_store = false
if param == "info" then
return mw.getContentLanguage():ucfirst(data.info 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
if not forms then
return "—"
end
local ret = {}
for _, subform in ipairs(forms) do
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 concat(ret, "<br/>")
end
local wikicode = [=[
{| class="inflection-table vsSwitcher" data-toggle-category="inflection" style="border: solid 1px #CCCCFF;" cellspacing="1" cellpadding="2"
|- style="background: #E2F6E2; text-align: left;"
! class="vsToggleElement" colspan="4" | {{{info}}}
|- class="vsShow" style="background: #F2F2FF;"
! style="width: 11em; background: #E2F6E2;" | infinitive
| style="width: 15em;" colspan="2" | {{{!inf}}}
|- class="vsShow" style="background: #F2F2FF;"
! style="background: #E2F6E2;" | 1st sing. present
| colspan="2" | {{{!1|s|pres|indc}}}
|- class="vsShow" style="background: #F2F2FF;"
! style="background: #E2F6E2;" | 1st sing. past
| colspan="2" | {{{!1|s|past|indc}}}
|- class="vsHide" style="background: #F2F2FF;"
! style="background: #E2F6E2;" | infinitive
| data-accel-col="1" | {{{inf}}}
! style="background: #E2F6E2;" | action noun
| data-accel-col="2" | {{{#anoun}}}
|- class="vsHide" style="background: #F2F2FF;"
! style="background: #E2F6E2;" | present participle
| data-accel-col="1" | {{{pres|ptcp}}}
! style="background: #E2F6E2;" | action inessive
| data-accel-col="2" | {{{action|ine}}}
|- class="vsHide" style="background: #F2F2FF;"
! style="background: #E2F6E2;" | past participle
| data-accel-col="1" | {{{past|ptcp}}}
! style="background: #E2F6E2;" | action elative
| data-accel-col="2" | {{{action|ela}}}
|- class="vsHide" style="background: #F2F2FF;"
! style="background: #E2F6E2;" | agent participle
| data-accel-col="1" | {{{agnt|ptcp}}}
! style="background: #E2F6E2;" | action comitative
| data-accel-col="2" | {{{action|com}}}
|- class="vsHide" style="background: #F2F2FF;"
! style="background: #E2F6E2;" colspan="2" |
! style="background: #E2F6E2;" | abessive
| {{{abe}}}
|- class="vsHide"
! style="background: #C0E4C0; width: 11em;" |
! style="background: #C0E4C0; width: 15em;" | present indicative
! style="background: #C0E4C0; width: 15em;" | past indicative
! style="background: #C0E4C0; width: 15em;" | imperative
|- class="vsHide" style="background: #F2F2FF;"
! style="background: #E2F6E2;" | 1st singular
| data-accel-col="1" | {{{1|s|pres|indc}}}
| data-accel-col="2" | {{{1|s|past|indc}}}
| data-accel-col="3" | {{{1|s|impr}}}
|- class="vsHide" style="background: #F2F2FF;"
! style="background: #E2F6E2;" | 2nd singular
| data-accel-col="1" | {{{2|s|pres|indc}}}
| data-accel-col="2" | {{{2|s|past|indc}}}
| data-accel-col="3" | {{{2|s|impr}}}
|- class="vsHide" style="background: #F2F2FF;"
! style="background: #E2F6E2;" | 3rd singular
| data-accel-col="1" | {{{3|s|pres|indc}}}
| data-accel-col="2" | {{{3|s|past|indc}}}
| data-accel-col="3" | {{{3|s|impr}}}
|- class="vsHide" style="background: #F2F2FF;"
! style="background: #E2F6E2;" | 1st dual
| data-accel-col="1" | {{{1|d|pres|indc}}}
| data-accel-col="2" | {{{1|d|past|indc}}}
| data-accel-col="3" | {{{1|d|impr}}}
|- class="vsHide" style="background: #F2F2FF;"
! style="background: #E2F6E2;" | 2nd dual
| data-accel-col="1" | {{{2|d|pres|indc}}}
| data-accel-col="2" | {{{2|d|past|indc}}}
| data-accel-col="3" | {{{2|d|impr}}}
|- class="vsHide" style="background: #F2F2FF;"
! style="background: #E2F6E2;" | 3rd dual
| data-accel-col="1" | {{{3|d|pres|indc}}}
| data-accel-col="2" | {{{3|d|past|indc}}}
| data-accel-col="3" | {{{3|d|impr}}}
|- class="vsHide" style="background: #F2F2FF;"
! style="background: #E2F6E2;" | 1st plural
| data-accel-col="1" | {{{1|p|pres|indc}}}
| data-accel-col="2" | {{{1|p|past|indc}}}
| data-accel-col="3" | {{{1|p|impr}}}
|- class="vsHide" style="background: #F2F2FF;"
! style="background: #E2F6E2;" | 2nd plural
| data-accel-col="1" | {{{2|p|pres|indc}}}
| data-accel-col="2" | {{{2|p|past|indc}}}
| data-accel-col="3" | {{{2|p|impr}}}
|- class="vsHide" style="background: #F2F2FF;"
! style="background: #E2F6E2;" | 3rd plural
| data-accel-col="1" | {{{3|p|pres|indc}}}
| data-accel-col="2" | {{{3|p|past|indc}}}
| data-accel-col="3" | {{{3|p|impr}}}
|- class="vsHide" style="background: #F2F2FF;"
! style="background: #E2F6E2;" | connegative
| data-accel-col="1" | {{{pres|indc|conn}}}
| data-accel-col="2" | {{{past|indc|conn}}}
| data-accel-col="3" | {{{impr|conn}}}
|- class="vsHide"
! style="background: #C0E4C0;" |
! style="background: #C0E4C0;" | conditional 1
! style="background: #C0E4C0;" | conditional 2
! style="background: #C0E4C0;" | potential
|- class="vsHide" style="background: #F2F2FF;"
! style="background: #E2F6E2;" | 1st singular
| data-accel-col="4" | {{{1|s|cond1}}}
| data-accel-col="5" | {{{1|s|cond2}}}
| data-accel-col="6" | {{{1|s|potn}}}
|- class="vsHide" style="background: #F2F2FF;"
! style="background: #E2F6E2;" | 2nd singular
| data-accel-col="4" | {{{2|s|cond1}}}
| data-accel-col="5" | {{{2|s|cond2}}}
| data-accel-col="6" | {{{2|s|potn}}}
|- class="vsHide" style="background: #F2F2FF;"
! style="background: #E2F6E2;" | 3rd singular
| data-accel-col="4" | {{{3|s|cond1}}}
| data-accel-col="5" | {{{3|s|cond2}}}
| data-accel-col="6" | {{{3|s|potn}}}
|- class="vsHide" style="background: #F2F2FF;"
! style="background: #E2F6E2;" | 1st dual
| data-accel-col="4" | {{{1|d|cond1}}}
| data-accel-col="5" | {{{1|d|cond2}}}
| data-accel-col="6" | {{{1|d|potn}}}
|- class="vsHide" style="background: #F2F2FF;"
! style="background: #E2F6E2;" | 2nd dual
| data-accel-col="4" | {{{2|d|cond1}}}
| data-accel-col="5" | {{{2|d|cond2}}}
| data-accel-col="6" | {{{2|d|potn}}}
|- class="vsHide" style="background: #F2F2FF;"
! style="background: #E2F6E2;" | 3rd dual
| data-accel-col="4" | {{{3|d|cond1}}}
| data-accel-col="5" | {{{3|d|cond2}}}
| data-accel-col="6" | {{{3|d|potn}}}
|- class="vsHide" style="background: #F2F2FF;"
! style="background: #E2F6E2;" | 1st plural
| data-accel-col="4" | {{{1|p|cond1}}}
| data-accel-col="5" | {{{1|p|cond2}}}
| data-accel-col="6" | {{{1|p|potn}}}
|- class="vsHide" style="background: #F2F2FF;"
! style="background: #E2F6E2;" | 2nd plural
| data-accel-col="4" | {{{2|p|cond1}}}
| data-accel-col="5" | {{{2|p|cond2}}}
| data-accel-col="6" | {{{2|p|potn}}}
|- class="vsHide" style="background: #F2F2FF;"
! style="background: #E2F6E2;" | 3rd plural
| data-accel-col="4" | {{{3|p|cond1}}}
| data-accel-col="5" | {{{3|p|cond2}}}
| data-accel-col="6" | {{{3|p|potn}}}
|- class="vsHide" style="background: #F2F2FF;"
! style="background: #E2F6E2;" | connegative
| data-accel-col="4" | {{{cond1|conn}}}
| data-accel-col="5" | {{{cond2|conn}}}
| data-accel-col="6" | {{{potn|conn}}}
|}]=]
return mw.ustring.gsub(wikicode, "{{{(?+)}}}", repl) .. require("Module:utilities").format_categories(data.categories, lang)
end
-- Given a tag set, return a flattened list all Wikidata ID's of all tags in the tag set.
local function to_Wikidata_IDs(tag_set, lang, skip_tags_without_ids)
local ret, WIKIDATA = {}, require("Module:form of/data").WIKIDATA
local function get_wikidata_id(tag)
local data = export.lookup_tag(tag, lang)
if data and data then
return ("Q%s"):format(data)
elseif not skip_tags_without_ids then
error('The tag "' .. tag .. '" does not have a Wikidata ID defined in the form-of data modules')
end
end
local normalized_tag_sets = export.normalize_tag_set(tag_set, lang)
for _, tag_set in ipairs(normalized_tag_sets) do
for _, tag in ipairs(tag_set) do
if type(tag) == "table" then
for _, subtag in ipairs(tag) do
if type(subtag) == "table" then
-- two-level multipart tag; FIXME: delete support for this
for _, subsubtag in ipairs(subtag) do
insert(ret, get_wikidata_id(subsubtag))
end
else
insert(ret, get_wikidata_id(subtag))
end
end
else
insert(ret, get_wikidata_id(tag))
end
end
end
return ret
end
output.Wikidata = function(data)
local order = {
"inf",
"pres|ptcp",
"past|ptcp",
"agnt|ptcp",
--"action|ine",
--"action|ela",
--"action|com",
"abe",
"1|s|pres|indc",
"2|s|pres|indc",
"3|s|pres|indc",
"1|d|pres|indc",
"2|d|pres|indc",
"3|d|pres|indc",
"1|p|pres|indc",
"2|p|pres|indc",
"3|p|pres|indc",
"pres|indc|conn",
"1|s|past|indc",
"2|s|past|indc",
"3|s|past|indc",
"1|d|past|indc",
"2|d|past|indc",
"3|d|past|indc",
"1|p|past|indc",
"2|p|past|indc",
"3|p|past|indc",
"past|indc|conn",
"1|s|impr",
"2|s|impr",
"3|s|impr",
"1|d|impr",
"2|d|impr",
"3|d|impr",
"1|p|impr",
"2|p|impr",
"3|p|impr",
"impr|conn",
"1|s|cond1",
"2|s|cond1",
"3|s|cond1",
"1|d|cond1",
"2|d|cond1",
"3|d|cond1",
"1|p|cond1",
"2|p|cond1",
"3|p|cond1",
"cond1|conn",
"1|s|cond2",
"2|s|cond2",
"3|s|cond2",
"1|d|cond2",
"2|d|cond2",
"3|d|cond2",
"1|p|cond2",
"2|p|cond2",
"3|p|cond2",
"cond2|conn",
"1|s|potn",
"2|s|potn",
"3|s|potn",
"1|d|potn",
"2|d|potn",
"3|d|potn",
"1|p|potn",
"2|p|potn",
"3|p|potn",
"potn|conn",
}
local ret = {}
for _, key in ipairs(order) do
if data.forms and data.forms then
for _, form in ipairs(data.forms) do
key = key:gsub("cond", "cond")
insert(ret, {
representations = { = {language = lang:getCode(), value = form}},
grammaticalFeatures = to_Wikidata_IDs(key, lang),
})
end
end
end
return require("Module:JSON").toJSON(ret)
end
return export