Jump to content

Module:hrx-verb

From Wiktionary, the free dictionary

This module needs documentation.
Please document this module by describing its purpose and usage on the documentation page.

local m_utilities = require("Module:utilities")
local m_links = require("Module:links")

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

local export = {}

local function detect_stem(stem)
	if mw.ustring.find(stem, "v$") or mw.ustring.find(stem, "w$") then
		return '1Ab'
	elseif mw.ustring.find(stem, "d$") or mw.ustring.find(stem, "t$") then
		return '1At'
	elseif mw.ustring.find(stem, "eer$") or mw.ustring.find(stem, "ier$") then
		return '1C'
	elseif mw.ustring.find(stem, "l$") or mw.ustring.find(stem, 'r$') or mw.ustring.find(stem, 'n$') then
		return '1B'
	else
		return '1A'
	end
end

local function mutate_stem(stem)
	if mw.ustring.find(stem, "d$") then
		return (mw.ustring.gsub(stem, "d$", ""))
	elseif mw.ustring.find(stem, "v$") then
		return (mw.ustring.gsub(stem, "v$", "b"))
	elseif mw.ustring.find(stem, "w$") then
		return (mw.ustring.gsub(stem, "w$", "bb"))
	elseif mw.ustring.find(stem, "l$") or mw.ustring.find(stem, "r$") or mw.ustring.find(stem, "n$") then
			if mw.ustring.find(stem, "[bcdfghjkmnpqrstvwz]l$") then
				return (mw.ustring.gsub(stem, "l$", "el"))
			elseif mw.ustring.find(stem, "[bcdfghjklmnpqstvwz]r$") then
				return (mw.ustring.gsub(stem, "r$", "er"))
			elseif mw.ustring.find(stem, "[bcdfghjklmpqrstvwz]n$") then
				return (mw.ustring.gsub(stem, "n$", "en"))
			end
		return stem
	else
		return stem
	end
end

local function past_participle(stem)
	if detect_stem(stem) == '1C' then
		return stem .. 'd'
	elseif detect_stem(stem) == '1B' or detect_stem(stem) == '1Ab' then
		return 'ge' .. mutate_stem(stem) .. 'd' 
	elseif detect_stem(stem) == '1At' then
		return 'ge' .. stem
	else
		return 'ge' .. stem .. 'd'
	end
end

local function postprocess(args, data)
	if args["prefix"] then
		table.insert(data.categories, lang:getCanonicalName() .. " separable verbs")
		data.info = data.info .. ", separable"
		
		-- Add the separable part to all the verb forms
		for key, _ in pairs(data.forms) do
			if key:find("_indc$") or key:find("_cond$") or key:find("_impr$") or key:find("_sub$") then
				-- For main-clause finite forms, add the separable part after the form, separated by a space
				for i, subform in ipairs(data.forms[key]) do
					data.forms[key][i] = data.forms[key][i] .. " " .. args["prefix"] .. (args["pref-n"] and "n" or "")
				end
			elseif key == "inf" then
				for i, subform in ipairs(data.forms[key]) do
					data.forms[key][i] = args["prefix"] .. (args["pref-inf-n"] and "n" or "") .. data.forms[key][i]
				end
			elseif key ~= "aux" then
				-- For all other forms, add the separable part before the form, with no space
				for i, subform in ipairs(data.forms[key]) do
					data.forms[key][i] = args["prefix"] .. subform
				end
			end
		end
	end
	
	-- Check if the lemma form matches the page name
	if data.forms["inf"] and (lang:makeEntryName(data.forms["inf"][1])) ~= mw.title.getCurrentTitle().text then
		table.insert(data.categories, lang:getCanonicalName() .. " entries with inflection not matching pagename")
	end
	
	if args["only3s"] or args["only3sp"] then
		for key, _ in pairs(data.forms) do
			 if key:find("^1") or key:find("^2") or (args["only3s"] and key:find("^3pl")) then
			 	data.forms[key] = nil
			 end
		end
	end
end

local function inf(args)
		if args["inf-n"] == true then
			return 'n'
		else
			return 'e'
		end
end

