Module:User:IsomorphycSandbox/la-verb-fake

Hello, you have come here looking for the meaning of the word Module:User:IsomorphycSandbox/la-verb-fake. In DICTIOUS you will not only get to know all the dictionary meanings for the word Module:User:IsomorphycSandbox/la-verb-fake, but we will also tell you about its etymology, its characteristics and you will know how to say Module:User:IsomorphycSandbox/la-verb-fake in singular and plural. Everything you need to know about the word Module:User:IsomorphycSandbox/la-verb-fake you have here. The definition of the word Module:User:IsomorphycSandbox/la-verb-fake will help you to be more precise and correct when speaking or writing your texts. Knowing the definition ofModule:User:IsomorphycSandbox/la-verb-fake, as well as those of other words, enriches your vocabulary and provides you with more and better linguistic resources.

This is a private module sandbox of IsomorphycSandbox, for their own experimentation. Items in this module may be added and removed at IsomorphycSandbox's discretion; do not rely on this module's stability.


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

local export = {}

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

NAMESPACE = NAMESPACE or mw.title.getCurrentTitle().nsText
PAGENAME = PAGENAME or mw.title.getCurrentTitle().text

-- Conjugations are the functions that do the actual
-- conjugating by creating the forms of a basic verb.
-- They are defined further down.
local conjugations = {}

-- Check if this verb is reconstructed
-- i.e. the pagename is Reconstruction:Latin/... or Appendix:Latin/...
local reconstructed = (NAMESPACE == "Reconstruction" or NAMESPACE == "Appendix") and mw.ustring.find(PAGENAME,"^Latin/")

-- The main entry point.
-- This is the only function that can be invoked from a template.

function export.shuo(frame) return mw.ustring.gsub(mw.ustring.toNFD(frame:getParent().args),'+',"") end

function export.show(frame)
	local data, domain = make_data(frame), frame:getParent().args
	if domain == nil then
		return make_table(data) .. m_utilities.format_categories(data.categories, lang)
	else 
		local verb = data ~= nil and ('),'+',"")..'|'..data.. ']]') or 'verb'
		return link_google_books(verb, flatten_values(data), domain) end
end


function make_data(frame)
	local conj_type = frame.args or error("Conjugation type has not been specified. Please pass parameter 1 to the module invocation")
	local args = frame:getParent().args
	local subtype = frame.args or args; if subtype == nil then subtype = '' end
	local sync_perf = args; if sync_perf == nil then sync_perf = '' end
	local p3inf = args; if p3inf == nil then p3inf = '' end
	
	NAMESPACE = mw.title.getCurrentTitle().nsText
	
	if not conjugations then
		error("Unknown conjugation type '" .. conj_type .. "'")
	end
	
	local data = {forms = {}, title = {}, categories = {}, form_footnote_indices = {}, footnotes = {}}  --note: the addition of red superscripted footnotes ('<sup style="color: red">' ... </sup>) is only implemented for the three form printing loops in which it is used
	local typeinfo = {conj_type = conj_type, subtype = subtype, sync_perf = sync_perf, p3inf = p3inf}
	
	-- Generate the verb forms
	conjugations(args, data, typeinfo)
	
	-- Override with user-set forms
	override(data, args)
	
	-- Post-process the forms
	postprocess(data, typeinfo)
	
	-- Check if the links to the verb forms exist
	checkexist(data)
	
	-- Check if the verb is irregular
	if not conj_type == 'irreg' then checkirregular(args, data) end
	return data
end

function postprocess(data, typeinfo)
	-- Add information for the passive perfective forms
	if data.forms then
		local ppplink = m_links.full_link({lang = lang, term = data.forms}, "term")
		local sumlink = m_links.full_link({lang = lang, term = "sum"}, "term")
		
		data.forms = ppplink .. " + present active indicative of " .. sumlink
		data.forms = ppplink .. " + future active indicative of " .. sumlink
		data.forms = ppplink .. " + imperfect active indicative of " .. sumlink
		data.forms = ppplink .. " + present active subjunctive of " .. sumlink
		data.forms = ppplink .. " + imperfect active subjunctive of " .. sumlink
	end
	
	-- Types of irregularity related primarily to the active.
	-- These could in theory be combined with those related to the passive and imperative,
	-- i.e. there's no reason there couldn't be an impersonal deponent verb with no imperatives.
	if typeinfo.subtype == "impers" then
		-- Impersonal verbs have only third-person singular forms.
		table.insert(data.title, "]")
		table.insert(data.categories, "Latin impersonal verbs")
		
		-- Remove all non-3sg forms
		for key, form in pairs(data.forms) do
			if key:find("") or key:find("3p") then
				data.forms = nil
			end
		end
	elseif typeinfo.subtype == "impers-nopass" then
		-- Impersonal verbs have only third-person singular forms.
		table.insert(data.title, "]")
		table.insert(data.title, "active only")
		table.insert(data.categories, "Latin impersonal verbs")
		table.insert(data.categories, "Latin active-only verbs")
		
		-- Remove all non-3sg and passive forms
		for key, form in pairs(data.forms) do
			if key:find("") or key:find("3p") or key:find("pasv") then
				data.forms = nil
			end
		end
	elseif typeinfo.subtype == "impers-depon" then
		-- Impersonal verbs have only third-person singular forms.
		table.insert(data.title, "]")
		table.insert(data.title, "]")
		table.insert(data.categories, "Latin impersonal verbs")
		table.insert(data.categories, "Latin deponent verbs")
		
		-- Remove all non-3sg and active forms and future passive infinitive
		for key, form in pairs(data.forms) do
			if key:find("") or key:find("3p") or key:find("actv") and key ~= "pres_actv_ptc" and key ~= "futr_actv_ptc" or key == "futr_pasv_inf" then
				data.forms = nil
			end
		end
		
		-- Change passive to active
		for key, form in pairs(data.forms) do
			if key:find("pasv") and key ~= "pres_pasv_ptc" and key ~= "futr_pasv_ptc" then
				data.forms = form
				data.forms = nil
			end
		end
	elseif typeinfo.subtype == "3only" then
		table.insert(data.title, "]")
		table.insert(data.categories, "Latin impersonal verbs")
		
		-- Remove all non-3sg forms
		for key, form in pairs(data.forms) do
			if key:find("") then
				data.forms = nil
			end
		end
	elseif typeinfo.subtype == "3only-nopass" then
		table.insert(data.title, "]")
		table.insert(data.title, "active only")
		table.insert(data.categories, "Latin impersonal verbs")
		table.insert(data.categories, "Latin active-only verbs")
		
		-- Remove all non-3sg and passive forms
		for key, form in pairs(data.forms) do
			if key:find("") or key:find("pasv") then
				data.forms = nil
			end
		end
	elseif typeinfo.subtype == "3only-depon" then
		table.insert(data.title, "]")
		table.insert(data.title, "]")
		table.insert(data.categories, "Latin impersonal verbs")
		table.insert(data.categories, "Latin deponent verbs")
		
		-- Remove all non-3sg and active forms and future passive infinitive
		for key, form in pairs(data.forms) do
			if key:find("") or key:find("actv") and key ~= "pres_actv_ptc" and key ~= "futr_actv_ptc" or key == "futr_pasv_inf" then
				data.forms = nil
			end
		end
		
		-- Change passive to active
		for key, form in pairs(data.forms) do
			if key:find("pasv") and key ~= "pres_pasv_ptc" and key ~= "futr_pasv_ptc" then
				data.forms = form
				data.forms = nil
			end
		end
	end
	
	-- Handle certain irregularities in the passive
	if typeinfo.subtype == "depon" then
		-- Deponent verbs use passive forms with active meaning
		table.insert(data.title, "]")
		table.insert(data.categories, "Latin deponent verbs")
		
		-- Remove active forms and future passive infinitive
		for key, form in pairs(data.forms) do
			if key:find("actv") and key ~= "pres_actv_ptc" and key ~= "futr_actv_ptc" and key ~= "futr_actv_inf" or key == "futr_pasv_inf" then
				data.forms = nil
			end
		end
		
		-- Change passive to active
		for key, form in pairs(data.forms) do
			if key:find("pasv") and key ~= "pres_pasv_ptc" and key ~= "futr_pasv_ptc" and key ~= "futr_pasv_inf" then
				data.forms = form
				data.forms = nil
			end
		end
	
		-- Generate correct form of infinitive for nominative gerund
		data.forms = data.forms
		
	elseif typeinfo.subtype == "semi-depon" then
		-- Semi-deponent verbs use perfective passive forms with active meaning,
		-- and have no imperfective passive
		table.insert(data.title, "]")
		table.insert(data.categories, "Latin semi-deponent verbs")
		
		-- Remove perfective active and imperfective passive forms
		for key, form in pairs(data.forms) do
			if key:find("perf_actv") or key:find("plup_actv") or key:find("futp_actv") or key:find("pres_pasv") or key:find("impf_pasv") or key:find("futr_pasv") then
				data.forms = nil
			end
		end
		
		-- Change perfective passive to active
		for key, form in pairs(data.forms) do
			if key:find("perf_pasv") or key:find("plup_pasv") or key:find("futp_pasv") then
				data.forms = form
				data.forms = nil
			end
		end
	elseif typeinfo.subtype == "depon-noperf" then --(e.g. calvor, -ī)
		table.insert(data.title, "]")
		table.insert(data.categories, "Latin deponent verbs")
		table.insert(data.title, "]")
		table.insert(data.categories, "Latin defective verbs")
		
		-- Remove active forms and future passive infinitive
		for key, form in pairs(data.forms) do
			if key:find("actv") and key ~= "pres_actv_ptc" and key ~= "futr_actv_ptc" and key ~= "futr_actv_inf" or key == "futr_pasv_inf" then
				data.forms = nil
			end
		end
		
		-- Change passive to active
		for key, form in pairs(data.forms) do
			if key:find("pasv") and key ~= "pres_pasv_ptc" and key ~= "futr_pasv_ptc" and key ~= "futr_pasv_inf" then
				data.forms = form
				data.forms = nil
			end
		end
		
		-- Remove all perfect forms
		for key, form in pairs(data.forms) do
			if key:find("perf") or key:find("plup") or key:find("futp") then
				data.forms = nil
			end
		end
	elseif typeinfo.subtype == "noperf" then
		-- Some verbs have no perfect forms (e.g. inalbēscō, -ěre)
		table.insert(data.title, "]")
		table.insert(data.categories, "Latin defective verbs")

		-- Remove all perfect forms
		for key, form in pairs(data.forms) do
			if key:find("perf") or key:find("plup") or key:find("futp") then
				data.forms = nil
			end
		end
	elseif typeinfo.subtype == "no-actv-perf" then
		-- Some verbs have no active perfect forms (e.g. interstinguō, -ěre)
		table.insert(data.title, "no active perfect forms")
		table.insert(data.categories, "Latin defective verbs")
		
		-- Remove all active perfect forms
		for key, form in pairs(data.forms) do
			if key:find("actv") and (key:find("perf") or key:find("plup") or key:find("futp")) then
				data.forms = nil
			end
		end
	elseif typeinfo.subtype == "no-pasv-perf" then
		-- Some verbs have no passive perfect forms (e.g. ārēscō, -ěre)
		table.insert(data.title, "no passive perfect forms")
		table.insert(data.categories, "Latin defective verbs")
		
		-- Remove all passive perfect forms
		for key, form in pairs(data.forms) do
			if key:find("pasv") and (key:find("perf") or key:find("plup") or key:find("futp")) then
				data.forms = nil
			end
		end
	elseif typeinfo.subtype == "nopass-noperf" then
		-- Some verbs have no passive and no perfect forms (e.g. albēscō, -ěre)
		table.insert(data.title, "]")
		table.insert(data.title, "active only")
		table.insert(data.categories, "Latin defective verbs")
		table.insert(data.categories, "Latin active-only verbs")
		
		-- Remove all passive and all perfect forms
		for key, form in pairs(data.forms) do
			if key:find("pasv") or key:find("perf") or key:find("plup") or key:find("futp") then
				data.forms = nil
			end
		end
	elseif typeinfo.subtype == "nopass" then
		-- Some verbs have no passive forms (usually intransitive)
		table.insert(data.title, "active only")
		table.insert(data.categories, "Latin active-only verbs")
		
		-- Remove all passive forms
		for key, form in pairs(data.forms) do
			if key:find("pasv") then
				data.forms = nil
			end
		end
	elseif typeinfo.subtype == "pass-3only" then
		-- Some verbs have only third-person forms in the passive
		table.insert(data.title, "only third-person forms in passive")
		table.insert(data.categories, "Latin verbs with third-person passive")
		
		-- Remove all non-3rd-person passive forms and all passive imperatives
		for key, form in pairs(data.forms) do
			if key:find("pasv") and (key:find("") or key:find("impr")) then
				data.forms = nil
			end
		end
	elseif typeinfo.subtype == "pass-impers" then
		-- Some verbs are impersonal in the passive
		table.insert(data.title, "] in passive")
		table.insert(data.categories, "Latin verbs with impersonal passive")
		
		-- Remove all non-3sg passive forms
		for key, form in pairs(data.forms) do
			if key:find("pasv") and (key:find("") or key:find("3p") or key:find("impr")) or key:find("futr_pasv_inf") then
				data.forms = nil
			end
		end
	elseif typeinfo.subtype == "perf-as-pres" then
		-- Perfect forms as present tense
		table.insert(data.title, "active only")
		table.insert(data.title, "] forms as present")
		table.insert(data.title, "pluperfect as imperfect")
		table.insert(data.title, "future perfect as future")
		table.insert(data.categories, "Latin defective verbs")
		table.insert(data.categories, "Latin active-only verbs")
        table.insert(data.categories, "Latin verbs with perfect forms having imperfective meanings")
		
		-- Change perfect passive participle to perfect active participle
		data.forms = data.forms
		
		-- Change perfect active infinitive to present active infinitive
		data.forms = data.forms
		
		-- Remove passive forms
		-- Remove present active, imperfect active and future active forms
		for key, form in pairs(data.forms) do
			if key ~= "futr_actv_inf" and key ~= "futr_actv_ptc" and (key:find("pasv") or key:find("pres") and key ~= "pres_actv_inf" or key:find("impf") or key:find("futr")) then
				data.forms = nil
			end
		end

		-- Change perfect forms to non-perfect forms
		for key, form in pairs(data.forms) do
			if key:find("perf") and key ~= "perf_actv_ptc" then
				data.forms = form
				data.forms = nil
			elseif key:find("plup") then
				data.forms = form
				data.forms = nil
			elseif key:find("futp") then
				data.forms = form
				data.forms = nil
			elseif key:find("ger") then
				data.forms = nil
			end
		end
		
		data.forms = nil
	elseif typeinfo.subtype == "memini" then
		-- Perfect forms as present tense
		table.insert(data.title, "active only")
		table.insert(data.title, "] forms as present")
		table.insert(data.title, "pluperfect as imperfect")
		table.insert(data.title, "future perfect as future")
		table.insert(data.categories, "Latin defective verbs")
		table.insert(data.categories, "Latin verbs with perfect forms having imperfective meanings")

		-- Remove passive forms
		-- Remove present active, imperfect active and future active forms
		-- Except for future active imperatives
		for key, form in pairs(data.forms) do
			if key:find("pasv") or key:find("pres") or key:find("impf") or key:find("futr") or key:find("ptc") or key:find("ger") then
				data.forms = nil
			end
		end

		-- Change perfect forms to non-perfect forms
		for key, form in pairs(data.forms) do
			if key:find("perf") and key ~= "perf_actv_ptc" then
				data.forms = form
				data.forms = nil
			elseif key:find("plup") then
				data.forms = form
				data.forms = nil
			elseif key:find("futp") then
				data.forms = form
				data.forms = nil
			end
		end
		
		-- Add imperative forms
		data.forms = "mementō"
		data.forms = "mementōte"
	end

	-- Handle certain irregularities in the imperative
	if typeinfo.subtype == "noimp" then
		-- Some verbs have no imperatives
		table.insert(data.title, "no ]s")
	end
	

	-- Add the ancient future_passive_participle of certain verbs
	if typeinfo.pres_stem == "lāb" then
		data.forms = "lābundus"
	elseif typeinfo.pres_stem == "collāb" then
		data.forms = "collābundus"
	elseif typeinfo.pres_stem == "illāb" then
		data.forms = "illābundus"
	elseif typeinfo.pres_stem == "relāb" then
		data.forms = "relābundus"
	end

	-- Add the poetic present passives infinitive forms of certain verbs
	if typeinfo.p3inf == '1' then
			local form, noteindex = "pres_"..(typeinfo.subtype=='depon' and "actv" or "pasv").."_inf", #(data.footnotes)+1
			data.forms = {data.forms, mw.ustring.sub(data.forms, 1,-2).."ier" }
			data.form_footnote_indices = tostring(noteindex)
			if typeinfo.subtype=='depon' then
				data.form_footnote_indices = tostring(noteindex)
				data.forms = data.forms
			end
			data.footnotes = 'The present passive infinitive in -ier is a rare poetic form which is attested for this verb.'
	end
	
	--Add the syncopated perfect forms, omitting the separately handled fourth conjugation cases
	
	if typeinfo.sync_perf == 'poetic' then
		local sss = { {'perf_actv_inf', 'sse'}, --infinitive
			    {'2s_perf_actv_indc','sti'},  {'2p_perf_actv_indc','stis'}, --unambiguous perfect actives
			    {'1s_plup_actv_subj','ssem'}, {'2s_plup_actv_subj','sses'}, {'3s_plup_actv_subj','sset'}, {'1p_plup_actv_subj','ssemus'},  {'2p_plup_actv_subj','ssetis'},  {'3p_plup_actv_subj','ssent'} } --pluperfect subjunctives
		local noteindex = #(data.footnotes)+1
		function add_sync_perf(form, suff_sync) 
			local old = data.forms
			data.forms = type(old) == "table" and old or {old, mw.ustring.sub(old, 1, -mw.ustring.len(suff_sync)-3)..suff_sync }
			data.form_footnote_indices = noteindex end
		for k,v in pairs(sss) do
			add_sync_perf(v,v) end
		data.footnotes = "At least one rare poetic syncopated perfect form is attested." end