local function at_conj(args, stem)
	if mw.ustring.find(stem, "t$") then
		return mutate_stem(args["alt"] or stem)
	else
		return mutate_stem(args["alt"] or stem) .. "d"
	end
end

local function at_imp(args, stem)
	if mw.ustring.find(stem, "d$") then
		return stem
	else
		return mutate_stem(args["alt"] or stem)
	end
end

-- Inflection functions

function export.regular(frame)
	local params = {
		[1] = {required = true, default = "{{{1}}}"},
		[2] = {required = true, default = "{{{2}}}"},
		["alt"] = {},
		["ptcp"] = {},
		
		["prefix"] = {},
		["inf-n"] = {type = "boolean"},
		["only3s"] = {type = "boolean"},
		["only3sp"] = {type = "boolean"},
		}
	
	local args = require("Module:parameters").process(frame:getParent().args, params)

	local stem = args[1]
	local stem_final = mutate_stem(args["alt"] or stem)
	
	local data = {forms = {}, info = "regular", categories = {}}

	data.forms["inf"] = {stem .. inf(args)}
	data.forms["ptcp"] = {args["ptcp"] or past_participle(stem)}
	data.forms["aux"] = {args[2]}
	
	data.forms["1sg_pres_indc"] = {stem .. inf(args)}
	data.forms["2sg_pres_indc"] = {stem_final .. "st"}
	data.forms["3sg_pres_indc"] = {at_conj(args, stem)}
	data.forms["1pl_pres_indc"] = {stem .. inf(args)}
	data.forms["2pl_pres_indc"] = {at_conj(args, stem)}
	data.forms["3pl_pres_indc"] = {stem .. inf(args)}
	
	data.forms["2sg_impr"] = {at_imp(args, stem)}
	data.forms["2pl_impr"] = {at_conj(args, stem)}
	
	postprocess(args, data)
	
	return make_table(data) .. m_utilities.format_categories(data.categories, lang)
end

function export.irregular(frame)
	local params = {
		[1] = {required = true, default = "{{{1}}}"},
		[2] = {required = true, default = "{{{2}}}"},
		["alt"] = {required = true},
		["ptcp"] = {required = true},
		
		["prefix"] = {},
		["inf-n"] = {type = "boolean"},
		["only3s"] = {type = "boolean"},
		["only3sp"] = {type = "boolean"},
		}
	
	local args = require("Module:parameters").process(frame:getParent().args, params)
	
	local stem = args[1]
	local stem_final = mutate_stem(args["alt"] or stem)
	
	local data = {forms = {}, info = "irregular", categories = {lang:getCanonicalName() .. " irregular verbs"}}
	
	data.forms["inf"] = {stem .. inf(args)}
	data.forms["ptcp"] = {args['ptcp'] or past_participle(stem)}
	data.forms["aux"] = {args[2]}
	
	data.forms["1sg_pres_indc"] = {stem .. inf(args)}
	data.forms["2sg_pres_indc"] = {stem_final .. 'st'}
	data.forms["3sg_pres_indc"] = {stem_final .. 'd'}
	data.forms["1pl_pres_indc"] = {stem .. inf(args)}
	data.forms["2pl_pres_indc"] = {stem_final .. 'd'}
	data.forms["3pl_pres_indc"] = {stem .. inf(args)}
	
	data.forms["2sg_impr"] = {stem_final .. 'd'}
	data.forms["2pl_impr"] = {stem_final .. 'd'}
	
	postprocess(args, data)
	
	return make_table(data) .. m_utilities.format_categories(data.categories, lang)
end


function export.irregular_full(frame)
	local params = {
		[1] = {required = true, default = "{{{1}}}"},
		[2] = {required = true, default = "{{{2}}}"},
		[3] = {default = "{{{3}}}"},
		[4] = {default = "{{{4}}}"},
		["past"] = {},
		["cond"] = {},
		["ptcp"] = {required, true},
		
		["prefix"] = {},
		["inf-n"] = {type = "boolean"},
		["only3s"] = {type = "boolean"},
		["only3sp"] = {type = "boolean"},
		}
	
	local args = require("Module:parameters").process(frame:getParent().args, params)
	
	local stem = args[1]
	local stem_final = mutate_stem(stem)
	
	local stem_past = args["past"] or args[3]
	local stem_past_dev = mutate_stem(stem_past)
	
	local stem_cond = args["cond"] or args[4]
	local stem_cond_dev = mutate_stem(stem_cond)
	
	local data = {forms = {}, info = "irregular with past tense and conditional mood", categories = {lang:getCanonicalName() .. " verbs with past tense", lang:getCanonicalName() .. " verbs with conditional mood", lang:getCanonicalName() .. " irregular verbs"}}
	data.past = true
	
	data.forms["inf"] = {stem .. inf(args)}
	data.forms["ptcp"] = {args["ptcp"] or past_participle(stem)}
	data.forms["aux"] = {args[2]}
	
	data.forms["1sg_pres_indc"] = {stem .. inf(args)}
	data.forms["2sg_pres_indc"] = {stem_final .. 'st'}
	data.forms["3sg_pres_indc"] = {stem_final .. 'd'}
	data.forms["1pl_pres_indc"] = {stem .. inf(args)}
	data.forms["2pl_pres_indc"] = {stem_final .. 'd'}
	data.forms["3pl_pres_indc"] = {stem .. inf(args)}
	
	data.forms["2sg_impr"] = {stem_final}
	data.forms["2pl_impr"] = {stem_final .. 'd'}
	
	data.forms["1sg_past_indc"] = {stem_past_dev .. 'd'}
	data.forms["2sg_past_indc"] = {stem_past_dev .. 'st'}
	data.forms["3sg_past_indc"] = {stem_past_dev .. 'd'}
	data.forms["1pl_past_indc"] = {stem_past .. 'de'}
	data.forms["2pl_past_indc"] = {stem_past_dev .. 'd'}
	data.forms["3pl_past_indc"] = {stem_past .. 'de'}
	
	data.forms["1sg_cond"] = {stem_cond_dev .. 'd'}
	data.forms["2sg_cond"] = {stem_cond_dev .. 'st'}
	data.forms["3sg_cond"] = {stem_cond_dev .. 'd'}
	data.forms["1pl_cond"] = {stem_cond .. 'de'}
	data.forms["2pl_cond"] = {stem_cond_dev .. 'd'}
	data.forms["3pl_cond"] = {stem_cond .. 'de'}
	
	postprocess(args, data)
	
	return make_table(data) .. m_utilities.format_categories(data.categories, lang)
end

function export.irregular_sin(frame)
	local params = {
		["prefix"] = {},
		}
		
	local args = require("Module:parameters").process(frame:getParent().args, params)

	local data = {forms = {}, info = "irregular with past tense, conditional and subjunctive mood", categories = {lang:getCanonicalName() .. " verbs with past tense", lang:getCanonicalName() .. " verbs with conditional mood", lang:getCanonicalName() .. " verbs with subjunctive mood", lang:getCanonicalName() .. " irregular verbs", lang:getCanonicalName() .. " auxiliary verbs"}}
	data.past_sin = true
	
	data.forms["inf"] = {'sin'}
	data.forms["ptcp"] = {'gewees', 'geweest', 'geween'}
	data.forms["aux"] = {'sin'}
	
	data.forms["1sg_pres_indc"] = {'sin'}
	data.forms["2sg_pres_indc"] = {'bist'}
	data.forms["3sg_pres_indc"] = {'is'}
	data.forms["1pl_pres_indc"] = {'sin'}
	data.forms["2pl_pres_indc"] = {'seid'}
	data.forms["3pl_pres_indc"] = {'sin'}

	data.forms["2sg_impr"] = {"sei"}
	data.forms["2pl_impr"] = {"seid"}
	
	data.forms["1sg_past_indc"] = {'waar'}
	data.forms["2sg_past_indc"] = {'waarst'}
	data.forms["3sg_past_indc"] = {'waar'}
	data.forms["1pl_past_indc"] = {'waare'}
	data.forms["2pl_past_indc"] = {'waard'}
	data.forms["3pl_past_indc"] = {'waare'}
	
	data.forms["1sg_cond"] = {'wäär'}
	data.forms["2sg_cond"] = {'wäärst'}
	data.forms["3sg_cond"] = {'wäär'}
	data.forms["1pl_cond"] = {'wääre'}
	data.forms["2pl_cond"] = {'wäärd'}
	data.forms["3pl_cond"] = {'wääre'}

	data.forms["1sg_sub"] = {'sei'}
	data.forms["2sg_sub"] = {'seist'}
	data.forms["3sg_sub"] = {'sei'}
	data.forms["1pl_sub"] = {'seie'}
	data.forms["2pl_sub"] = {'seid'}
	data.forms["3pl_sub"] = {'seie'}
	
	postprocess(args, data)
	
	return make_table(data) .. m_utilities.format_categories(data.categories, lang)