end


--[=[
	Conjugation functions
]=]--

function get_regular_stems(args, typeinfo)
	-- Get the parameters
	if typeinfo.subtype:find("depon") then
		-- Deponent and semi-deponent verbs don't have the perfective principal part
		typeinfo.pres_stem = args; if typeinfo.pres_stem == "" then typeinfo.pres_stem = nil end
		typeinfo.perf_stem = nil
		typeinfo.supine_stem = args; if typeinfo.supine_stem == "" then typeinfo.supine_stem = nil end
	else
		typeinfo.pres_stem = args; if typeinfo.pres_stem == "" then typeinfo.pres_stem = nil end
		typeinfo.perf_stem = args; if typeinfo.perf_stem == "" then typeinfo.perf_stem = nil end
		typeinfo.supine_stem = args; if typeinfo.supine_stem == "" then typeinfo.supine_stem = nil end
	end
	
	if (typeinfo.subtype == "perf-as-pres" or typeinfo.subtype == "memini") and not typeinfo.pres_stem then typeinfo.pres_stem = "whatever" end
	
	-- Prepare stems
	if not typeinfo.pres_stem then
		if NAMESPACE == "Template" then
			typeinfo.pres_stem = "-"
		else
			error("Present stem has not been provided")
		end
	end
	
	if not typeinfo.perf_stem and not typeinfo.subtype:find("depon") and not typeinfo.subtype:find("noperf") then
		if typeinfo.conj_type == "1st" then
			typeinfo.perf_stem = typeinfo.pres_stem .. "āv"
		elseif NAMESPACE == "Template" then
			typeinfo.perf_stem = "-"
		else
			error("Perfect stem has not been provided")
		end
	end
	
	if not typeinfo.supine_stem and not typeinfo.subtype:find("nopass") and not typeinfo.subtype:find("noperf") and typeinfo.subtype ~= "no-pasv-perf" and typeinfo.subtype ~= "memini" and typeinfo.subtype ~= "pass-3only" then
		if typeinfo.conj_type == "1st" then
			typeinfo.supine_stem = typeinfo.pres_stem .. "āt"
		elseif NAMESPACE == "Template" then
			typeinfo.supine_stem = "-"
		else
			error("Supine stem has not been provided")
		end
	end
end

conjugations = function(args, data, typeinfo)
	get_regular_stems(args, typeinfo)
	
	table.insert(data.title, "]")
	table.insert(data.categories, "Latin first conjugation verbs")
	
	if typeinfo.perf_stem then
		if typeinfo.perf_stem == typeinfo.pres_stem .. "āv" then
			table.insert(data.categories, "Latin first conjugation verbs with perfect in -av-")
		elseif typeinfo.perf_stem == typeinfo.pres_stem .. "u" then
			table.insert(data.categories, "Latin first conjugation verbs with perfect in -u-")
		elseif typeinfo.perf_stem == typeinfo.pres_stem then
			table.insert(data.categories, "Latin first conjugation verbs with suffixless perfect")
		else
			table.insert(data.categories, "Latin first conjugation verbs with irregular perfect")
		end
	end
	
	make_pres_1st(data, typeinfo.pres_stem)
	make_perf(data, typeinfo.perf_stem)
	make_supine(data, typeinfo.supine_stem)
end

conjugations = function(args, data, typeinfo)
	get_regular_stems(args, typeinfo)
	
	table.insert(data.title, "]")
	table.insert(data.categories, "Latin second conjugation verbs")
	
	if typeinfo.perf_stem then
		typeinfo.pres_stem = mw.ustring.gsub(typeinfo.pres_stem,"qu","1")
		typeinfo.perf_stem = mw.ustring.gsub(typeinfo.perf_stem,"qu","1")
		apocope = mw.ustring.gsub(typeinfo.pres_stem,"+$","")
		if typeinfo.perf_stem == typeinfo.pres_stem .. "ēv" then
			table.insert(data.categories, "Latin second conjugation verbs with perfect in -ev-")
		elseif typeinfo.perf_stem == typeinfo.pres_stem .. "u" then
			table.insert(data.categories, "Latin second conjugation verbs with perfect in -u-")
		elseif typeinfo.perf_stem == typeinfo.pres_stem then
			table.insert(data.categories, "Latin second conjugation verbs with suffixless perfect")
		elseif typeinfo.perf_stem == apocope .. "x" or typeinfo.perf_stem == apocope .. "s" then
			table.insert(data.categories, "Latin second conjugation verbs with perfect in -s- or -x-")
		else
			table.insert(data.categories, "Latin second conjugation verbs with irregular perfect")
		end
		typeinfo.pres_stem = mw.ustring.gsub(typeinfo.pres_stem,"1","qu")
		typeinfo.perf_stem = mw.ustring.gsub(typeinfo.perf_stem,"1","qu")
	end
	
	make_pres_2nd(data, typeinfo.pres_stem)
	make_perf(data, typeinfo.perf_stem)
	make_supine(data, typeinfo.supine_stem)
end

conjugations = function(args, data, typeinfo)
	get_regular_stems(args, typeinfo)
	
	table.insert(data.title, "]")
	table.insert(data.categories, "Latin third conjugation verbs")
	
	if typeinfo.perf_stem then
		typeinfo.pres_stem = mw.ustring.gsub(typeinfo.pres_stem,"qu","1")
		typeinfo.perf_stem = mw.ustring.gsub(typeinfo.perf_stem,"qu","1")
		apocope = mw.ustring.gsub(typeinfo.pres_stem,"+$","")
		if typeinfo.perf_stem == typeinfo.pres_stem .. "āv" then
			table.insert(data.categories, "Latin third conjugation verbs with perfect in -av-")
		elseif typeinfo.perf_stem == typeinfo.pres_stem .. "ēv" then
			table.insert(data.categories, "Latin third conjugation verbs with perfect in -ev-")
		elseif typeinfo.perf_stem == typeinfo.pres_stem .. "īv" then
			table.insert(data.categories, "Latin third conjugation verbs with perfect in -iv-")
		elseif typeinfo.perf_stem == typeinfo.pres_stem .. "u" then
			table.insert(data.categories, "Latin third conjugation verbs with perfect in -u-")
		elseif typeinfo.perf_stem == typeinfo.pres_stem then
			table.insert(data.categories, "Latin third conjugation verbs with suffixless perfect")
		elseif typeinfo.perf_stem == apocope .. "x" or typeinfo.perf_stem == apocope .. "s" then
			table.insert(data.categories, "Latin third conjugation verbs with perfect in -s- or -x-")
		else
			table.insert(data.categories, "Latin third conjugation verbs with irregular perfect")
		end
	typeinfo.pres_stem = mw.ustring.gsub(typeinfo.pres_stem,"1","qu")
	typeinfo.perf_stem = mw.ustring.gsub(typeinfo.perf_stem,"1","qu")
	end
	
	if typeinfo.pres_stem and mw.ustring.match(typeinfo.pres_stem,"sc$") then
		table.insert(data.categories, "Latin inchoative verbs")
	end
	
	make_pres_3rd(data, typeinfo.pres_stem)
	make_perf(data, typeinfo.perf_stem)
	make_supine(data, typeinfo.supine_stem)
end

conjugations = function(args, data, typeinfo)
	get_regular_stems(args, typeinfo)
	
	table.insert(data.title, "] ''iō''-variant")
	table.insert(data.categories, "Latin third conjugation verbs")
	
	if typeinfo.perf_stem then
		typeinfo.pres_stem = mw.ustring.gsub(typeinfo.pres_stem,"qu","1")
		typeinfo.perf_stem = mw.ustring.gsub(typeinfo.perf_stem,"qu","1")
		apocope = mw.ustring.gsub(typeinfo.pres_stem,"+$","")
		if typeinfo.perf_stem == typeinfo.pres_stem .. "āv" then
			table.insert(data.categories, "Latin third conjugation verbs with perfect in -av-")
		elseif typeinfo.perf_stem == typeinfo.pres_stem .. "ēv" then
			table.insert(data.categories, "Latin third conjugation verbs with perfect in -ev-")
		elseif typeinfo.perf_stem == typeinfo.pres_stem .. "īv" then
			table.insert(data.categories, "Latin third conjugation verbs with perfect in -iv-")
		elseif typeinfo.perf_stem == typeinfo.pres_stem .. "u" then
			table.insert(data.categories, "Latin third conjugation verbs with perfect in -u-")
		elseif typeinfo.perf_stem == typeinfo.pres_stem then
			table.insert(data.categories, "Latin third conjugation verbs with suffixless perfect")
		elseif typeinfo.perf_stem == apocope .. "x" or typeinfo.perf_stem == apocope .. "s" then
			table.insert(data.categories, "Latin third conjugation verbs with perfect in -s- or -x-")
		else
			table.insert(data.categories, "Latin third conjugation verbs with irregular perfect")
		end
		typeinfo.pres_stem = mw.ustring.gsub(typeinfo.pres_stem,"1","qu")
		typeinfo.perf_stem = mw.ustring.gsub(typeinfo.perf_stem,"1","qu")
	end
	
	make_pres_3rd_io(data, typeinfo.pres_stem)
	make_perf(data, typeinfo.perf_stem)
	make_supine(data, typeinfo.supine_stem)