end

function export.irregular_hon(frame)
	local params = {
		["prefix"] = {},
	}
	
	local args = require("Module:parameters").process(frame:getParent().args, params)

	local data = {forms = {}, info = "irregular with past tense and conditional mood", categories = {lang:getCanonicalName() .. " verbs with past tense", lang:getCanonicalName() .. " verbs with conditional mood", lang:getCanonicalName() .. " irregular verbs", lang:getCanonicalName() .. " auxiliary verbs"}}
	data.past_hon = true
	
	data.forms["inf"] = {'hon'}
	data.forms["ptcp"] = {'gehad'}
	data.forms["aux"] = {'hon'}
	
	data.forms["1sg_pres_indc"] = {'hon'}
	data.forms["2sg_pres_indc"] = {'host'}
	data.forms["3sg_pres_indc"] = {'hod'}
	data.forms["1pl_pres_indc"] = {'hon'}
	data.forms["2pl_pres_indc"] = {'hod'}
	data.forms["3pl_pres_indc"] = {'hon'}
	
	data.forms["1sg_past_indc"] = {'had'}
	data.forms["2sg_past_indc"] = {'hast'}
	data.forms["3sg_past_indc"] = {'had'}
	data.forms["1pl_past_indc"] = {'hade'}
	data.forms["2pl_past_indc"] = {'had'}
	data.forms["3pl_past_indc"] = {'hade'}
	
	data.forms["1sg_cond"] = {'häd'}
	data.forms["2sg_cond"] = {'häst'}
	data.forms["3sg_cond"] = {'häd'}
	data.forms["1pl_cond"] = {'häde'}
	data.forms["2pl_cond"] = {'häd'}
	data.forms["3pl_cond"] = {'häd'}
	
	postprocess(args, data)
	
	return make_table(data) .. m_utilities.format_categories(data.categories, lang)
end

function export.irregular_solle(frame)
	local params = {
		["prefix"] = {},
	}
	
	local args = require("Module:parameters").process(frame:getParent().args, params)

	local data = {forms = {}, info = "irregular with past tense and conditional mood", categories = {lang:getCanonicalName() .. " verbs with past tense", lang:getCanonicalName() .. " verbs with conditional mood", lang:getCanonicalName() .. " irregular verbs", lang:getCanonicalName() .. " auxiliary verbs"}}
	data.past_solle = true
	
	data.forms["inf"] = {'solle'}
	data.forms["ptcp"] = {'gesolld'}
	data.forms["aux"] = {'solle'}
	
	data.forms["1sg_pres_indc"] = {'soll'}
	data.forms["2sg_pres_indc"] = {'sollst'}
	data.forms["3sg_pres_indc"] = {'soll'}
	data.forms["1pl_pres_indc"] = {'solle'}
	data.forms["2pl_pres_indc"] = {'solld'}
	data.forms["3pl_pres_indc"] = {'solle'}
	
	data.forms["1sg_past_indc"] = {'solld'}
	data.forms["2sg_past_indc"] = {'solldst'}
	data.forms["3sg_past_indc"] = {'solld'}
	data.forms["1pl_past_indc"] = {'sollde'}
	data.forms["2pl_past_indc"] = {'solld'}
	data.forms["3pl_past_indc"] = {'sollde'}
	
	data.forms["1sg_sub"] = {'selld'}
	data.forms["2sg_sub"] = {'selldst'}
	data.forms["3sg_sub"] = {'selld'}
	data.forms["1pl_sub"] = {'sellde'}
	data.forms["2pl_sub"] = {'selld'}
	data.forms["3pl_sub"] = {'selle'}
	
	postprocess(args, data)
	
	return make_table(data) .. m_utilities.format_categories(data.categories, lang)
end

function export.irregular_misse(frame)
	local params = {
		["prefix"] = {},
	}
	
	local args = require("Module:parameters").process(frame:getParent().args, params)

	local data = {forms = {}, info = "irregular with past tense and conditional mood", categories = {lang:getCanonicalName() .. " verbs with past tense", lang:getCanonicalName() .. " verbs with conditional mood", lang:getCanonicalName() .. " irregular verbs", lang:getCanonicalName() .. " auxiliary verbs"}}
	data.past_hon = true
	
	data.forms["inf"] = {'misse'}
	data.forms["ptcp"] = {'gemusst', 'misse'}
	data.forms["aux"] = {'misse'}
	
	data.forms["1sg_pres_indc"] = {'muss'}
	data.forms["2sg_pres_indc"] = {'musst'}
	data.forms["3sg_pres_indc"] = {'muss'}
	data.forms["1pl_pres_indc"] = {'misse'}
	data.forms["2pl_pres_indc"] = {'missd'}
	data.forms["3pl_pres_indc"] = {'misse'}
	
	data.forms["1sg_past_indc"] = {'musst'}
	data.forms["2sg_past_indc"] = {'musst'}
	data.forms["3sg_past_indc"] = {'musst'}
	data.forms["1pl_past_indc"] = {'musste'}
	data.forms["2pl_past_indc"] = {'musst'}
	data.forms["3pl_past_indc"] = {'musste'}
	
	data.forms["1sg_cond"] = {'misst'}
	data.forms["2sg_cond"] = {'misst'}
	data.forms["3sg_cond"] = {'misst'}
	data.forms["1pl_cond"] = {'misste'}
	data.forms["2pl_cond"] = {'misst'}
	data.forms["3pl_cond"] = {'misste'}
	
	postprocess(args, data)
	
	return make_table(data) .. m_utilities.format_categories(data.categories, lang)
end

function export.irregular_dun(frame)
	local params = {
		["prefix"] = {},
		}
		
	local args = require("Module:parameters").process(frame:getParent().args, params)

	local data = {forms = {}, info = "irregular with conditional mood", categories = {lang:getCanonicalName() .. " verbs with conditional mood", lang:getCanonicalName() .. " irregular verbs", lang:getCanonicalName() .. " auxiliary verbs"}}
	data.past_dun = true
	
	data.forms["inf"] = {'dun'}
	data.forms["ptcp"] = {'gedun'}
	data.forms["aux"] = {'hon'}
	
	data.forms["1sg_pres_indc"] = {'dun'}
	data.forms["2sg_pres_indc"] = {'dust'}
	data.forms["3sg_pres_indc"] = {'dud'}
	data.forms["1pl_pres_indc"] = {'dun'}
	data.forms["2pl_pres_indc"] = {'dud'}
	data.forms["3pl_pres_indc"] = {'dun'}

	data.forms["2sg_impr"] = {"du"}
	data.forms["2pl_impr"] = {"dud"}
	
	data.forms["1sg_cond"] = {'däd'}
	data.forms["2sg_cond"] = {'däst'}
	data.forms["3sg_cond"] = {'däd'}
	data.forms["1pl_cond"] = {'däde'}
	data.forms["2pl_cond"] = {'däd'}
	data.forms["3pl_cond"] = {'däde'}
	
	postprocess(args, data)
	
	return make_table(data) .. m_utilities.format_categories(data.categories, lang)
end