end

conjugations = function(args, data, typeinfo)
	get_regular_stems(args, typeinfo)
	
	table.insert(data.title, "]")
	table.insert(data.categories, "Latin fourth conjugation verbs")
	
	
	if typeinfo.perf_stem then
		typeinfo.pres_stem = mw.ustring.gsub(typeinfo.pres_stem,"qu","1")
		typeinfo.perf_stem = mw.ustring.gsub(typeinfo.perf_stem,"qu","1")
		apocope = mw.ustring.gsub(typeinfo.pres_stem,"+$","")
		clone = mw.ustring.gsub(typeinfo.perf_stem,"%.","")
		if clone == typeinfo.pres_stem .. "īv" then
			table.insert(data.categories, "Latin fourth conjugation verbs with perfect in -iv-")
		elseif clone == typeinfo.pres_stem .. "u" then
			table.insert(data.categories, "Latin fourth conjugation verbs with perfect in -u-")
		elseif clone == typeinfo.pres_stem then
			table.insert(data.categories, "Latin fourth conjugation verbs with suffixless perfect")
		elseif clone == apocope .. "x" or clone == apocope .. "s" then
			table.insert(data.categories, "Latin fourth conjugation verbs with perfect in -s- or -x-")
		else
			table.insert(data.categories, "Latin fourth conjugation verbs with irregular perfect")
		end
		typeinfo.pres_stem = mw.ustring.gsub(typeinfo.pres_stem,"1","qu")
		typeinfo.perf_stem = mw.ustring.gsub(typeinfo.perf_stem,"1","qu")
	end
	
	make_pres_4th(data, typeinfo.pres_stem)
	make_perf(data, typeinfo.perf_stem)
	make_supine(data, typeinfo.supine_stem)
	
	if data.forms == "serviō" or data.forms == "saeviō" then
		data.forms = {typeinfo.pres_stem .. "iēbam",   typeinfo.pres_stem .. "ībam"}
		data.forms = {typeinfo.pres_stem .. "iēbās",   typeinfo.pres_stem .. "ībās"}
		data.forms = {typeinfo.pres_stem .. "iēbat",   typeinfo.pres_stem .. "ībat"}
		data.forms = {typeinfo.pres_stem .. "iēbāmus", typeinfo.pres_stem .. "ībāmus"}
		data.forms = {typeinfo.pres_stem .. "iēbātis", typeinfo.pres_stem .. "ībātis"}
		data.forms = {typeinfo.pres_stem .. "iēbant",  typeinfo.pres_stem .. "ībant"}
	
		data.forms = {typeinfo.pres_stem .. "iam",   typeinfo.pres_stem .. "ībō"}
		data.forms = {typeinfo.pres_stem .. "iēs",   typeinfo.pres_stem .. "ībis"}
		data.forms = {typeinfo.pres_stem .. "iet",   typeinfo.pres_stem .. "ībit"}
		data.forms = {typeinfo.pres_stem .. "iēmus", typeinfo.pres_stem .. "ībimus"}
		data.forms = {typeinfo.pres_stem .. "iētis", typeinfo.pres_stem .. "ībitis"}
		data.forms = {typeinfo.pres_stem .. "ient",  typeinfo.pres_stem .. "ībunt"}
	end
	
	if typeinfo.sync_perf == "y" then
		for key,form in pairs(data.forms) do
			if key~="3p_perf_actv_indc" and key:find("perf") or key:find("plup") or key:find("futp") then
				form = mw.ustring.gsub(form,"%.īvī","iī")
				form = mw.ustring.gsub(form,"%.īvi","ī")
				form = mw.ustring.gsub(form,"%.īve","ī")
				form = mw.ustring.gsub(form,"%.īvē","ē")
				data.forms = form
			end
		end
		for index,form in pairs(data.forms) do
			form = mw.ustring.gsub(form,"%.īvī","iī")
			form = mw.ustring.gsub(form,"%.īvi","ī")
			form = mw.ustring.gsub(form,"%.īve","ī")
			form = mw.ustring.gsub(form,"%.īvē","ē")
			data.forms = form
		end
	end
	
	if typeinfo.sync_perf == "yn" then
		for key,form in pairs(data.forms) do
			if key~="3p_perf_actv_indc" and key:find("perf") or key:find("plup") or key:find("futp") then
				sync = mw.ustring.gsub(form,"%.īvī","iī")
				sync = mw.ustring.gsub(sync,"%.īvi","ī")
				sync = mw.ustring.gsub(sync,"%.īve","ī")
				sync = mw.ustring.gsub(sync,"%.īvē","ē")
				form = mw.ustring.gsub(form,"%.","")
				if form~=sync then data.forms = {form,sync} end
			end
		end
		temp = {}
		for _,form in ipairs(data.forms) do
			clone = mw.ustring.gsub(form,"%.","")
			table.insert(temp,clone)
			form = mw.ustring.gsub(form,"%.īvī","iī")
			form = mw.ustring.gsub(form,"%.īvi","ī")
			form = mw.ustring.gsub(form,"%.īve","ī")
			form = mw.ustring.gsub(form,"%.īvē","ē")
			table.insert(temp,form)
		end
		data.forms = temp
	end
end

-- Irregular conjugations
local irreg_conjugations = {}

conjugations = function(args, data, typeinfo)
	local verb = args; if verb == "" then verb = nil end
	local prefix = args; if prefix == "" then prefix = nil end
	
	if not verb then
		if NAMESPACE == "Template" then
			verb = "sum"
		else
			error("The verb to be conjugated has not been specified.")
		end
	end
	
	if not irreg_conjugations then
		error("The verb '" .. verb .. "' is not recognised as an irregular verb.")
	end
	
	typeinfo.verb = verb
	typeinfo.prefix = prefix
	
	-- Generate the verb forms
	irreg_conjugations(args, data, typeinfo)
end

irreg_conjugations = function(args, data, typeinfo)
	table.insert(data.title, "] iō-variant")
	table.insert(data.title, "]")
	table.insert(data.title, "active only")
	table.insert(data.title, "highly ]")
	table.insert(data.categories, "Latin third conjugation verbs")
	table.insert(data.categories, "Latin irregular verbs")
	table.insert(data.categories, "Latin active-only verbs")
	table.insert(data.categories, "Latin defective verbs")
	
	local prefix = typeinfo.prefix or ""
	
	data.forms = {prefix .. "āiō", prefix .. "aiiō"}
	data.forms = {prefix .. "āis", prefix .. "ais"}
	data.forms = prefix .. "ait"
	data.forms = {prefix .. "āiunt", prefix .. "aiiunt"}
	
	data.forms = {prefix .. "aiēbam", prefix .. "āībam"}
	data.forms = {prefix .. "aiēbās", prefix .. "āībās"}
	data.forms = {prefix .. "aiēbat", prefix .. "āībat"}
	data.forms = {prefix .. "aiēbāmus", prefix .. "āībāmus"}
	data.forms = {prefix .. "aiēbātis", prefix .. "āībātis"}
	data.forms = {prefix .. "aiēbant", prefix .. "āībant"}
	
	data.forms = prefix .. "aistī"
	data.forms = prefix .. "ait"
	
	data.forms = prefix .. "āiās"
	data.forms = prefix .. "āiat"
	data.forms = prefix .. "āiant"
	
	data.forms = prefix .. "aï"
	
	data.forms = prefix .. "āiere"
	data.forms = prefix .. "aiēns"
end

irreg_conjugations = function(args, data, typeinfo)
	table.insert(data.title, "]")
	table.insert(data.title, "] short imperative")
	table.insert(data.categories, "Latin third conjugation verbs")
	table.insert(data.categories, "Latin irregular verbs")
	
	local prefix = typeinfo.prefix or ""
	
	make_pres_3rd(data, prefix .. "dīc")
	make_perf(data, prefix .. "dīx")
	make_supine(data, prefix .. "dict")
	
	data.forms = {prefix .. "dīc", data.forms}
end

irreg_conjugations = function(args, data, typeinfo)
	table.insert(data.title, "]")
	table.insert(data.title, "] short ''a'' in most forms except " .. m_links.full_link({lang = lang, alt = "dās"}, "term") .. " and " .. m_links.full_link({lang = lang, alt = "dā"}, "term"))
	table.insert(data.categories, "Latin first conjugation verbs")
	table.insert(data.categories, "Latin irregular verbs")
	
	local prefix = typeinfo.prefix or ""
	
	make_perf(data, prefix .. "ded")
	make_supine(data, prefix .. "dat")
	
	-- Active imperfective indicative
	data.forms = prefix .. "dō"
	data.forms = prefix .. "dās"
	data.forms = prefix .. "dat"
	data.forms = prefix .. "damus"
	data.forms = prefix .. "datis"
	data.forms = prefix .. "dant"
	
	data.forms = prefix .. "dabam"
	data.forms = prefix .. "dabās"
	data.forms = prefix .. "dabat"
	data.forms = prefix .. "dabāmus"
	data.forms = prefix .. "dabātis"
	data.forms = prefix .. "dabant"
	
	data.forms = prefix .. "dabō"
	data.forms = prefix .. "dabis"
	data.forms = prefix .. "dabit"
	data.forms = prefix .. "dabimus"
	data.forms = prefix .. "dabitis"
	data.forms = prefix .. "dabunt"
	
	-- Passive imperfective indicative
	data.forms = prefix .. "dor"
	data.forms = {prefix .. "daris", prefix .. "dare"}
	data.forms = prefix .. "datur"
	data.forms = prefix .. "damur"
	data.forms = prefix .. "daminī"
	data.forms = prefix .. "dantur"
	
	data.forms = prefix .. "dabar"
	data.forms = {prefix .. "dabāris", prefix .. "dabāre"}
	data.forms = prefix .. "dabātur"
	data.forms = prefix .. "dabāmur"
	data.forms = prefix .. "dabāminī"
	data.forms = prefix .. "dabantur"
	
	data.forms = prefix .. "dabor"
	data.forms = {prefix .. "daberis", prefix .. "dabere"}
	data.forms = prefix .. "dabitur"
	data.forms = prefix .. "dabimur"
	data.forms = prefix .. "dabiminī"
	data.forms = prefix .. "dabuntur"
	
	-- Active imperfective subjunctive
	data.forms = prefix .. "dem"
	data.forms = prefix .. "dēs"
	data.forms = prefix .. "det"
	data.forms = prefix .. "dēmus"
	data.forms = prefix .. "dētis"
	data.forms = prefix .. "dent"
	
	data.forms = prefix .. "darem"
	data.forms = prefix .. "darēs"
	data.forms = prefix .. "daret"
	data.forms = prefix .. "darēmus"
	data.forms = prefix .. "darētis"
	data.forms = prefix .. "darent"
	
	-- Passive imperfective subjunctive
	data.forms = prefix .. "der"
	data.forms = {prefix .. "dēris", prefix .. "dēre"}
	data.forms = prefix .. "dētur"
	data.forms = prefix .. "dēmur"
	data.forms = prefix .. "dēminī"
	data.forms = prefix .. "dentur"
	
	data.forms = prefix .. "darer"
	data.forms = {prefix .. "darēris", prefix .. "darēre"}
	data.forms = prefix .. "darētur"
	data.forms = prefix .. "darēmur"
	data.forms = prefix .. "darēminī"
	data.forms = prefix .. "darentur"
	
	-- Imperative
	data.forms = prefix .. "dā"
	data.forms = prefix .. "date"
	
	data.forms = prefix .. "datō"
	data.forms = prefix .. "datō"
	data.forms = prefix .. "datōte"
	data.forms = prefix .. "dantō"
	
	data.forms = prefix .. "dare"
	data.forms = prefix .. "daminī"
	
	data.forms = prefix .. "dator"
	data.forms = prefix .. "dator"
	-- no form
	data.forms = prefix .. "dantor"
	
	-- Present infinitives
	data.forms = prefix .. "dare"
	data.forms = prefix .. "darī"
	
	-- Imperfective participles
	data.forms = prefix .. "dāns"
	data.forms = prefix .. "dandus"
	
	-- Gerund
	data.forms = data.forms
	data.forms = prefix .. "dandī"
	data.forms = prefix .. "dandō"
	data.forms = prefix .. "dandum"
end

irreg_conjugations = function(args, data, typeinfo)
	table.insert(data.title, "]")
	table.insert(data.title, "] short imperative")
	table.insert(data.categories, "Latin third conjugation verbs")
	table.insert(data.categories, "Latin irregular verbs")
	
	local prefix = typeinfo.prefix or ""
	
	make_pres_3rd(data, prefix .. "dūc")
	make_perf(data, prefix .. "dūx")
	make_supine(data, prefix .. "duct")
	
	data.forms = {prefix .. "dūc", data.forms}
end

irreg_conjugations = function(args, data, typeinfo)
	table.insert(data.title, "]")
	table.insert(data.title, "some ] alternative forms")
	table.insert(data.categories, "Latin third conjugation verbs")
	table.insert(data.categories, "Latin irregular verbs")
	
	make_pres_3rd(data, "ed")
	make_perf(data, "ēd")
	make_supine(data, "ēs")
	
	-- Active imperfective indicative
	data.forms = {data.forms, "ēs"}
	data.forms = {data.forms, "ēst"}
	data.forms = {data.forms, "ēstis"}
	
	-- Passive imperfective indicative
	data.forms = {data.forms, "ēstur"}
	
	-- Active imperfective subjunctive
	data.forms = {data.forms, "edim"}
	data.forms = {data.forms, "edīs"}
	data.forms = {data.forms, "edit"}
	data.forms = {data.forms, "edīmus"}
	data.forms = {data.forms, "edītis"}
	data.forms = {data.forms, "edint"}
	
	data.forms = {data.forms, "ēssem"}
	data.forms = {data.forms, "ēssēs"}
	data.forms = {data.forms, "ēsset"}
	data.forms = {data.forms, "ēssēmus"}
	data.forms = {data.forms, "ēssētis"}
	data.forms = {data.forms, "ēssent"}
	
	-- Active imperative
	data.forms = {data.forms, "ēs"}
	data.forms = {data.forms, "ēste"}
	
	data.forms = {data.forms, "ēstō"}
	data.forms = {data.forms, "ēstō"}
	data.forms = {data.forms, "ēstōte"}
	
	-- Present infinitives
	data.forms = {data.forms, "ēsse"}