function export.irregular_wolle(frame)
	local params = {
		["prefix"] = {},
	}
	
	local args = require("Module:parameters").process(frame:getParent().args, params)

	local data = {forms = {}, info = "irregular with past tense and conditional mood", categories = {lang:getCanonicalName() .. " verbs with past tense", lang:getCanonicalName() .. " verbs with conditional mood", lang:getCanonicalName() .. " irregular verbs", lang:getCanonicalName() .. " auxiliary verbs"}}
	data.past_hon = true
	
	data.forms["inf"] = {'wolle'}
	data.forms["ptcp"] = {'gewolld'}
	data.forms["aux"] = {'wolle'}
	
	data.forms["1sg_pres_indc"] = {'will'}
	data.forms["2sg_pres_indc"] = {'willst'}
	data.forms["3sg_pres_indc"] = {'will'}
	data.forms["1pl_pres_indc"] = {'wolle'}
	data.forms["2pl_pres_indc"] = {'wolld'}
	data.forms["3pl_pres_indc"] = {'wolle'}
	
	data.forms["1sg_past_indc"] = {'wolld'}
	data.forms["2sg_past_indc"] = {'wollst'}
	data.forms["3sg_past_indc"] = {'wolld'}
	data.forms["1pl_past_indc"] = {'wollde'}
	data.forms["2pl_past_indc"] = {'wolld'}
	data.forms["3pl_past_indc"] = {'wollde'}
	
	data.forms["1sg_cond"] = {'wolld'}
	data.forms["2sg_cond"] = {'wollst'}
	data.forms["3sg_cond"] = {'wolld'}
	data.forms["1pl_cond"] = {'wollde'}
	data.forms["2pl_cond"] = {'wolld'}
	data.forms["3pl_cond"] = {'wollde'}
	
	postprocess(args, data)
	
	return make_table(data) .. m_utilities.format_categories(data.categories, lang)
end

function export.irregular_mechde(frame)
	local params = {
		["prefix"] = {},
	}
	
	local args = require("Module:parameters").process(frame:getParent().args, params)

	local data = {forms = {}, info = "irregular", categories = {lang:getCanonicalName() .. " irregular verbs", lang:getCanonicalName() .. " auxiliary verbs"}}
	data.past_mechde = true
	
	data.forms["1sg_cond"] = {'mechde'}
	data.forms["2sg_cond"] = {'mechst', 'mechdest'}
	data.forms["3sg_cond"] = {'mechd'}
	data.forms["1pl_cond"] = {'mechde'}
	data.forms["2pl_cond"] = {'mechd'}
	data.forms["3pl_cond"] = {'mechde'}
	
	postprocess(args, data)
	
	return make_table(data) .. m_utilities.format_categories(data.categories, lang)
end

function export.irregular_wisse(frame)
	local params = {
		["prefix"] = {},
	}
	
	local args = require("Module:parameters").process(frame:getParent().args, params)

	local data = {forms = {}, info = "irregular with past tense and conditional mood", categories = {lang:getCanonicalName() .. " verbs with past tense", lang:getCanonicalName() .. " verbs with conditional mood", lang:getCanonicalName() .. " irregular verbs"}}
	data.past_hon = true
	
	data.forms["inf"] = {'wisse'}
	data.forms["ptcp"] = {'gewusst'}
	data.forms["aux"] = {'wisse'}
	
	data.forms["1sg_pres_indc"] = {'wees'}
	data.forms["2sg_pres_indc"] = {'weest'}
	data.forms["3sg_pres_indc"] = {'wees'}
	data.forms["1pl_pres_indc"] = {'wisse'}
	data.forms["2pl_pres_indc"] = {'wissd'}
	data.forms["3pl_pres_indc"] = {'wisse'}
	
	data.forms["1sg_past_indc"] = {'wusst'}
	data.forms["2sg_past_indc"] = {'wusst'}
	data.forms["3sg_past_indc"] = {'wusst'}
	data.forms["1pl_past_indc"] = {'wusste'}
	data.forms["2pl_past_indc"] = {'wusst'}
	data.forms["3pl_past_indc"] = {'wusste'}
	
	data.forms["1sg_cond"] = {'wisst'}
	data.forms["2sg_cond"] = {'wisst'}
	data.forms["3sg_cond"] = {'wisst'}
	data.forms["1pl_cond"] = {'wisste'}
	data.forms["2pl_cond"] = {'wisst'}
	data.forms["3pl_cond"] = {'wisste'}
	
	postprocess(args, data)
	
	return make_table(data) .. m_utilities.format_categories(data.categories, lang)
end