end

irreg_conjugations = function(args, data, typeinfo)
	table.insert(data.title, "]")
	table.insert(data.categories, "Latin irregular verbs")
	
	local prefix = typeinfo.prefix or ""
	
	make_perf(data, prefix .. "i")
	make_supine(data, prefix .. "it")
	
	-- Active imperfective indicative
	data.forms = prefix .. "eō"
	data.forms = prefix .. "īs"
	data.forms = prefix .. "it"
	data.forms = prefix .. "īmus"
	data.forms = prefix .. "ītis"
	data.forms = prefix .. "eunt"
	
	if prefix == "prōd" then data.forms = {"prōdeunt","prōdīnunt"} end
	
	data.forms = prefix .. "ībam"
	data.forms = prefix .. "ībās"
	data.forms = prefix .. "ībat"
	data.forms = prefix .. "ībāmus"
	data.forms = prefix .. "ībātis"
	data.forms = prefix .. "ībant"
	
	data.forms = prefix .. "ībō"
	data.forms = prefix .. "ībis"
	data.forms = prefix .. "ībit"
	data.forms = prefix .. "ībimus"
	data.forms = prefix .. "ībitis"
	data.forms = prefix .. "ībunt"
	
	-- Active perfective indicative
	data.forms = {data.forms, prefix .. "īvī"}
	data.forms = {prefix .. "īstī", prefix .. "īvistī"}
	data.forms = {data.forms, prefix .. "īvit"}
	data.forms = prefix .. "īstis"
	
	-- Passive imperfective indicative
	data.forms = prefix .. "eor"
	data.forms = {prefix .. "īris", prefix .. "īre"}
	data.forms = prefix .. "ītur"
	data.forms = prefix .. "īmur"
	data.forms = prefix .. "īminī"
	data.forms = prefix .. "euntur"
	
	data.forms = prefix .. "ībar"
	data.forms = {prefix .. "ībāris", prefix .. "ībāre"}
	data.forms = prefix .. "ībātur"
	data.forms = prefix .. "ībāmur"
	data.forms = prefix .. "ībāminī"
	data.forms = prefix .. "ībantur"
	
	data.forms = prefix .. "ībor"
	data.forms = {prefix .. "īberis", prefix .. "ībere"}
	data.forms = prefix .. "ībitur"
	data.forms = prefix .. "ībimur"
	data.forms = prefix .. "ībiminī"
	data.forms = prefix .. "ībuntur"
	
	-- Active imperfective subjunctive
	data.forms = prefix .. "eam"
	data.forms = prefix .. "eās"
	data.forms = prefix .. "eat"
	data.forms = prefix .. "eāmus"
	data.forms = prefix .. "eātis"
	data.forms = prefix .. "eant"
	
	data.forms = prefix .. "īrem"
	data.forms = prefix .. "īrēs"
	data.forms = prefix .. "īret"
	data.forms = prefix .. "īrēmus"
	data.forms = prefix .. "īrētis"
	data.forms = prefix .. "īrent"
	
	-- Active perfective subjunctive
	data.forms = prefix .. "īssem"
	data.forms = prefix .. "īssēs"
	data.forms = prefix .. "īsset"
	data.forms = prefix .. "īssēmus"
	data.forms = prefix .. "īssētis"
	data.forms = prefix .. "īssent"
	
	-- Passive imperfective subjunctive
	data.forms = prefix .. "ear"
	data.forms = {prefix .. "eāris", prefix .. "eāre"}
	data.forms = prefix .. "eātur"
	data.forms = prefix .. "eāmur"
	data.forms = prefix .. "eāminī"
	data.forms = prefix .. "eantur"
	
	data.forms = prefix .. "īrer"
	data.forms = {prefix .. "īrēris", prefix .. "īrēre"}
	data.forms = prefix .. "īrētur"
	data.forms = prefix .. "īrēmur"
	data.forms = prefix .. "īrēminī"
	data.forms = prefix .. "īrentur"
	
	-- Imperative
	data.forms = prefix .. "ī"
	data.forms = prefix .. "īte"
	
	data.forms = prefix .. "ītō"
	data.forms = prefix .. "ītō"
	data.forms = prefix .. "ītōte"
	data.forms = prefix .. "euntō"
	
	data.forms = prefix .. "īre"
	data.forms = prefix .. "īminī"
	
	data.forms = prefix .. "ītor"
	data.forms = prefix .. "ītor"
	-- no form
	data.forms = prefix .. "euntor"
	
	-- Present infinitives
	data.forms = prefix .. "īre"
	data.forms = prefix .. "īrī"
	
	-- Perfect/future infinitives
	data.forms = prefix .. "īsse"
	
	-- Imperfective participles
	data.forms = prefix .. "iēns"
	data.forms = prefix .. "eundus"
	
	-- Gerund
	data.forms = data.forms
	data.forms = prefix .. "eundī"
	data.forms = prefix .. "eundō"
	data.forms = prefix .. "eundum"
end

irreg_conjugations = function(args, data, typeinfo)
	table.insert(data.title, "] ''iō''-variant")
	table.insert(data.title, "] and ] in the passive")
	table.insert(data.categories, "Latin third conjugation verbs")
	table.insert(data.categories, "Latin irregular verbs")
	table.insert(data.categories, "Latin suppletive verbs")
	
	local prefix = typeinfo.prefix or ""
	
	make_pres_3rd_io(data, prefix .. "fac")
	make_perf(data, prefix .. "fēc")
	make_supine(data, prefix .. "fact")
	
	-- Passive imperfective indicative
	data.forms = prefix .. "fīō"
	data.forms = prefix .. "fīs"
	data.forms = prefix .. "fit"
	data.forms = prefix .. "fīmus"
	data.forms = prefix .. "fītis"
	data.forms = prefix .. "fīunt"
	
	data.forms = prefix .. "fīēbam"
	data.forms = prefix .. "fīēbās"
	data.forms = prefix .. "fīēbat"
	data.forms = prefix .. "fīēbāmus"
	data.forms = prefix .. "fīēbātis"
	data.forms = prefix .. "fīēbant"
	
	data.forms = prefix .. "fīam"
	data.forms = prefix .. "fīēs"
	data.forms = prefix .. "fīet"
	data.forms = prefix .. "fīēmus"
	data.forms = prefix .. "fīētis"
	data.forms = prefix .. "fīent"
	
	-- Passive imperfective subjunctive
	data.forms = prefix .. "fīam"
	data.forms = prefix .. "fīās"
	data.forms = prefix .. "fīat"
	data.forms = prefix .. "fīāmus"
	data.forms = prefix .. "fīātis"
	data.forms = prefix .. "fīant"
	
	data.forms = prefix .. "fierem"
	data.forms = prefix .. "fierēs"
	data.forms = prefix .. "fieret"
	data.forms = prefix .. "fierēmus"
	data.forms = prefix .. "fierētis"
	data.forms = prefix .. "fierent"
	
	-- Active imperative
	data.forms = (prefix == "" and {prefix .. "fac", data.forms} or data.forms)
	
	-- Passive imperative
	data.forms = prefix .. "fī"
	data.forms = prefix .. "fīte"
	
	data.forms = prefix .. "fītō"
	data.forms = prefix .. "fītō"
	data.forms = prefix .. "fītōte"
	data.forms = prefix .. "fīuntō"
	
	-- Present infinitives
	data.forms = prefix .. "fierī"
end

irreg_conjugations = function(args, data, typeinfo)
	table.insert(data.title, "]")
	table.insert(data.title, "]")
	table.insert(data.title, "]")
	table.insert(data.categories, "Latin third conjugation verbs")
	table.insert(data.categories, "Latin irregular verbs")
	table.insert(data.categories, "Latin suppletive verbs")
	
	local prefix_pres = typeinfo.prefix or ""
	local prefix_perf = args; if prefix_perf == "" then prefix_perf = nil end
	local prefix_supine = args; if prefix_supine == "" then prefix_supine = nil end
	
	prefix_perf = prefix_perf or prefix_pres
	prefix_supine = prefix_supine or prefix_pres
	
	make_pres_3rd(data, prefix_pres .. "fer")
	make_perf(data, prefix_perf .. "tul")
	make_supine(data, prefix_supine .. "lāt")
	
	-- Active imperfective indicative
	data.forms = prefix_pres .. "fers"
	data.forms = prefix_pres .. "fert"
	data.forms = prefix_pres .. "fertis"
	
	-- Passive imperfective indicative
	data.forms = prefix_pres .. "fertur"
	
	-- Active imperfective subjunctive
	data.forms = prefix_pres .. "ferrem"
	data.forms = prefix_pres .. "ferrēs"
	data.forms = prefix_pres .. "ferret"
	data.forms = prefix_pres .. "ferrēmus"
	data.forms = prefix_pres .. "ferrētis"
	data.forms = prefix_pres .. "ferrent"

	-- Passive present indicative
	data.forms = {prefix_pres .. "ferris", prefix_pres .. "ferre"}
	
	-- Passive imperfective subjunctive
	data.forms = prefix_pres .. "ferrer"
	data.forms = {prefix_pres .. "ferrēris", prefix_pres .. "ferrēre"}
	data.forms = prefix_pres .. "ferrētur"
	data.forms = prefix_pres .. "ferrēmur"
	data.forms = prefix_pres .. "ferrēminī"
	data.forms = prefix_pres .. "ferrentur"
	
	-- Imperative
	data.forms = prefix_pres .. "fer"
	data.forms = prefix_pres .. "ferte"
	
	data.forms = prefix_pres .. "fertō"
	data.forms = prefix_pres .. "fertō"
	data.forms = prefix_pres .. "fertōte"
	
	data.forms = prefix_pres .. "ferre"

	data.forms = prefix_pres .. "fertor"
	data.forms = prefix_pres .. "fertor"
	
	-- Present infinitives
	data.forms = prefix_pres .. "ferre"
	data.forms = prefix_pres .. "ferrī"
	
	-- Gerund
	data.forms = data.forms
end

irreg_conjugations = function(args, data, typeinfo)
	table.insert(data.title, "] ''iō''-variant")
	table.insert(data.title, "] long ''ī''")
	table.insert(data.title, "] in the supine stem")
	table.insert(data.categories, "Latin third conjugation verbs")
	table.insert(data.categories, "Latin irregular verbs")
	table.insert(data.categories, "Latin suppletive verbs")
	
	local prefix = typeinfo.prefix or ""
	
	typeinfo.subtype = "semi-depon"
	make_pres_3rd(data, prefix .. "fī")
	make_supine(data, prefix .. "fact")
	
	-- Active imperfective indicative
	data.forms = prefix .. "fīs"
	data.forms = prefix .. "fit"
	data.forms = prefix .. "fīmus"
	data.forms = prefix .. "fītis"
	
	-- Active imperfective subjunctive
	data.forms = prefix .. "fierem"
	data.forms = prefix .. "fierēs"
	data.forms = prefix .. "fieret"
	data.forms = prefix .. "fierēmus"
	data.forms = prefix .. "fierētis"
	data.forms = prefix .. "fierent"
	
	-- Imperative
	data.forms = prefix .. "fī"
	data.forms = prefix .. "fīte"
	
	data.forms = prefix .. "fītō"
	data.forms = prefix .. "fītō"
	data.forms = prefix .. "fītōte"
	data.forms = prefix .. "fīuntō"
	
	-- Present infinitives
	data.forms = prefix .. "fierī"
	
	-- Perfect/future infinitives
	data.forms = data.forms
	
	-- Imperfective participles
	data.forms = nil
	data.forms = nil
	
	-- Gerund
	data.forms = data.forms
	data.forms = prefix .. "fiendī"
	data.forms = prefix .. "fiendō"
	data.forms = prefix .. "fiendum"
end

irreg_conjugations = function(args, data, typeinfo)
	table.insert(data.title, "]")
	table.insert(data.title, "highly ]")
	table.insert(data.categories, "Latin irregular verbs")
	table.insert(data.categories, "Latin defective verbs")
	
	prefix = typeinfo.prefix or ""
	
	data.forms = "inquam"
	data.forms = "inquis"
	data.forms = "inquit"
	data.forms = "inquimus"
	data.forms = "inquitis"
	data.forms = "inquiunt"
	
	data.forms = "inquiēs"
	data.forms = "inquiet"
	
	data.forms = "inquiēbat"
	
	data.forms = "inquiī"
	data.forms = "inquistī"
	data.forms = "inquit"
	
	data.forms = "inquiat"
	
	data.forms = "inque"
	data.forms = "inquitō"
	data.forms = "inquitō"
	
	data.forms = "inquiēns"
end

irreg_conjugations = function(args, data, typeinfo)
	table.insert(data.title, "]")
	table.insert(data.title, "mostly ]")
	table.insert(data.categories, "Latin second conjugation verbs")
	table.insert(data.categories, "Latin impersonal verbs")
	
	typeinfo.subtype = "nopass"
	prefix = typeinfo.prefix or ""
	
	-- Active imperfective indicative
	data.forms = prefix .. "libet"
	
	data.forms = prefix .. "libēbat"
	
	data.forms = prefix .. "libēbit"
	
	-- Active perfective indicative
	data.forms = {prefix .. "libuit", "] ]"}
	
	data.forms = {prefix .. "libuerat", "] ]"}
	
	data.forms = {prefix .. "libuerit", "] ]"}
	
	-- Active imperfective subjunctive
	data.forms = prefix .. "libeat"
	
	data.forms = prefix .. "libēret"
	
	-- Active perfective subjunctive
	data.forms = {prefix .. "libuerit", "] ]"}
	
	data.forms = {prefix .. "libuisset", "] ]"}
	data.forms = prefix .. "libuissent"
	
	-- Present infinitives
	data.forms = prefix .. "libēre"
	
	-- Perfect infinitive
	data.forms = {prefix .. "libuisse", "] ]"}
	
	-- Imperfective participles
	data.forms = prefix .. "libēns"
	data.forms = prefix .. "libitum"
end

irreg_conjugations = function(args, data, typeinfo)
	table.insert(data.title, "]")
	table.insert(data.title, "mostly ]")
	table.insert(data.categories, "Latin second conjugation verbs")
	table.insert(data.categories, "Latin impersonal verbs")
	
	typeinfo.subtype = "nopass"
	
	-- Active imperfective indicative
	data.forms = "licet"
	data.forms = "licent"
	
	data.forms = "licēbat"
	data.forms = "licēbant"
	
	data.forms = "licēbit"
	
	-- Active perfective indicative
	data.forms = {"licuit", "] ]"}
	
	data.forms = {"licuerat", "] ]"}
	
	data.forms = {"licuerit", "] ]"}
	
	-- Active imperfective subjunctive
	data.forms = "liceat"
	data.forms = "liceant"
	
	data.forms = "licēret"
	
	-- Perfective subjunctive
	data.forms = {"licuerit", "] ]"}
	
	data.forms = {"licuisset", "] ]"}
	
	-- Imperative
	data.forms = "licētō"
	data.forms = "licētō"
	
	-- Infinitives
	data.forms = "licēre"
	data.forms = {"licuisse", "] ]"}
	data.forms = "] ]"
	
	-- Participles
	data.forms = "licēns"
	data.forms = "licitus"
	data.forms = "licitūrus"
end

irreg_conjugations = function(args, data, typeinfo)
	table.insert(data.title, "]")
	table.insert(data.title, "mostly ]")
	table.insert(data.categories, "Latin second conjugation verbs")
	table.insert(data.categories, "Latin impersonal verbs")
	
	typeinfo.subtype = "nopass"
	
	-- Active imperfective indicative
	data.forms = "lubet"
	
	data.forms = "lubēbat"
	
	data.forms = "lubēbit"
	
	-- Active perfective indicative
	data.forms = {"lubuit", "] ]"}
	
	data.forms = {"lubuerat", "] ]"}
	
	data.forms = {"lubuerit", "] ]"}
	
	-- Active imperfective subjunctive
	data.forms = "libeat"
	
	data.forms = "libēret"
	
	-- Active perfective subjunctive
	data.forms = {"lubuerit", "] ]"}
	
	data.forms = {"lubuisset", "] ]"}
	data.forms = "lubuissent"
	
	-- Present infinitives
	data.forms = "lubēre"
	
	-- Perfect infinitive
	data.forms = {"lubuisse", "] ]"}
	
	-- Imperfective participles
	data.forms = "lubēns"
	data.forms = "lubitum"
end

irreg_conjugations = function(args, data, typeinfo)
	table.insert(data.title, "]")
	table.insert(data.categories, "Latin irregular verbs")
	
	typeinfo.subtype = "nopass"
	typeinfo.subtype = "noimp"
	make_perf(data, "mālu")
	
	-- Active imperfective indicative
	data.forms = "mālō"
	data.forms = "māvīs"
	data.forms = "māvult"
	data.forms = "mālumus"
	data.forms = "māvultis"
	data.forms = "mālunt"
	
	data.forms = "mālēbam"
	data.forms = "mālēbās"
	data.forms = "mālēbat"
	data.forms = "mālēbāmus"
	data.forms = "mālēbātis"
	data.forms = "mālēbant"

	data.forms = "mālam"
	data.forms = "mālēs"
	data.forms = "mālet"
	data.forms = "mālēmus"
	data.forms = "mālētis"
	data.forms = "mālent"
	
	-- Active imperfective subjunctive
	data.forms = "mālim"
	data.forms = "mālīs"
	data.forms = "mālit"
	data.forms = "mālīmus"
	data.forms = "mālītis"
	data.forms = "mālint"
	
	data.forms = "māllem"
	data.forms = "māllēs"
	data.forms = "māllet"
	data.forms = "māllēmus"
	data.forms = "māllētis"
	data.forms = "māllent"
	
	-- Present infinitives
	data.forms = "mālle"
end

irreg_conjugations = function(args, data, typeinfo)
	table.insert(data.title, "]")
	table.insert(data.categories, "Latin irregular verbs")
	
	typeinfo.subtype = "nopass"
	make_perf(data, "nōlu")
	
	-- Active imperfective indicative
	data.forms = "nōlō"
	data.forms = "nōn vīs"
	data.forms = "nōn vult"
	data.forms = "nōlumus"
	data.forms = "nōn vultis"
	data.forms = "nōlunt"
	
	data.forms = "nōlēbam"
	data.forms = "nōlēbās"
	data.forms = "nōlēbat"
	data.forms = "nōlēbāmus"
	data.forms = "nōlēbātis"
	data.forms = "nōlēbant"
	
	data.forms = "nōlam"
	data.forms = "nōlēs"
	data.forms = "nōlet"
	data.forms = "nōlēmus"
	data.forms = "nōlētis"
	data.forms = "nōlent"
	
	-- Active imperfective subjunctive
	data.forms = "nōlim"
	data.forms = "nōlīs"
	data.forms = "nōlit"
	data.forms = "nōlīmus"
	data.forms = "nōlītis"
	data.forms = "nōlint"
	
	data.forms = "nōllem"
	data.forms = "nōllēs"
	data.forms = "nōllet"
	data.forms = "nōllēmus"
	data.forms = "nōllētis"
	data.forms = "nōllent"
	
	-- Imperative
	data.forms = "nōlī"
	data.forms = "nōlīte"
	
	data.forms = "nōlitō"
	data.forms = "nōlitō"
	data.forms = "nōlitōte"
	data.forms = "nōluntō"
	
	-- Present infinitives
	data.forms = "nōlle"
	
	-- Imperfective participles
	data.forms = "nōlēns"
end

irreg_conjugations = function(args, data, typeinfo)
	table.insert(data.title, "highly ]")
	table.insert(data.title, "]")
	table.insert(data.categories, "Latin irregular verbs")
	table.insert(data.categories, "Latin suppletive verbs")
	
	typeinfo.subtype = "nopass"
	make_perf(data, "potu")
	
	-- Active imperfective indicative
	data.forms = "possum"
	data.forms = "potes"
	data.forms = "potest"
	data.forms = "possumus"
	data.forms = "potestis"
	data.forms = "possunt"
	
	data.forms = "poteram"
	data.forms = "poterās"
	data.forms = "poterat"
	data.forms = "poterāmus"
	data.forms = "poterātis"
	data.forms = "poterant"

	data.forms = "poterō"
	data.forms = {"poteris", "potere"}
	data.forms = "poterit"
	data.forms = "poterimus"
	data.forms = "poteritis"
	data.forms = "poterunt"
	
	-- Active imperfective subjunctive
	data.forms = "possim"
	data.forms = "possīs"
	data.forms = "possit"
	data.forms = "possīmus"
	data.forms = "possītis"
	data.forms = "possint"
	
	data.forms = "possem"
	data.forms = "possēs"
	data.forms = "posset"
	data.forms = "possēmus"
	data.forms = "possētis"
	data.forms = "possent"
	
	-- Present infinitives
	data.forms = "posse"
	
	-- Imperfective participles
	data.forms = "potēns"
end

irreg_conjugations = function(args, data, typeinfo)
	table.insert(data.title, "]")
	table.insert(data.title, "]")
	table.insert(data.title, "no ]")
	table.insert(data.categories, "Latin second conjugation verbs")
	table.insert(data.categories, "Latin semi-deponent verbs")
	table.insert(data.categories, "Latin defective verbs")
	
	prefix = typeinfo.prefix or ""
	
	local ppplink = m_links.full_link({lang = lang, term = prefix .. "solitus"}, "term")
	local sumlink = m_links.full_link({lang = lang, term = "sum"}, "term")

	data.forms = prefix .. "soleō"
	data.forms = prefix .. "solēs"
	data.forms = prefix .. "solet"
	data.forms = prefix .. "solēmus"
	data.forms = prefix .. "solētis"
	data.forms = prefix .. "solent"
	
	data.forms = prefix .. "solēbam"
	data.forms = prefix .. "solēbās"
	data.forms = prefix .. "solēbat"
	data.forms = prefix .. "solēbāmus"
	data.forms = prefix .. "solēbātis"
	data.forms = prefix .. "solēbant"
	
	data.forms = ppplink .. " + present active indicative of " .. sumlink
	data.forms = ppplink .. " + imperfect active indicative of " .. sumlink

	data.forms = prefix .. "soleam"
	data.forms = prefix .. "soleās"
	data.forms = prefix .. "soleat"
	data.forms = prefix .. "soleāmus"
	data.forms = prefix .. "soleātis"
	data.forms = prefix .. "soleant"
	
	data.forms = prefix .. "solērem"
	data.forms = prefix .. "solērēs"
	data.forms = prefix .. "solēret"
	data.forms = prefix .. "solērēmus"
	data.forms = prefix .. "solērētis"
	data.forms = prefix .. "solērent"

	data.forms = ppplink .. " + present active subjunctive of " .. sumlink
	data.forms = ppplink .. " + imperfect active subjunctive of " .. sumlink
	
	data.forms = prefix .. "solēre"
	data.forms = "] ]"
	data.forms = prefix .. "solēns"
	data.forms = prefix .. "solitus"
end

irreg_conjugations = function(args, data, typeinfo)
	table.insert(data.title, "highly ]")
	table.insert(data.title, "]")
	table.insert(data.categories, "Latin irregular verbs")
	table.insert(data.categories, "Latin suppletive verbs")
	
	local prefix = typeinfo.prefix or ""
	local prefix_d = args; if prefix_d == "" then prefix_d = nil end
	prefix_d = prefix_d or prefix
	local prefix_f = args; if prefix == "ab" then prefix_f = "ā" elseif prefix_f == "" then prefix_f = nil end
	prefix_f = prefix_f or prefix
	-- The vowel of the prefix is lengthened if it ends in -n and the next word begins with f- or s-.
	local prefix_long = prefix:gsub("(n)$", { = "ān",  = "ēn",  = "īn",  = "ōn",  = "ūn"})
	prefix_f = prefix_f:gsub("(n)$", { = "ān",  = "ēn",  = "īn",  = "ōn",  = "ūn"})
	
	typeinfo.subtype = "nopass"
	make_perf(data, prefix_f .. "fu")
	make_supine(data, prefix_f .. "fut")
	
	-- Active imperfective indicative
	data.forms = prefix_long .. "sum"
	data.forms = prefix_d .. "es"
	data.forms = prefix_d .. "est"
	data.forms = prefix_long .. "sumus"
	data.forms = prefix_d .. "estis"
	data.forms = prefix_long .. "sunt"
	
	data.forms = prefix_d .. "eram"
	data.forms = prefix_d .. "erās"
	data.forms = prefix_d .. "erat"
	data.forms = prefix_d .. "erāmus"
	data.forms = prefix_d .. "erātis"
	data.forms = prefix_d .. "erant"

	data.forms = prefix_d .. "erō"
	data.forms = {prefix_d .. "eris", prefix_d .. "ere"}
	data.forms = prefix_d .. "erit"
	data.forms = prefix_d .. "erimus"
	data.forms = prefix_d .. "eritis"
	data.forms = prefix_d .. "erunt"
	
	-- Active imperfective subjunctive
	data.forms = prefix_long .. "sim"
	data.forms = prefix_long .. "sīs"
	data.forms = prefix_long .. "sit"
	data.forms = prefix_long .. "sīmus"
	data.forms = prefix_long .. "sītis"
	data.forms = prefix_long .. "sint"
	
	data.forms = {prefix_d .. "essem", prefix_f .. "forem"}
	data.forms = {prefix_d .. "essēs", prefix_f .. "forēs"}
	data.forms = {prefix_d .. "esset", prefix_f .. "foret"}
	data.forms = {prefix_d .. "essēmus", prefix_f .. "forēmus"}
	data.forms = {prefix_d .. "essētis", prefix_f .. "forētis"}
	data.forms = {prefix_d .. "essent", prefix_f .. "forent"}
	
	-- Imperative
	data.forms = prefix_d .. "es"
	data.forms = prefix_d .. "este"
	
	data.forms = prefix_d .. "estō"
	data.forms = prefix_d .. "estō"
	data.forms = prefix_d .. "estōte"
	data.forms = prefix_long .. "suntō"
	
	-- Present infinitives
	data.forms = prefix_d .. "esse"
	
	-- Future infinitives
	data.forms = {"] ]", prefix_f .. "fore"}

	-- Imperfective participles
	if prefix == "ab" then
		data.forms = "absēns"
	elseif prefix == "prae" then
		data.forms = "praesēns"
	end
	
	-- Gerund
	data.forms = nil
	data.forms = nil
	data.forms = nil
	data.forms = nil
	
	-- Supine
	data.forms = nil
	data.forms = nil
end