local names = {
	["inf"] = "infinitive",
	["ptcp"] = "participle",
	["aux"] = "auxiliary",
	
	["pres_indc"] = "present<br/>indicative",
	["past_indc"] = "past<br/>indicative",
	["cond"] = "conditional",
	["impr"] = "imperative",
	["sub"] = "subjunctive",
	
	["1sg"] = "ich",
	["2sg"] = "du",
	["3sg"] = "er/sie/es",
	["1pl"] = "meer",
	["2pl"] = "deer",
	["3pl"] = "sie",
}

-- Make the table
function make_table(data)
	local function repl(param)
		if param == "info" then
			return mw.getContentLanguage():ucfirst(data.info or "")
		end
		
		local forms = data.forms[param]
		
		if not forms then
			return "&mdash;"
		end
		
		local ret = {}
		
		for _, form in ipairs(forms) do
			table.insert(ret, m_links.full_link({lang = lang, term = form}))
		end
		
		return table.concat(ret, ", ")
	end
	
	local rows = {"1sg", "2sg", "3sg", "1pl", "2pl", "3pl"}
	local columns = {"pres_indc", "impr"}
	
	if data.past then
		columns = {"pres_indc", "past_indc", "cond", "impr"}
	end
	if data.past_sin then
		columns = {"pres_indc", "past_indc", "cond", "sub", "impr"}
	end
	if data.past_hon then
		columns = {"pres_indc", "past_indc", "cond"}
	end
	if data.past_mechde then
		columns = {"cond"}
	end
	if data.past_dun then
		columns = {"pres_indc", "cond", "impr"}
	end
	if data.past_solle then
		columns = {"pres_indc", "past_indc", "sub"}
	end
	
	local wikicode = {}
	
	table.insert(wikicode, "{| class=\"inflection-table vsSwitcher\" data-toggle-category=\"inflection\" style=\"background: #F9F9F9; border: 1px solid #aaa;\"")
	table.insert(wikicode, "|- style=\"background: #ccc; text-align: left;\"")
	table.insert(wikicode, "! class=\"vsToggleElement\" style=\"min-width: 33em;\" colspan=\"" .. tostring(#columns + 1) .. "\" | {{{info}}}")
	table.insert(wikicode, "|- class=\"vsHide\"")
	table.insert(wikicode, "! style=\"background: #e2e4c0; min-width: 9em;\" | infinitive")
	table.insert(wikicode, "| colspan=\"" .. tostring(#columns) .. "\" | {{{inf}}}")
	table.insert(wikicode, "|- class=\"vsHide\"")
	table.insert(wikicode, "! style=\"background: #e2e4c0;\" | participle")
	table.insert(wikicode, "| colspan=\"" .. tostring(#columns) .. "\" | {{{ptcp}}}")
	table.insert(wikicode, "|- class=\"vsHide\"")
	table.insert(wikicode, "! style=\"background: #e2e4c0;\" | auxiliary")
	table.insert(wikicode, "| colspan=\"" .. tostring(#columns) .. "\" | {{{aux}}}")
	table.insert(wikicode, "|- class=\"vsHide\" style=\"background: #e2e4c0;\"")
	table.insert(wikicode, "!")
	
	for _, col in ipairs(columns) do
		table.insert(wikicode, "! " .. names[col])
	end
	
	for _, row in ipairs(rows) do
		table.insert(wikicode, "|- class=\"vsHide\"")
		table.insert(wikicode, "! style=\"background:#DEDEDE\" | " .. names[row])
		
		for _, col in ipairs(columns) do
			table.insert(wikicode, "| style=\"min-width: 12em;\" | {{{" .. row .. "_" .. col .. "}}}")
		end
	end
	
	table.insert(wikicode, "|- class=\"vsHide\"")
	table.insert(wikicode, "| colspan=\"" .. tostring(#columns + 1) .. "\"| The use of the present participle is uncommon, but can be made with the suffix -end.")
	table.insert(wikicode, "|}")
	
	wikicode = table.concat(wikicode, "\n")
	
	return mw.ustring.gsub(wikicode, "{{{([a-z0-9_]+)}}}", repl)
end

return export