irreg_conjugations = function(args, data, typeinfo)
	table.insert(data.title, "]")
	table.insert(data.categories, "Latin irregular verbs")
	
	local prefix = typeinfo.prefix or ""
	
	typeinfo.subtype = "nopass"
	typeinfo.subtype = "noimp"
	make_perf(data, prefix .. "volu")
	
	-- Active imperfective indicative
	data.forms = prefix .. "volō"
	data.forms = prefix .. "vīs"
	data.forms = prefix ~= "" and prefix .. "vult" or {"vult", "volt"}
	data.forms = prefix .. "volumus"
	data.forms = prefix ~= "" and prefix .. "vultis" or {"vultis", "voltis"}
	data.forms = prefix .. "volunt"
	
	data.forms = prefix .. "volēbam"
	data.forms = prefix .. "volēbās"
	data.forms = prefix .. "volēbat"
	data.forms = prefix .. "volēbāmus"
	data.forms = prefix .. "volēbātis"
	data.forms = prefix .. "volēbant"

	data.forms = prefix .. "volam"
	data.forms = prefix .. "volēs"
	data.forms = prefix .. "volet"
	data.forms = prefix .. "volēmus"
	data.forms = prefix .. "volētis"
	data.forms = prefix .. "volent"
	
	-- Active imperfective subjunctive
	data.forms = prefix .. "velim"
	data.forms = prefix .. "velīs"
	data.forms = prefix .. "velit"
	data.forms = prefix .. "velīmus"
	data.forms = prefix .. "velītis"
	data.forms = prefix .. "velint"
	
	data.forms = prefix .. "vellem"
	data.forms = prefix .. "vellēs"
	data.forms = prefix .. "vellet"
	data.forms = prefix .. "vellēmus"
	data.forms = prefix .. "vellētis"
	data.forms = prefix .. "vellent"
	
	-- Present infinitives
	data.forms = prefix .. "velle"
	
	-- Imperfective participles
	data.forms = prefix .. "volēns"
end


-- Form-generating functions

function make_pres_1st(data, pres_stem)
	if not pres_stem then
		return
	end

	-- Active imperfective indicative
	data.forms = pres_stem .. "ō"
	data.forms = pres_stem .. "ās"
	data.forms = pres_stem .. "at"
	data.forms = pres_stem .. "āmus"
	data.forms = pres_stem .. "ātis"
	data.forms = pres_stem .. "ant"
	
	data.forms = pres_stem .. "ābam"
	data.forms = pres_stem .. "ābās"
	data.forms = pres_stem .. "ābat"
	data.forms = pres_stem .. "ābāmus"
	data.forms = pres_stem .. "ābātis"
	data.forms = pres_stem .. "ābant"
	
	data.forms = pres_stem .. "ābō"
	data.forms = pres_stem .. "ābis"
	data.forms = pres_stem .. "ābit"
	data.forms = pres_stem .. "ābimus"
	data.forms = pres_stem .. "ābitis"
	data.forms = pres_stem .. "ābunt"
	
	-- Passive imperfective indicative
	data.forms = pres_stem .. "or"
	data.forms = {pres_stem .. "āris", pres_stem .. "āre"}
	data.forms = pres_stem .. "ātur"
	data.forms = pres_stem .. "āmur"
	data.forms = pres_stem .. "āminī"
	data.forms = pres_stem .. "antur"
	
	data.forms = pres_stem .. "ābar"
	data.forms = {pres_stem .. "ābāris", pres_stem .. "ābāre"}
	data.forms = pres_stem .. "ābātur"
	data.forms = pres_stem .. "ābāmur"
	data.forms = pres_stem .. "ābāminī"
	data.forms = pres_stem .. "ābantur"
	
	data.forms = pres_stem .. "ābor"
	data.forms = {pres_stem .. "āberis", pres_stem .. "ābere"}
	data.forms = pres_stem .. "ābitur"
	data.forms = pres_stem .. "ābimur"
	data.forms = pres_stem .. "ābiminī"
	data.forms = pres_stem .. "ābuntur"
	
	-- Active imperfective subjunctive
	data.forms = pres_stem .. "em"
	data.forms = pres_stem .. "ēs"
	data.forms = pres_stem .. "et"
	data.forms = pres_stem .. "ēmus"
	data.forms = pres_stem .. "ētis"
	data.forms = pres_stem .. "ent"
	
	data.forms = pres_stem .. "ārem"
	data.forms = pres_stem .. "ārēs"
	data.forms = pres_stem .. "āret"
	data.forms = pres_stem .. "ārēmus"
	data.forms = pres_stem .. "ārētis"
	data.forms = pres_stem .. "ārent"
	
	-- Passive imperfective subjunctive
	data.forms = pres_stem .. "er"
	data.forms = {pres_stem .. "ēris", pres_stem .. "ēre"}
	data.forms = pres_stem .. "ētur"
	data.forms = pres_stem .. "ēmur"
	data.forms = pres_stem .. "ēminī"
	data.forms = pres_stem .. "entur"
	
	data.forms = pres_stem .. "ārer"
	data.forms = {pres_stem .. "ārēris", pres_stem .. "ārēre"}
	data.forms = pres_stem .. "ārētur"
	data.forms = pres_stem .. "ārēmur"
	data.forms = pres_stem .. "ārēminī"
	data.forms = pres_stem .. "ārentur"
	
	-- Imperative
	data.forms = pres_stem .. "ā"
	data.forms = pres_stem .. "āte"
	
	data.forms = pres_stem .. "ātō"
	data.forms = pres_stem .. "ātō"
	data.forms = pres_stem .. "ātōte"
	data.forms = pres_stem .. "antō"
	
	data.forms = pres_stem .. "āre"
	data.forms = pres_stem .. "āminī"
	
	data.forms = pres_stem .. "ātor"
	data.forms = pres_stem .. "ātor"
	-- no form
	data.forms = pres_stem .. "antor"
	
	-- Present infinitives
	data.forms = pres_stem .. "āre"
	data.forms = pres_stem .. "ārī"
	
	-- Imperfective participles
	data.forms = pres_stem .. "āns"
	data.forms = pres_stem .. "andus"
	
	-- Gerund
	data.forms = data.forms
	data.forms = pres_stem .. "andī"
	data.forms = pres_stem .. "andō"
	data.forms = pres_stem .. "andum"
end

function make_pres_2nd(data, pres_stem)
	-- Active imperfective indicative
	data.forms = pres_stem .. "eō"
	data.forms = pres_stem .. "ēs"
	data.forms = pres_stem .. "et"
	data.forms = pres_stem .. "ēmus"
	data.forms = pres_stem .. "ētis"
	data.forms = pres_stem .. "ent"
	
	data.forms = pres_stem .. "ēbam"
	data.forms = pres_stem .. "ēbās"
	data.forms = pres_stem .. "ēbat"
	data.forms = pres_stem .. "ēbāmus"
	data.forms = pres_stem .. "ēbātis"
	data.forms = pres_stem .. "ēbant"
	
	data.forms = pres_stem .. "ēbō"
	data.forms = pres_stem .. "ēbis"
	data.forms = pres_stem .. "ēbit"
	data.forms = pres_stem .. "ēbimus"
	data.forms = pres_stem .. "ēbitis"
	data.forms = pres_stem .. "ēbunt"
	
	-- Passive imperfective indicative
	data.forms = pres_stem .. "eor"
	data.forms = {pres_stem .. "ēris", pres_stem .. "ēre"}
	data.forms = pres_stem .. "ētur"
	data.forms = pres_stem .. "ēmur"
	data.forms = pres_stem .. "ēminī"
	data.forms = pres_stem .. "entur"
	
	data.forms = pres_stem .. "ēbar"
	data.forms = {pres_stem .. "ēbāris", pres_stem .. "ēbāre"}
	data.forms = pres_stem .. "ēbātur"
	data.forms = pres_stem .. "ēbāmur"
	data.forms = pres_stem .. "ēbāminī"
	data.forms = pres_stem .. "ēbantur"
	
	data.forms = pres_stem .. "ēbor"
	data.forms = {pres_stem .. "ēberis", pres_stem .. "ēbere"}
	data.forms = pres_stem .. "ēbitur"
	data.forms = pres_stem .. "ēbimur"
	data.forms = pres_stem .. "ēbiminī"
	data.forms = pres_stem .. "ēbuntur"
	
	-- Active imperfective subjunctive
	data.forms = pres_stem .. "eam"
	data.forms = pres_stem .. "eās"
	data.forms = pres_stem .. "eat"
	data.forms = pres_stem .. "eāmus"
	data.forms = pres_stem .. "eātis"
	data.forms = pres_stem .. "eant"
	
	data.forms = pres_stem .. "ērem"
	data.forms = pres_stem .. "ērēs"
	data.forms = pres_stem .. "ēret"
	data.forms = pres_stem .. "ērēmus"
	data.forms = pres_stem .. "ērētis"
	data.forms = pres_stem .. "ērent"
	
	-- Passive imperfective subjunctive
	data.forms = pres_stem .. "ear"
	data.forms = {pres_stem .. "eāris", pres_stem .. "eāre"}
	data.forms = pres_stem .. "eātur"
	data.forms = pres_stem .. "eāmur"
	data.forms = pres_stem .. "eāminī"
	data.forms = pres_stem .. "eantur"
	
	data.forms = pres_stem .. "ērer"
	data.forms = {pres_stem .. "ērēris", pres_stem .. "ērēre"}
	data.forms = pres_stem .. "ērētur"
	data.forms = pres_stem .. "ērēmur"
	data.forms = pres_stem .. "ērēminī"
	data.forms = pres_stem .. "ērentur"
	
	-- Imperative
	data.forms = pres_stem .. "ē"
	data.forms = pres_stem .. "ēte"
	
	data.forms = pres_stem .. "ētō"
	data.forms = pres_stem .. "ētō"
	data.forms = pres_stem .. "ētōte"
	data.forms = pres_stem .. "entō"
	
	data.forms = pres_stem .. "ēre"
	data.forms = pres_stem .. "ēminī"
	
	data.forms = pres_stem .. "ētor"
	data.forms = pres_stem .. "ētor"
	-- no form
	data.forms = pres_stem .. "entor"
	
	-- Present infinitives
	data.forms = pres_stem .. "ēre"
	data.forms = pres_stem .. "ērī"

	-- Imperfective participles
	data.forms = pres_stem .. "ēns"
	data.forms = pres_stem .. "endus"
	
	-- Gerund
	data.forms = data.forms
	data.forms = pres_stem .. "endī"
	data.forms = pres_stem .. "endō"
	data.forms = pres_stem .. "endum"
end

function make_pres_3rd(data, pres_stem)
	-- Active imperfective indicative
	data.forms = pres_stem .. "ō"
	data.forms = pres_stem .. "is"
	data.forms = pres_stem .. "it"
	data.forms = pres_stem .. "imus"
	data.forms = pres_stem .. "itis"
	data.forms = pres_stem .. "unt"
	
	data.forms = pres_stem .. "ēbam"
	data.forms = pres_stem .. "ēbās"
	data.forms = pres_stem .. "ēbat"
	data.forms = pres_stem .. "ēbāmus"
	data.forms = pres_stem .. "ēbātis"
	data.forms = pres_stem .. "ēbant"
	
	data.forms = pres_stem .. "am"
	data.forms = pres_stem .. "ēs"
	data.forms = pres_stem .. "et"
	data.forms = pres_stem .. "ēmus"
	data.forms = pres_stem .. "ētis"
	data.forms = pres_stem .. "ent"
	
	-- Passive imperfective indicative
	data.forms = pres_stem .. "or"
	data.forms = {pres_stem .. "eris", pres_stem .. "ere"}
	data.forms = pres_stem .. "itur"
	data.forms = pres_stem .. "imur"
	data.forms = pres_stem .. "iminī"
	data.forms = pres_stem .. "untur"
	
	data.forms = pres_stem .. "ēbar"
	data.forms = {pres_stem .. "ēbāris", pres_stem .. "ēbāre"}
	data.forms = pres_stem .. "ēbātur"
	data.forms = pres_stem .. "ēbāmur"
	data.forms = pres_stem .. "ēbāminī"
	data.forms = pres_stem .. "ēbantur"
	
	data.forms = pres_stem .. "ar"
	data.forms = {pres_stem .. "ēris", pres_stem .. "ēre"}
	data.forms = pres_stem .. "ētur"
	data.forms = pres_stem .. "ēmur"
	data.forms = pres_stem .. "ēminī"
	data.forms = pres_stem .. "entur"
	
	-- Active imperfective subjunctive
	data.forms = pres_stem .. "am"
	data.forms = pres_stem .. "ās"
	data.forms = pres_stem .. "at"
	data.forms = pres_stem .. "āmus"
	data.forms = pres_stem .. "ātis"
	data.forms = pres_stem .. "ant"
	
	data.forms = pres_stem .. "erem"
	data.forms = pres_stem .. "erēs"
	data.forms = pres_stem .. "eret"
	data.forms = pres_stem .. "erēmus"
	data.forms = pres_stem .. "erētis"
	data.forms = pres_stem .. "erent"
	
	-- Passive imperfective subjunctive
	data.forms = pres_stem .. "ar"
	data.forms = {pres_stem .. "āris", pres_stem .. "āre"}
	data.forms = pres_stem .. "ātur"
	data.forms = pres_stem .. "āmur"
	data.forms = pres_stem .. "āminī"
	data.forms = pres_stem .. "antur"
	
	data.forms = pres_stem .. "erer"
	data.forms = {pres_stem .. "erēris", pres_stem .. "erēre"}
	data.forms = pres_stem .. "erētur"
	data.forms = pres_stem .. "erēmur"
	data.forms = pres_stem .. "erēminī"
	data.forms = pres_stem .. "erentur"
	
	-- Imperative
	data.forms = pres_stem .. "e"
	data.forms = pres_stem .. "ite"
	
	data.forms = pres_stem .. "itō"
	data.forms = pres_stem .. "itō"
	data.forms = pres_stem .. "itōte"
	data.forms = pres_stem .. "untō"
	
	data.forms = pres_stem .. "ere"
	data.forms = pres_stem .. "iminī"
	
	data.forms = pres_stem .. "itor"
	data.forms = pres_stem .. "itor"
	-- no form
	data.forms = pres_stem .. "untor"
	
	-- Present infinitives
	data.forms = pres_stem .. "ere"
	data.forms = pres_stem .. "ī"
	
	-- Imperfective participles
	data.forms = pres_stem .. "ēns"
	data.forms = pres_stem .. "endus"
	
	-- Gerund
	data.forms = data.forms
	data.forms = pres_stem .. "endī"
	data.forms = pres_stem .. "endō"
	data.forms = pres_stem .. "endum"
end

function make_pres_3rd_io(data, pres_stem)
	-- Active imperfective indicative
	data.forms = pres_stem .. "iō"
	data.forms = pres_stem .. "is"
	data.forms = pres_stem .. "it"
	data.forms = pres_stem .. "imus"
	data.forms = pres_stem .. "itis"
	data.forms = pres_stem .. "iunt"
	
	data.forms = pres_stem .. "iēbam"
	data.forms = pres_stem .. "iēbās"
	data.forms = pres_stem .. "iēbat"
	data.forms = pres_stem .. "iēbāmus"
	data.forms = pres_stem .. "iēbātis"
	data.forms = pres_stem .. "iēbant"
	
	data.forms = pres_stem .. "iam"
	data.forms = pres_stem .. "iēs"
	data.forms = pres_stem .. "iet"
	data.forms = pres_stem .. "iēmus"
	data.forms = pres_stem .. "iētis"
	data.forms = pres_stem .. "ient"
	
	-- Passive imperfective indicative
	data.forms = pres_stem .. "ior"
	data.forms = {pres_stem .. "eris", pres_stem .. "ere"}
	data.forms = pres_stem .. "itur"
	data.forms = pres_stem .. "imur"
	data.forms = pres_stem .. "iminī"
	data.forms = pres_stem .. "iuntur"
	
	data.forms = pres_stem .. "iēbar"
	data.forms = {pres_stem .. "iēbāris", pres_stem .. "iēbāre"}
	data.forms = pres_stem .. "iēbātur"
	data.forms = pres_stem .. "iēbāmur"
	data.forms = pres_stem .. "iēbāminī"
	data.forms = pres_stem .. "iēbantur"
	
	data.forms = pres_stem .. "iar"
	data.forms = {pres_stem .. "iēris", pres_stem .. "iēre"}
	data.forms = pres_stem .. "iētur"
	data.forms = pres_stem .. "iēmur"
	data.forms = pres_stem .. "iēminī"
	data.forms = pres_stem .. "ientur"
	
	-- Active imperfective subjunctive
	data.forms = pres_stem .. "iam"
	data.forms = pres_stem .. "iās"
	data.forms = pres_stem .. "iat"
	data.forms = pres_stem .. "iāmus"
	data.forms = pres_stem .. "iātis"
	data.forms = pres_stem .. "iant"
	
	data.forms = pres_stem .. "erem"
	data.forms = pres_stem .. "erēs"
	data.forms = pres_stem .. "eret"
	data.forms = pres_stem .. "erēmus"
	data.forms = pres_stem .. "erētis"
	data.forms = pres_stem .. "erent"
	
	-- Passive imperfective subjunctive
	data.forms = pres_stem .. "iar"
	data.forms = {pres_stem .. "iāris", pres_stem .. "iāre"}
	data.forms = pres_stem .. "iātur"
	data.forms = pres_stem .. "iāmur"
	data.forms = pres_stem .. "iāminī"
	data.forms = pres_stem .. "iantur"
	
	data.forms = pres_stem .. "erer"
	data.forms = {pres_stem .. "erēris", pres_stem .. "erēre"}
	data.forms = pres_stem .. "erētur"
	data.forms = pres_stem .. "erēmur"
	data.forms = pres_stem .. "erēminī"
	data.forms = pres_stem .. "erentur"
	
	-- Imperative
	data.forms = pres_stem .. "e"
	data.forms = pres_stem .. "ite"
	
	data.forms = pres_stem .. "itō"
	data.forms = pres_stem .. "itō"
	data.forms = pres_stem .. "itōte"
	data.forms = pres_stem .. "iuntō"
	
	data.forms = pres_stem .. "ere"
	data.forms = pres_stem .. "iminī"
	
	data.forms = pres_stem .. "itor"
	data.forms = pres_stem .. "itor"
	-- no form
	data.forms = pres_stem .. "iuntor"
	
	-- Present infinitives
	data.forms = pres_stem .. "ere"
	data.forms = pres_stem .. "ī"
	
	-- Imperfective participles
	data.forms = pres_stem .. "iēns"
	data.forms = pres_stem .. "iendus"
	
	-- Gerund
	data.forms = data.forms
	data.forms = pres_stem .. "iendī"
	data.forms = pres_stem .. "iendō"
	data.forms = pres_stem .. "iendum"
end

function make_pres_4th(data, pres_stem)
	-- Active imperfective indicative
	data.forms = pres_stem .. "iō"
	data.forms = pres_stem .. "īs"
	data.forms = pres_stem .. "it"
	data.forms = pres_stem .. "īmus"
	data.forms = pres_stem .. "ītis"
	data.forms = pres_stem .. "iunt"
	
	data.forms = pres_stem .. "iēbam"
	data.forms = pres_stem .. "iēbās"
	data.forms = pres_stem .. "iēbat"
	data.forms = pres_stem .. "iēbāmus"
	data.forms = pres_stem .. "iēbātis"
	data.forms = pres_stem .. "iēbant"
	
	data.forms = pres_stem .. "iam"
	data.forms = pres_stem .. "iēs"
	data.forms = pres_stem .. "iet"
	data.forms = pres_stem .. "iēmus"
	data.forms = pres_stem .. "iētis"
	data.forms = pres_stem .. "ient"
	
	-- Passive imperfective indicative
	data.forms = pres_stem .. "ior"
	data.forms = {pres_stem .. "īris", pres_stem .. "īre"}
	data.forms = pres_stem .. "ītur"
	data.forms = pres_stem .. "īmur"
	data.forms = pres_stem .. "īminī"
	data.forms = pres_stem .. "iuntur"
	
	data.forms = pres_stem .. "iēbar"
	data.forms = {pres_stem .. "iēbāris", pres_stem .. "iēbāre"}
	data.forms = pres_stem .. "iēbātur"
	data.forms = pres_stem .. "iēbāmur"
	data.forms = pres_stem .. "iēbāminī"
	data.forms = pres_stem .. "iēbantur"
	
	data.forms = pres_stem .. "iar"
	data.forms = {pres_stem .. "iēris", pres_stem .. "iēre"}
	data.forms = pres_stem .. "iētur"
	data.forms = pres_stem .. "iēmur"
	data.forms = pres_stem .. "iēminī"
	data.forms = pres_stem .. "ientur"
	
	-- Active imperfective subjunctive
	data.forms = pres_stem .. "iam"
	data.forms = pres_stem .. "iās"
	data.forms = pres_stem .. "iat"
	data.forms = pres_stem .. "iāmus"
	data.forms = pres_stem .. "iātis"
	data.forms = pres_stem .. "iant"
	
	data.forms = pres_stem .. "īrem"
	data.forms = pres_stem .. "īrēs"
	data.forms = pres_stem .. "īret"
	data.forms = pres_stem .. "īrēmus"
	data.forms = pres_stem .. "īrētis"
	data.forms = pres_stem .. "īrent"
	
	-- Passive imperfective subjunctive
	data.forms = pres_stem .. "iar"
	data.forms = {pres_stem .. "iāris", pres_stem .. "iāre"}
	data.forms = pres_stem .. "iātur"
	data.forms = pres_stem .. "iāmur"
	data.forms = pres_stem .. "iāminī"
	data.forms = pres_stem .. "iantur"
	
	data.forms = pres_stem .. "īrer"
	data.forms = {pres_stem .. "īrēris", pres_stem .. "īrēre"}
	data.forms = pres_stem .. "īrētur"
	data.forms = pres_stem .. "īrēmur"
	data.forms = pres_stem .. "īrēminī"
	data.forms = pres_stem .. "īrentur"
	
	-- Imperative
	data.forms = pres_stem .. "ī"
	data.forms = pres_stem .. "īte"
	
	data.forms = pres_stem .. "ītō"
	data.forms = pres_stem .. "ītō"
	data.forms = pres_stem .. "ītōte"
	data.forms = pres_stem .. "iuntō"
	
	data.forms = pres_stem .. "īre"
	data.forms = pres_stem .. "īminī"
	
	data.forms = pres_stem .. "ītor"
	data.forms = pres_stem .. "ītor"
	-- no form
	data.forms = pres_stem .. "iuntor"
	
	-- Present infinitives
	data.forms = pres_stem .. "īre"
	data.forms = pres_stem .. "īrī"
	
	-- Imperfective participles
	data.forms = pres_stem .. "iēns"
	data.forms = pres_stem .. "iendus"
	
	-- Gerund
	data.forms = data.forms
	data.forms = pres_stem .. "iendī"
	data.forms = pres_stem .. "iendō"
	data.forms = pres_stem .. "iendum"
end

function make_perf(data, perf_stem)
	if not perf_stem then
		return
	end
	
	-- Perfective indicative
	data.forms = perf_stem .. "ī"
	data.forms = perf_stem .. "istī"
	data.forms = perf_stem .. "it"
	data.forms = perf_stem .. "imus"
	data.forms = perf_stem .. "istis"
	data.forms = {perf_stem .. "ērunt", perf_stem .. "ēre"}
	
	data.forms = perf_stem .. "eram"
	data.forms = perf_stem .. "erās"
	data.forms = perf_stem .. "erat"
	data.forms = perf_stem .. "erāmus"
	data.forms = perf_stem .. "erātis"
	data.forms = perf_stem .. "erant"
	
	data.forms = perf_stem .. "erō"
	data.forms = perf_stem .. "eris"
	data.forms = perf_stem .. "erit"
	data.forms = perf_stem .. "erimus"
	data.forms = perf_stem .. "eritis"
	data.forms = perf_stem .. "erint"
	
	-- Perfective subjunctive
	data.forms = perf_stem .. "erim"
	data.forms = perf_stem .. "erīs"
	data.forms = perf_stem .. "erit"
	data.forms = perf_stem .. "erīmus"
	data.forms = perf_stem .. "erītis"
	data.forms = perf_stem .. "erint"
	
	data.forms = perf_stem .. "issem"
	data.forms = perf_stem .. "issēs"
	data.forms = perf_stem .. "isset"
	data.forms = perf_stem .. "issēmus"
	data.forms = perf_stem .. "issētis"
	data.forms = perf_stem .. "issent"
	
	-- Perfect infinitive
	data.forms = perf_stem .. "isse"
end

function make_supine(data, supine_stem)
	if not supine_stem then
		return
	end
	
	-- Perfect/future infinitives
	if reconstructed then
		data.forms = "] ]"
		data.forms = "] ]"
		data.forms = "] ]"
	else
		data.forms = "] ]"
		data.forms = "] ]"
		data.forms = "] ]"
	end
	
	-- Perfect/future participles
	data.forms = supine_stem .. "ūrus"
	data.forms = supine_stem .. "us"
	
	-- Exceptions
	local mortu = {=true,=true,=true,=true,=true,=true,=true,=true,=true,=true,=true}
	local ort = {=true,=true,=true,=true,=true,=true,=true}
	if mortu then
		data.forms = "] ]"
		data.forms = mw.ustring.gsub(supine_stem,"mortu$","moritūrus")
	elseif ort then
		data.forms = "] ]"
		data.forms = mw.ustring.gsub(supine_stem,"ort$","oritūrus")
	elseif supine_stem == "mortu" then
		data.forms = nil
		data.forms = "moritūrus"
	end
	
	-- Supine itself
	data.forms = supine_stem .. "um"
	data.forms = supine_stem .. "ū"
end

-- Functions for generating the inflection table

function show_form(form)
	if not form then
		return "&mdash;"
	end
	
	if type(form) == "table" then
		for key, subform in ipairs(form) do
			if subform == "-" or subform == "—" or subform == "&mdash;" then
				form = "&mdash;"
			elseif reconstructed and not mw.ustring.find(subform, NAMESPACE .. ":Latin/")then
				form = m_links.full_link({lang = lang, term = NAMESPACE .. ":Latin/" .. subform, alt = subform})
			else
				form = m_links.full_link({lang = lang, term = subform})
			end
		end
		
		return table.concat(form, ", ")
	else
		if form == "-" or form == "—" or form == "&mdash;" then
			return "&mdash;"
		elseif reconstructed and not mw.ustring.find(form, NAMESPACE .. ":Latin/") then
			return m_links.full_link({lang = lang, term = NAMESPACE .. ":Latin/" .. form, alt = form})
		else
			return m_links.full_link({lang = lang, term = form})
		end
	end
end

-- Make the table
function make_table(data)
	pagename = mw.title.getCurrentTitle().text
	if reconstructed then
		pagename = mw.ustring.gsub(pagename,"Latin/","")
	end
	return [=[
{| style="width: 100%; background: #EEE; border: 1px solid #AAA; font-size: 95%; text-align: center;" class="inflection-table vsSwitcher vsToggleCategory-inflection"
|-
! colspan="8" class="vsToggleElement" style="background: #CCC; text-align: left;" | &nbsp;&nbsp;&nbsp;Conjugation of ]=] .. m_links.full_link({lang = lang, alt = pagename}, "term") .. (#data.title > 0 and " (" .. table.concat(data.title, ", ") .. ")" or "") .. [=[

]=] .. make_indc_rows(data) .. make_subj_rows(data) .. make_impr_rows(data) .. make_nonfin_rows(data) .. make_vn_rows(data) .. [=[ 

|}]=].. make_footnotes(data) 

end

local tenses = {
	 = "present",
	 = "imperfect",
	 = "future",
	 = "perfect",
	 = "pluperfect",
	 = "future&nbsp;perfect",
}

local voices = {
	 = "active",
	 = "passive",
}

local moods = {
	 = "indicative",
	 = "subjunctive",
	 = "imperative",
}

local nonfins = {
	 = "infinitives",
	 = "participles",
}

local verbalnouns = {
	 = "gerund",
	 = "supine",
}

local cases = {
	 = "nominative",
	 = "genitive",
	 = "dative",
	 = "accusative",
	 = "ablative",
}

function make_indc_rows(data)
	local indc = {}
	
	for _, v in ipairs({"actv", "pasv"}) do
		local group = {}
		local nonempty = false
		
		for _, t in ipairs({"pres", "impf", "futr", "perf", "plup", "futp"}) do
			local row = {}
			local notempty = false
			
			if data.forms then
				row = "\n! colspan=\"6\" style=\"background: #CCC\" |" .. data.forms
				nonempty = true
				notempty = true
			else
				for col, p in ipairs({"1s", "2s", "3s", "1p", "2p", "3p"}) do
					local form = p .. "_" .. t .. "_" .. v .. "_indc"
					row = "\n| " .. show_form(data.forms)..(data.form_footnote_indices==nil and "" or '<sup style="color: red">'..data.form_footnote_indices.."</sup>")
					
					if data.forms then
						nonempty = true
						notempty = true
					end
				end
				
				row = table.concat(row)
			end
			
			if notempty then
				table.insert(group, "\n! style=\"background:#c0cfe4\" | " .. tenses .. row)
			end
		end
		
		if nonempty and #group > 0 then
			table.insert(indc, "\n|- class=\"vsHide\"\n! rowspan=\"" .. tostring(#group) .. "\" style=\"background:#c0cfe4\" | " .. voices .. "\n" .. table.concat(group, "\n|- class=\"vsHide\""))
		end
	end
	
	return
[=[

|- class="vsHide"
! colspan="2" rowspan="2" style="background:#c0cfe4" | indicative
! colspan="3" style="background:#c0cfe4" | ''singular''
! colspan="3" style="background:#c0cfe4" | ''plural''
|- class="vsHide"
! style="background:#c0cfe4;width:12.5%" | ]
! style="background:#c0cfe4;width:12.5%" | ]
! style="background:#c0cfe4;width:12.5%" | ]
! style="background:#c0cfe4;width:12.5%" | ]
! style="background:#c0cfe4;width:12.5%" | ]
! style="background:#c0cfe4;width:12.5%" | ]
]=] .. table.concat(indc)

end

function make_subj_rows(data)
	local subj = {}
	
	for _, v in ipairs({"actv", "pasv"}) do
		local group = {}
		local nonempty = false
		
		for _, t in ipairs({"pres", "impf", "perf", "plup"}) do
			local row = {}
			local notempty = false
			
			if data.forms then
				row = "\n! colspan=\"6\" style=\"background: #CCC\" |" .. data.forms
				nonempty = true
				notempty = true
			else
				for col, p in ipairs({"1s", "2s", "3s", "1p", "2p", "3p"}) do
					local form = p .. "_" .. t .. "_" .. v .. "_subj"
					row = "\n| " .. show_form(data.forms)..(data.form_footnote_indices==nil and "" or '<sup style="color: red">'..data.form_footnote_indices.."</sup>")
					
					if data.forms then
						nonempty = true
						notempty = true
					end
				end
				
				row = table.concat(row)
			end
			
			if notempty then
				table.insert(group, "\n! style=\"background:#c0e4c0\" | " .. tenses .. row)
			end
		end
		
		if nonempty and #group > 0 then
			table.insert(subj, "\n|- class=\"vsHide\"\n! rowspan=\"" .. tostring(#group) .. "\" style=\"background:#c0e4c0\" | " .. voices .. "\n" .. table.concat(group, "\n|- class=\"vsHide\""))
		end
	end
	
	return
[=[

|- class="vsHide"
! colspan="2" rowspan="2" style="background:#c0e4c0" | subjunctive
! colspan="3" style="background:#c0e4c0" | ''singular''
! colspan="3" style="background:#c0e4c0" | ''plural''
|- class="vsHide"
! style="background:#c0e4c0;width:12.5%" | ]
! style="background:#c0e4c0;width:12.5%" | ]
! style="background:#c0e4c0;width:12.5%" | ]
! style="background:#c0e4c0;width:12.5%" | ]
! style="background:#c0e4c0;width:12.5%" | ]
! style="background:#c0e4c0;width:12.5%" | ]
]=] .. table.concat(subj)

end

function make_impr_rows(data)
	local impr = {}
	local has_impr = false

	for _, v in ipairs({"actv", "pasv"}) do
		local group = {}
		local nonempty = false
		
		for _, t in ipairs({"pres", "futr"}) do
			local row = {}
			
			if data.forms then
				row = "\n! colspan=\"6\" style=\"background: #CCC\" |" .. data.forms
				nonempty = true
			else
				for col, p in ipairs({"1s", "2s", "3s", "1p", "2p", "3p"}) do
					row = "\n| " .. show_form(data.forms)
					
					if data.forms then
						nonempty = true
					end
				end
				
				row = table.concat(row)
			end
			
			table.insert(group, "\n! style=\"background:#e4d4c0\" | " .. tenses .. row)
		end
		
		if nonempty and #group > 0 then
			has_impr = true
			table.insert(impr, "\n|- class=\"vsHide\"\n! rowspan=\"" .. tostring(#group) .. "\" style=\"background:#e4d4c0\" | " .. voices .. "\n" .. table.concat(group, "\n|- class=\"vsHide\""))
		end
	end

	if not has_impr then
		return ""
	end
	return
[=[

|- class="vsHide"
! colspan="2" rowspan="2" style="background:#e4d4c0" | imperative
! colspan="3" style="background:#e4d4c0" | ''singular''
! colspan="3" style="background:#e4d4c0" | ''plural''
|- class="vsHide"
! style="background:#e4d4c0;width:12.5%" | ]
! style="background:#e4d4c0;width:12.5%" | ]
! style="background:#e4d4c0;width:12.5%" | ]
! style="background:#e4d4c0;width:12.5%" | ]
! style="background:#e4d4c0;width:12.5%" | ]
! style="background:#e4d4c0;width:12.5%" | ]
]=] .. table.concat(impr)
end

function make_nonfin_rows(data)
	local nonfin = {}
	
	for _, f in ipairs({"inf", "ptc"}) do
		local row = {}
		
		for col, t in ipairs({"pres_actv", "perf_actv", "futr_actv", "pres_pasv", "perf_pasv", "futr_pasv"}) do
			--row = "\n| " .. show_form(data.forms)
			local form = t .. "_" .. f
			row = "\n| " .. show_form(data.forms)..(data.form_footnote_indices==nil and "" or '<sup style="color: red">'..data.form_footnote_indices.."</sup>")
			
		end
		
		row = table.concat(row)
		table.insert(nonfin, "\n|- class=\"vsHide\"\n! style=\"background:#e2e4c0\" colspan=\"2\" | " .. nonfins .. row)
	end
	
	return
[=[

|- class="vsHide"
! colspan="2" rowspan="2" style="background:#e2e4c0" | non-finite forms
! colspan="3" style="background:#e2e4c0" | active
! colspan="3" style="background:#e2e4c0" | passive
|- class="vsHide"
! style="background:#e2e4c0;width:12.5%" | present
! style="background:#e2e4c0;width:12.5%" | perfect
! style="background:#e2e4c0;width:12.5%" | future
! style="background:#e2e4c0;width:12.5%" | present
! style="background:#e2e4c0;width:12.5%" | perfect
! style="background:#e2e4c0;width:12.5%" | future
]=] .. table.concat(nonfin)

end

function make_vn_rows(data)
	local vn = {}
	local has_vn = false
	
	local row = {}
		
	for col, n in ipairs({"ger_nom", "ger_gen", "ger_dat", "ger_acc", "sup_acc", "sup_abl"}) do
		if data.forms then
			has_vn = true
		end
		row = "\n| " .. show_form(data.forms)..(data.form_footnote_indices==nil and "" or '<sup style="color: red">'..data.form_footnote_indices.."</sup>")
	end	
		
	row = table.concat(row)
		
	if has_vn then
		table.insert(vn, "\n|- class=\"vsHide\"" .. row)
	end

	if not has_vn then
		return ""
	end
	return
[=[

|- class="vsHide"
! colspan="2" rowspan="3" style="background:#e0e0b0" | verbal nouns
! colspan="4" style="background:#e0e0b0" | gerund
! colspan="2" style="background:#e0e0b0" | supine
|- class="vsHide"
! style="background:#e0e0b0;width:12.5%" | nominative
! style="background:#e0e0b0;width:12.5%" | genitive
! style="background:#e0e0b0;width:12.5%" | dative/ablative
! style="background:#e0e0b0;width:12.5%" | accusative
! style="background:#e0e0b0;width:12.5%" | accusative
! style="background:#e0e0b0;width:12.5%" | ablative]=] .. table.concat(vn)

end

function make_footnotes(data)
	tbl = {}
	for k,v in pairs(data.footnotes) do
		tbl = '<sup style="color: red">'..tostring(k)..'</sup>'..v..'<br>' end
	return table.concat(tbl)
end

function override(data, args)
	for _, v in ipairs({"actv", "pasv"}) do
		for _, t in ipairs({"pres", "impf", "futr", "perf", "plup", "futp"}) do
			if args then
				data.forms = args and show_form(mw.text.split(args,"/")) or data.forms
			else
				for _, p in ipairs({"1s", "2s", "3s", "1p", "2p", "3p"}) do
					data.forms = args and show_form(mw.text.split(args,"/")) or data.forms
				end
			end
		end
		for _, t in ipairs({"pres", "impf", "perf", "plup"}) do
			if data.forms then
				data.forms = args and show_form(mw.text.split(args,"/")) or data.forms
			else
				for _, p in ipairs({"1s", "2s", "3s", "1p", "2p", "3p"}) do
					data.forms = args and show_form(mw.text.split(args,"/")) or data.forms
				end
			end
		end
		for _, t in ipairs({"pres", "futr"}) do
			if data.forms then
				data.forms = args and show_form(mw.text.split(args,"/")) or data.forms
			else
				for _, p in ipairs({"1s", "2s", "3s", "1p", "2p", "3p"}) do
					data.forms = args and show_form(mw.text.split(args,"/")) or data.forms
				end
			end
		end
	end
	for _, f in ipairs({"inf", "ptc"}) do
		for _, t in ipairs({"pres_actv", "perf_actv", "futr_actv", "pres_pasv", "perf_pasv", "futr_pasv"}) do
			data.forms = args and show_form(mw.text.split(args,"/")) or data.forms
		end
	end
	for _, n in ipairs({"ger_nom", "ger_gen", "ger_dat", "ger_acc", "sup_acc", "sup_abl"}) do
		data.forms = args and show_form(mw.text.split(args,"/")) or data.forms
	end	
end

function checkexist(data)
	if NAMESPACE ~= '' then return end
	local result = {}
	for verb_form,conjugation in pairs(data.forms) do
		if conjugation and type(conjugation) == 'string' and not mw.ustring.find(conjugation," ") then
			title = lang:makeEntryName(conjugation)
			local t = mw.title.new(title)
			if t and not t.exists then
				table.insert(data.categories,'Latin verbs with red links in their conjugation tables')
			end
		end
	end
end

function checkirregular(args,data)
	local apocopic = mw.ustring.sub(args,1,-2)
	apocopic = mw.ustring.gsub(apocopic,'+$','')
	if args and args and not mw.ustring.find(args,'^'..apocopic) then
		table.insert(data.categories,'Latin stem-changing verbs')
	end
end







-- functions for creating external search hyperlinks

function flatten_values(T)
	function noaccents(x)
		return mw.ustring.gsub(mw.ustring.toNFD(x),'+',"")	
	end
	function cleanup(x) 
		return noaccents(string.gsub(string.gsub(string.gsub(x, '%', ''), ' ', '+'))
	end
		local tbl = {}
	for k,v in pairs(T) do
		if type(v) == "table" then 
			local FT = flatten_values(v)
			for K,V in pairs(FT) do
				tbl = cleanup(V)
			end
		else if not (type(v) == "table") then
			if string.find(v, '<') == nil then
				tbl = cleanup(v)
			end
		end end
	end
	return tbl
end

function link_google_books(verb, forms, domain)
	function partition_XS_into_N(XS, N) 
		local count = 0
		local mensae = {}
		for k,v in pairs(XS) do
			if count % N == 0 then mensae = {} end
			count = count + 1
			mensae)+1] = v end
		return mensae end
	function forms_N_to_link(fs, N, args, site)
		return '' end
	function make_links_txt(fs, N, site)
		local args = site == "Books" and "tbm=bks&lr=lang_la" or ""
		local links = {}
		for k,v in pairs(partition_XS_into_N(fs, N)) do
			links = forms_N_to_link(v,k,args,site=="Books" and "" or site) end
		return table.concat(links, ' - ') end
	return "Google "..domain.." forms of "..verb.." : "..make_links_txt(forms, 30, domain)
end

return export