模組:Eu-noun

維基詞典,自由的多語言詞典


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

local export = {}


-- Inflection functions (common nouns)

function export.anim(frame)
	local args = frame:getParent().args
		
	local data = {
		forms = {},
		info = "變格:",
		categories = {},
	}
	
	local ending_text = 0
	
	-- add the lemma form
	local base = mw.title.getCurrentTitle().text
	data.forms["absv|indef"] = {base}
	data.info = data.info .. require("Module:links").full_link({lang = lang, alt = base}, "term") .. " (有生,結尾為 "

	-- add the prolative
	data.forms["pro|indef"] = {base .. "tzat"}
	if	base:sub(-2,-1) == "tz" then
		data.forms["pro|indef"] = {base:sub(1,-3) .. "ztzat"}
	elseif base:sub(-2,-1) == "ts" then
		data.forms["pro|indef"] = {base:sub(1,-3) .. "stzat"}
	elseif base:sub(-2,-1) == "tx" then
		data.forms["pro|indef"] = {base:sub(1,-3) .. "xtzat"}
	elseif base:sub(-1) == "t" then
		data.forms["pro|indef"] = {base .. "-tzat"}
	end
	
	-- epenthetic "e" and "r", ending in vowel/-a
	local e = "e"
	if base:sub(-1) == "a"  then 
		e = ""
		ending_text = 1
	elseif base:sub(-1) == "e" or base:sub(-1) == "i" or base:sub(-1) == "o" or base:sub(-1) == "u" then -- FIXME, this can be written in a cleaner way for sure
		e = ""
		ending_text = 2
	end
	local r = "r"
	if e == "e" then
		r = ""
	end
	
	-- exception for monosyllabic nouns ending in a dipthong
	local e2 = ""
	if args.dip then
		e2 = "e"
	end
	
	-- modifications if the word ends in -r
	if	base:sub(-1) == "r" then
		if args.tap then
			ending_text = 3
		else
			base = base .. 'r' --add an r if the word ends in r
			ending_text = 4
		end
	else
		
	end
	
	-- modifications if the word ends in -a
	local base_pl = base
	if base:sub(-1) == "a" then
		base_pl = base:sub(1,-2)
	end
	
	-- write "ending in ..."
	if ending_text == 0 then
		data.info = data.info .. "輔音)"
	elseif ending_text == 1 then
		data.info = data.info .. require("Module:links").full_link({lang = lang, alt = "-a"}, "term") .. ")"
	elseif ending_text == 2 then
		data.info = data.info .. "元音" .. ")"
	elseif ending_text == 3 then
		data.info = data.info .. "tap " .. require("Module:links").full_link({lang = lang, alt = "-r"}, "term") .. ")"
	elseif ending_text == 4 then
		data.info = data.info .. require("Module:links").full_link({lang = lang, alt = "-r"}, "term") .. ")"
	end
	
	data.forms["absv|s"] = {base_pl .. "a"}
	data.forms["absv|p"] = {base_pl .. "ak"}

	data.forms["erg|indef"] = {base .. e .. "k"}
	data.forms["erg|s"] = {base_pl .. "ak"}
	data.forms["erg|p"] = {base_pl .. "ek"}
	
	data.forms["dat|indef"] = {base .. r .. "i"}
	data.forms["dat|s"] = {base_pl .. "ari"}
	data.forms["dat|p"] = {base_pl .. "ei"}
	
	data.forms["gen|indef"] = {base .. r .. "en"}
	data.forms["gen|s"] = {base_pl .. "aren"}
	data.forms["gen|p"] = {base_pl .. "en"}
	
	data.forms["com|indef"] = {base .. r .. "ekin"}
	data.forms["com|s"] = {base_pl .. "arekin"}
	data.forms["com|p"] = {base_pl .. "ekin"}
	
	data.forms["caus|indef"] = {base .. r .. "engatik"}
	data.forms["caus|s"] = {base_pl .. "arengatik"}
	data.forms["caus|p"] = {base_pl .. "engatik"}
	
	data.forms["ben|indef"] = {base .. r .. "entzat"}
	data.forms["ben|s"] = {base_pl .. "arentzat"}
	data.forms["ben|p"] = {base_pl .. "entzat"}
	
	data.forms["ins|indef"] = {base .. e .. e2 .. "z"}
	data.forms["ins|s"] = {base_pl .. "az"}
	data.forms["ins|p"] = {base_pl .. "ez"}
	
	data.forms["ine|indef"] = {base .. r .. "engan"}
	data.forms["ine|s"] = {base_pl .. "arengan"}
	data.forms["ine|p"] = {base_pl .. "engan"}
	
	data.forms["all|indef"] = {base .. r .. "engana"}
	data.forms["all|s"] = {base_pl .. "arengana"}
	data.forms["all|p"] = {base_pl .. "engana"}
	
	data.forms["ter|indef"] = {base .. r .. "enganaino"}
	data.forms["ter|s"] = {base_pl .. "arenganaino"}
	data.forms["ter|p"] = {base_pl .. "enganaino"}
	
	data.forms["directive|indef"] = {base .. r .. "enganantz"}
	data.forms["directive|s"] = {base_pl .. "arenganantz"}
	data.forms["directive|p"] = {base_pl .. "enganantz"}
	
	data.forms["destinative|indef"] = {base .. r .. "enganako"}
	data.forms["destinative|s"] = {base_pl .. "arenganako"}
	data.forms["destinative|p"] = {base_pl .. "enganako"}
	
	data.forms["abl|indef"] = {base .. r .. "engandik"}
	data.forms["abl|s"] = {base_pl .. "arengandik"}
	data.forms["abl|p"] = {base_pl .. "engandik"}
	
	data.forms["par|indef"] = {base .. r .. "ik"}

	postprocess(args, data)
	
	return make_table(data)
end

function export.inanim(frame)
	local args = frame:getParent().args
		
	local data = {
		forms = {},
		info = "變格:",
		categories = {},
	}
	
	local ending_text = 0
	
	-- add the lemma form
	local base = mw.title.getCurrentTitle().text
	data.forms["absv|indef"] = {base}
	if args.s then
		data.info = data.info .. require("Module:links").full_link({lang = lang, alt = base}, "term") .. " (無生,僅單數,結尾為"
	else
		data.info = data.info .. require("Module:links").full_link({lang = lang, alt = base}, "term") .. " (無生,結尾為"
	end
	-- add the prolative
	data.forms["pro|indef"] = {base .. "tzat"}
	if	base:sub(-2,-1) == "tz" then
		data.forms["pro|indef"] = {base:sub(1,-3) .. "ztzat"}
	elseif base:sub(-2,-1) == "ts" then
		data.forms["pro|indef"] = {base:sub(1,-3) .. "stzat"}
	elseif base:sub(-2,-1) == "tx" then
		data.forms["pro|indef"] = {base:sub(1,-3) .. "xtzat"}
	elseif base:sub(-1) == "t" then
		data.forms["pro|indef"] = {base .. "-tzat"}
	end
	if args.hyph and args.ending == "V" then 
		data.forms["pro|indef"] = {base .. "-tzat"}
	end
	
	-- epenthetic "e" and "r", ending in vowel/-a. The vocalic ending can be forced in acronyms
	local e = "e"
	if base:sub(-1) == "a"  then 
		e = ""
		ending_text = 1
	elseif base:sub(-1) == "e" or base:sub(-1) == "i" or base:sub(-1) == "o" or base:sub(-1) == "u" or args.ending == "V" then -- FIXME, this can be written in a cleaner way for sure
		e = ""
		ending_text = 2
	end
	local r = "r"
	if e == "e" then
		r = ""
	end
	
	-- exception for monosyllabic nouns ending in a dipthong and the word "gau"
	local e2 = ""
	if args.dip then
		e2 = "e"
	end
	local e3 = ""
	if args.gau then
		e3 = "e"
	end
	
	--modifications if a hyphen is needed
	if args.hyph then
		base = base .. "-"
	end
	
	-- modifications if the word ends in -r
	if	base:sub(-1) == "r" then
		if args.tap then
			ending_text = 3
		else
			base = base .. 'r' --add an r if the word ends in r
			ending_text = 4
		end
	else
		
	end
	
	-- modifications if the word ends in -a
	local base_pl = base
	if base:sub(-1) == "a" then
		base_pl = base:sub(1,-2)
	end
	
	-- write "ending in ..."
	if ending_text == 0 then
		data.info = data.info .. "輔音)"
	elseif ending_text == 1 then
		data.info = data.info .. require("Module:links").full_link({lang = lang, alt = "-a"}, "term") .. ")"
	elseif ending_text == 2 then
		data.info = data.info .. "元音" .. ")"
	elseif ending_text == 3 then
		data.info = data.info .. "tap " .. require("Module:links").full_link({lang = lang, alt = "-r"}, "term") .. ")"
	elseif ending_text == 4 then
		data.info = data.info .. require("Module:links").full_link({lang = lang, alt = "-r"}, "term") .. ")"
	end
	
	if not args.s then -- ignore these forms in singular-only nouns
		data.forms["absv|p"] = {base_pl .. "ak"}
		
		data.forms["erg|indef"] = {base .. e .. "k"}
		data.forms["erg|p"] = {base_pl .. "ek"}
	
		data.forms["dat|indef"] = {base .. r .. "i"}
		data.forms["dat|p"] = {base_pl .. "ei"}
	
		data.forms["gen|indef"] = {base .. r .. "en"}
		data.forms["gen|p"] = {base_pl .. "en"}
	
		data.forms["com|indef"] = {base .. r .. "ekin"}
		data.forms["com|p"] = {base_pl .. "ekin"}
	
		data.forms["caus|indef"] = {base .. r .. "engatik"}
		data.forms["caus|p"] = {base_pl .. "engatik"}
	
		data.forms["ben|indef"] = {base .. r .. "entzat"}
		data.forms["ben|p"] = {base_pl .. "entzat"}
	
		data.forms["ins|p"] = {base_pl .. "ez"}
	
		data.forms["ine|indef"] = {base .. e  .. "tan"}
		data.forms["ine|p"] = {base_pl .. "etan"}
	
		data.forms["loc|indef"] = {base .. e .. "tako"}
		data.forms["loc|s"] = {base .. e .. e3 .. "ko"}
		data.forms["loc|p"] = {base_pl .. "etako"}
	
		data.forms["all|indef"] = {base .. e .. "tara"}
		data.forms["all|s"] = {base .. e .. e3 .. "ra"}
		data.forms["all|p"] = {base_pl .. "etara"}
	
		data.forms["ter|indef"] = {base .. e .. "taraino"}
		data.forms["ter|s"] = {base .. e .. e3 .. "raino"}
		data.forms["ter|p"] = {base_pl .. "etaraino"}
	
		data.forms["directive|indef"] = {base .. e .. "tarantz"}
		data.forms["directive|s"] = {base .. e .. e3 .. "rantz"}
		data.forms["directive|p"] = {base_pl .. "etarantz"}
	
		data.forms["destinative|indef"] = {base .. e .. "tarako"}
		data.forms["destinative|s"] = {base .. e .. e3 .. "rako"}
		data.forms["destinative|p"] = {base_pl .. "etarako"}
	
		data.forms["abl|indef"] = {base .. e .. "tatik"}
		data.forms["abl|s"] = {base .. e .. e3 .. "tik"}
		data.forms["abl|p"] = {base_pl .. "etatik"}
	end
	
	data.forms["absv|s"] = {base_pl .. "a"}
	data.forms["erg|s"] = {base_pl .. "ak"}
	data.forms["dat|s"] = {base_pl .. "ari"}
	data.forms["gen|s"] = {base_pl .. "aren"}
	data.forms["com|s"] = {base_pl .. "arekin"}
	data.forms["caus|s"] = {base_pl .. "arengatik"}
	data.forms["ben|s"] = {base_pl .. "arentzat"}
	data.forms["ins|indef"] = {base .. e .. e2 .. e3 .. "z"}
	data.forms["ins|s"] = {base_pl .. "az"}
	data.forms["ine|s"] = {base_pl .. e .. e3 .. "an"}
	data.forms["par|indef"] = {base .. r .. "ik"}

	postprocess(args, data)
	
	return make_table(data)
end

function export.both(frame)
	local args = frame:getParent().args
		
	local data = {
		forms = {},
		info = "變格: ",
		categories = {},
	}
	
	local ending_text = 0
	
	-- add the lemma form
	local base = mw.title.getCurrentTitle().text
	data.forms["absv|indef"] = {base}
	if args.adj then
		data.info = data.info .. require("Module:links").full_link({lang = lang, alt = base}, "term") .. " (形容詞,結尾為 "
	elseif args.num then
		data.info = data.info .. require("Module:links").full_link({lang = lang, alt = base}, "term") .. " (數詞,結尾為 "
	else
		data.info = data.info .. require("Module:links").full_link({lang = lang, alt = base}, "term") .. " (有生及無生,結尾為 "
	end
	-- add the prolative
	data.forms["pro|indef"] = {base .. "tzat"}
	if	base:sub(-2,-1) == "tz" then
		data.forms["pro|indef"] = {base:sub(1,-3) .. "ztzat"}
	elseif base:sub(-2,-1) == "ts" then
		data.forms["pro|indef"] = {base:sub(1,-3) .. "stzat"}
	elseif base:sub(-2,-1) == "tx" then
		data.forms["pro|indef"] = {base:sub(1,-3) .. "xtzat"}
	elseif base:sub(-1) == "t" then
		data.forms["pro|indef"] = {base .. "-tzat"}
	end
	
	-- epenthetic "e" and "r", ending in vowel/-a
	local e = "e"
	if base:sub(-1) == "a"  then 
		e = ""
		ending_text = 1
	elseif base:sub(-1) == "e" or base:sub(-1) == "i" or base:sub(-1) == "o" or base:sub(-1) == "u" then -- FIXME, this can be written in a cleaner way for sure
		e = ""
		ending_text = 2
	end
	local r = "r"
	if e == "e" then
		r = ""
	end
	
	-- exception for monosyllabic nouns ending in a dipthong and the word "gau"
	local e2 = ""
	if args.dip then
		e2 = "e"
	end
	local e3 = ""
	if args.gau then
		e3 = "e"
	end
	
	-- modifications if the word ends in -r
	if	base:sub(-1) == "r" then
		if args.tap then
			ending_text = 3
		else
			base = base .. 'r' --add an r if the word ends in r
			ending_text = 4
		end
	else
		
	end
	
	-- modifications if the word ends in -a
	local base_pl = base
	if base:sub(-1) == "a" then
		base_pl = base:sub(1,-2)
	end
	
	-- write "ending in ..."
	if ending_text == 0 then
		data.info = data.info .. "輔音)"
	elseif ending_text == 1 then
		data.info = data.info .. require("Module:links").full_link({lang = lang, alt = "-a"}, "term") .. ")"
	elseif ending_text == 2 then
		data.info = data.info .. "元音" .. ")"
	elseif ending_text == 3 then
		data.info = data.info .. "tap " .. require("Module:links").full_link({lang = lang, alt = "-r"}, "term") .. ")"
	elseif ending_text == 4 then
		data.info = data.info .. require("Module:links").full_link({lang = lang, alt = "-r"}, "term") .. ")"
	end
	
	data.forms["absv|s"] = {base_pl .. "a"}
	data.forms["absv|p"] = {base_pl .. "ak"}
		
	data.forms["erg|indef"] = {base .. e .. "k"}
	data.forms["erg|s"] = {base_pl .. "ak"}
	data.forms["erg|p"] = {base_pl .. "ek"}
	
	data.forms["dat|indef"] = {base .. r .. "i"}
	data.forms["dat|s"] = {base_pl .. "ari"}
	data.forms["dat|p"] = {base_pl .. "ei"}
	
	data.forms["gen|indef"] = {base .. r .. "en"}
	data.forms["gen|s"] = {base_pl .. "aren"}
	data.forms["gen|p"] = {base_pl .. "en"}
	
	data.forms["com|indef"] = {base .. r .. "ekin"}
	data.forms["com|s"] = {base_pl .. "arekin"}
	data.forms["com|p"] = {base_pl .. "ekin"}
	
	data.forms["caus|indef"] = {base .. r .. "engatik"}
	data.forms["caus|s"] = {base_pl .. "arengatik"}
	data.forms["caus|p"] = {base_pl .. "engatik"}
	
	data.forms["ben|indef"] = {base .. r .. "entzat"}
	data.forms["ben|s"] = {base_pl .. "arentzat"}
	data.forms["ben|p"] = {base_pl .. "entzat"}
	
	data.forms["ins|indef"] = {base .. e .. e2 .. e3 .. "z"}
	data.forms["ins|s"] = {base_pl .. "az"}
	data.forms["ins|p"] = {base_pl .. "ez"}
	
	data.forms["ine|inanimate|indef"] = {base .. e  .. "tan"}
	data.forms["ine|inanimate|s"] = {base_pl .. e .. e3 .. "an"}
	data.forms["ine|inanimate|p"] = {base_pl .. "etan"}
	data.forms["ine|animate|indef"] = {base .. r .. "engan"}
	data.forms["ine|animate|s"] = {base_pl .. "arengan"}
	data.forms["ine|animate|p"] = {base_pl .. "engan"}

	data.forms["loc|inanimate|indef"] = {base .. e .. "tako"}
	data.forms["loc|inanimate|s"] = {base .. e .. e3 .. "ko"}
	data.forms["loc|inanimate|p"] = {base_pl .. "etako"}
	
	data.forms["all|inanimate|indef"] = {base .. e .. "tara"}
	data.forms["all|inanimate|s"] = {base .. e .. e3 .. "ra"}
	data.forms["all|inanimate|p"] = {base_pl .. "etara"}
	data.forms["all|animate|indef"] = {base .. r .. "engana"}
	data.forms["all|animate|s"] = {base_pl .. "arengana"}
	data.forms["all|animate|p"] = {base_pl .. "engana"}

	data.forms["ter|inanimate|indef"] = {base .. e .. "taraino"}
	data.forms["ter|inanimate|s"] = {base .. e .. e3 .. "raino"}
	data.forms["ter|inanimate|p"] = {base_pl .. "etaraino"}
	data.forms["ter|animate|indef"] = {base .. r .. "enganaino"}
	data.forms["ter|animate|s"] = {base_pl .. "arenganaino"}
	data.forms["ter|animate|p"] = {base_pl .. "enganaino"}

	data.forms["directive|inanimate|indef"] = {base .. e .. "tarantz"}
	data.forms["directive|inanimate|s"] = {base .. e .. e3 .. "rantz"}
	data.forms["directive|inanimate|p"] = {base_pl .. "etarantz"}
	data.forms["directive|animate|indef"] = {base .. r .. "enganantz"}
	data.forms["directive|animate|s"] = {base_pl .. "arenganantz"}
	data.forms["directive|animate|p"] = {base_pl .. "enganantz"}

	data.forms["destinative|inanimate|indef"] = {base .. e .. "tarako"}
	data.forms["destinative|inanimate|s"] = {base .. e .. e3 .. "rako"}
	data.forms["destinative|inanimate|p"] = {base_pl .. "etarako"}
	data.forms["destinative|animate|indef"] = {base .. r .. "enganako"}
	data.forms["destinative|animate|s"] = {base_pl .. "arenganako"}
	data.forms["destinative|animate|p"] = {base_pl .. "enganako"}

	data.forms["abl|inanimate|indef"] = {base .. e .. "tatik"}
	data.forms["abl|inanimate|s"] = {base .. e .. e3 .. "tik"}
	data.forms["abl|inanimate|p"] = {base_pl .. "etatik"}
	data.forms["abl|animate|indef"] = {base .. r .. "engandik"}
	data.forms["abl|animate|s"] = {base_pl .. "arengandik"}
	data.forms["abl|animate|p"] = {base_pl .. "engandik"}

	data.forms["par|indef"] = {base .. r .. "ik"}

	postprocess(args, data)
	
	return make_table2(data)
end

-- Inflection functions (proper nouns)
function export.proper_anim(frame)
	local args = frame:getParent().args
		
	local data = {
		forms = {},
		info = "變格: ",
		categories = {},
	}
	
	local ending_text = 0
	
	-- add the lemma form
	local base = mw.title.getCurrentTitle().text
	if args.s then
		data.info = data.info .. require("Module:links").full_link({lang = lang, alt = base}, "term") .. " (有生、帶冠詞,結尾為 "
		base = args[1]
	else
		data.info = data.info .. require("Module:links").full_link({lang = lang, alt = base}, "term") .. " (有生,結尾為 "
	end
	data.forms["absv|indef"] = {base}

	-- add the prolative
	data.forms["pro|indef"] = {base .. "tzat"}
	if	base:sub(-2,-1) == "tz" then
		data.forms["pro|indef"] = {base:sub(1,-3) .. "ztzat"}
	elseif base:sub(-2,-1) == "ts" then
		data.forms["pro|indef"] = {base:sub(1,-3) .. "stzat"}
	elseif base:sub(-2,-1) == "tx" then
		data.forms["pro|indef"] = {base:sub(1,-3) .. "xtzat"}
	elseif base:sub(-1) == "t" then
		data.forms["pro|indef"] = {base .. "-tzat"}
	end
	
	-- epenthetic "e" and "r", ending in vowel/-a
	local e = "e"
	if base:sub(-1) == "a"  then 
		e = ""
		ending_text = 1
	elseif base:sub(-1) == "e" or base:sub(-1) == "i" or base:sub(-1) == "o" or base:sub(-1) == "u" then -- FIXME, this can be written in a cleaner way for sure
		e = ""
		ending_text = 2
	end
	local r = "r"
	if e == "e" then
		r = ""
	end
	
	-- modifications if the word ends in -r
	if	base:sub(-1) == "r" then
		base = base .. "r"
		ending_text = 4
	else
		
	end
	
	-- write "ending in ..."
	if ending_text == 0 then
		data.info = data.info .. "輔音)"
	elseif ending_text == 1 then
		data.info = data.info .. require("Module:links").full_link({lang = lang, alt = "-a"}, "term") .. ")"
	elseif ending_text == 2 then
		data.info = data.info .. "元音" .. ")"
	elseif ending_text == 3 then
		data.info = data.info .. "tap " .. require("Module:links").full_link({lang = lang, alt = "-r"}, "term") .. ")"
	elseif ending_text == 4 then
		data.info = data.info .. require("Module:links").full_link({lang = lang, alt = "-r"}, "term") .. ")"
	end

	if args.s then
		data.forms["absv|s"] = {base .. "a"}
		data.forms["erg|s"]  = {base .. "ak"}
		data.forms["dat|s"]  = {base .. "ari"}
		data.forms["gen|s"]  = {base .. "aren"}
		data.forms["com|s"]  = {base .. "arekin"}
		data.forms["caus|s"] = {base .. "arengatik"}
		data.forms["ben|s"]  = {base .. "arentzat"}
		data.forms["ins|s"]  = {base .. "az"}
		data.forms["ine|s"]  = {base .. "arengan"}
		data.forms["all|s"]  = {base .. "arengana"}
		data.forms["ter|s"]  = {base .. "arenganaino"}
		data.forms["directive|s"] = {base .. "arenganantz"}
		data.forms["destinative|s"] = {base .. "arenganako"}
		data.forms["abl|s"]  = {base .. "arengandik"}
	else
		data.forms["erg|indef"]  = {base .. e .. "k"}
		data.forms["dat|indef"]  = {base .. r .. "i"}
		data.forms["gen|indef"]  = {base .. r .. "en"}
		data.forms["com|indef"]  = {base .. r .. "ekin"}
		data.forms["caus|indef"] = {base .. r .. "engatik"}
		data.forms["ben|indef"]  = {base .. r .. "entzat"}
		data.forms["ins|indef"]  = {base .. e .. "z"}
		data.forms["ine|indef"]  = {base .. r .. "engan"}
		data.forms["all|indef"]  = {base .. r .. "engana"}
		data.forms["ter|indef"]  = {base .. r .. "enganaino"}
		data.forms["directive|indef"] = {base .. r .. "enganantz"}
		data.forms["destinative|indef"] = {base .. r .. "enganako"}
		data.forms["abl|indef"]  = {base .. r .. "engandik"}
	end
	
	data.forms["par|indef"] = {base .. r .. "ik"}

	return make_table(data)
end

function export.proper_inanim(frame)
	local args = frame:getParent().args
		
	local data = {
		forms = {},
		info = "變格: ",
		categories = {},
	}
	
	local ending_text = 0
	
	-- add the lemma form
	local base = mw.title.getCurrentTitle().text
	if args.s then
		data.info = data.info .. require("Module:links").full_link({lang = lang, alt = base}, "term") .. " (無生、帶冠詞,結尾為 "
		base = args[1]
	elseif args.p then
		data.info = data.info .. require("Module:links").full_link({lang = lang, alt = base}, "term") .. " (無生、唯複,結尾為 "
		base = args[1]		
	else
		data.info = data.info .. require("Module:links").full_link({lang = lang, alt = base}, "term") .. " (無生,結尾為 "
	end
	data.forms["absv|indef"] = {base}

	-- add the prolative
	data.forms["pro|indef"] = {base .. "tzat"}
	if	base:sub(-2,-1) == "tz" then
		data.forms["pro|indef"] = {base:sub(1,-3) .. "ztzat"}
	elseif base:sub(-2,-1) == "ts" then
		data.forms["pro|indef"] = {base:sub(1,-3) .. "stzat"}
	elseif base:sub(-2,-1) == "tx" then
		data.forms["pro|indef"] = {base:sub(1,-3) .. "xtzat"}
	elseif base:sub(-1) == "t" then
		data.forms["pro|indef"] = {base .. "-tzat"}
	end
	if args.hyph and args.ending == "V" then 
		data.forms["pro|indef"] = {base .. "-tzat"}
	end
	
	-- epenthetic "e" and "r", ending in vowel/-a. The vocalic ending can be forced in acronyms
	local e = "e"
	if base:sub(-1) == "a"  then 
		e = ""
		ending_text = 1
	elseif base:sub(-1) == "e" or base:sub(-1) == "i" or base:sub(-1) == "o" or base:sub(-1) == "u" or args.ending == "V" then -- FIXME, this can be written in a cleaner way for sure
		e = ""
		ending_text = 2
	end
	local r = "r"
	if e == "e" then
		r = ""
	end
	
	--modifications if a hyphen is needed
	if args.hyph then
		base = base .. "-"
	end
	
	-- modifications if the word ends in -r
	if	base:sub(-1) == "r" then
		if args.tap then
			ending_text = 3
		else
			base = base .. 'r' --add an r if the word ends in r
			ending_text = 4
		end
	else
		
	end
	
	-- modifications if the word ends in -a
	local base_pl = base
	if base:sub(-1) == "a" then
		base_pl = base:sub(1,-2)
	end
	
	-- write "ending in ..."
	if ending_text == 0 then
		data.info = data.info .. "輔音)"
	elseif ending_text == 1 then
		data.info = data.info .. require("Module:links").full_link({lang = lang, alt = "-a"}, "term") .. ")"
	elseif ending_text == 2 then
		data.info = data.info .. "元音" .. ")"
	elseif ending_text == 3 then
		data.info = data.info .. "tap " .. require("Module:links").full_link({lang = lang, alt = "-r"}, "term") .. ")"
	elseif ending_text == 4 then
		data.info = data.info .. require("Module:links").full_link({lang = lang, alt = "-r"}, "term") .. ")"
	end
	
	data.forms["par|indef"] = {base .. r .. "ik"}

	if args.p then
		data.forms["absv|p"] = {base_pl .. "ak"}
		data.forms["erg|p"]  = {base_pl .. "ek"}
		data.forms["dat|p"]  = {base_pl .. "ei"}
		data.forms["gen|p"]  = {base_pl .. "en"}
		data.forms["com|p"]  = {base_pl .. "ekin"}
		data.forms["caus|p"] = {base_pl .. "engatik"}
		data.forms["ben|p"]  = {base_pl .. "entzat"}
		data.forms["ine|p"]  = {base_pl .. "etan"}
		data.forms["ins|p"]  = {base_pl .. "ez"}
		data.forms["loc|p"]  = {base_pl .. "etako"}
		data.forms["all|p"]  = {base_pl .. "etara"}
		data.forms["ter|p"]  = {base_pl .. "etaraino"}
		data.forms["directive|p"] = {base_pl .. "etarantz"}
		data.forms["destinative|p"] = {base_pl .. "etarako"}
		data.forms["abl|p"]  = {base_pl .. "etatik"}
	elseif args.s then
		data.forms["absv|s"] = {base_pl .. "a"}
		data.forms["erg|s"]  = {base_pl .. "ak"}
		data.forms["dat|s"]  = {base_pl .. "ari"}
		data.forms["gen|s"]  = {base_pl .. "aren"}
		data.forms["com|s"]  = {base_pl .. "arekin"}
		data.forms["caus|s"] = {base_pl .. "arengatik"}
		data.forms["ben|s"]  = {base_pl .. "arentzat"}
		data.forms["ins|s"]  = {base_pl .. "az"}
		data.forms["ine|s"]  = {base_pl .. e .. "an"}
		data.forms["loc|s"]  = {base .. e .. "ko"}
		data.forms["all|s"]  = {base .. e .. "ra"}
		data.forms["ter|s"]  = {base .. e .. "raino"}
		data.forms["directive|s"] = {base .. e .. "rantz"}
		data.forms["destinative|s"] = {base .. e .. "rako"}
		data.forms["abl|s"]  = {base .. e .. "tik"}
	else
		data.forms["erg|indef"] = {base .. e .. "k"}
		data.forms["dat|indef"] = {base .. r .. "i"}
		data.forms["gen|indef"] = {base .. r .. "en"}
		data.forms["com|indef"] = {base .. r .. "ekin"}
		data.forms["caus|indef"] = {base .. r .. "engatik"}
		data.forms["ben|indef"] = {base .. r .. "entzat"}
		data.forms["ins|indef"] = {base .. e .. "z"}
		data.forms["ine|indef"] = {base .. e  .. "n"}
		data.forms["loc|indef"] = {base .. e .. "ko"}
		data.forms["all|indef"] = {base .. e .. "ra"}
		data.forms["ter|indef"] = {base .. e .. "raino"}
		data.forms["directive|indef"] = {base .. e .. "rantz"}
		data.forms["destinative|indef"] = {base .. e .. "rako"}
		data.forms["abl|indef"] = {base .. e .. "tik"}
		if	base:sub(-2,-1) == "tz" then
			data.forms["loc|indef"] = {base:sub(1,-3) .. "zko"}
			data.forms["abl|indef"] = {base:sub(1,-3) .. "ztik"}
		elseif base:sub(-1,-1) == "z" or base:sub(-1,-1) == "s" then
			data.forms["loc|indef"] = {base .. "ko"}
			data.forms["abl|indef"] = {base .. "tik"}	
		elseif base:sub(-1,-1) == "r" then
			data.forms["loc|indef"] = {base:sub(1,-2) .. "ko"}
			data.forms["abl|indef"] = {base:sub(1,-2) .. "tik"}
		elseif base:sub(-1,-1) == "n" or base:sub(-1,-1) == "l" then
			data.forms["loc|indef"] = {base .. "go"}
			data.forms["abl|indef"] = {base .. "dik"}	
		end
	end
	
	return make_table(data)
end

function export.proper_both(frame)
	local args = frame:getParent().args
		
	local data = {
		forms = {},
		info = "變格: ",
		categories = {},
	}
	
	local ending_text = 0
	
	-- add the lemma form
	local base = mw.title.getCurrentTitle().text
	if args.s then
		data.info = data.info .. require("Module:links").full_link({lang = lang, alt = base}, "term") .. " (有生及無生、唯單,結尾為 "
		base = args[1]
	elseif args.p then
		data.info = data.info .. require("Module:links").full_link({lang = lang, alt = base}, "term") .. " (有生及無生、唯複,結尾為 "
		base = args[1]		
	else
		data.info = data.info .. require("Module:links").full_link({lang = lang, alt = base}, "term") .. " (有生及無生,結尾為 "
	end
	data.forms["absv|indef"] = {base}

	-- add the prolative
	data.forms["pro|indef"] = {base .. "tzat"}
	if	base:sub(-2,-1) == "tz" then
		data.forms["pro|indef"] = {base:sub(1,-3) .. "ztzat"}
	elseif base:sub(-2,-1) == "ts" then
		data.forms["pro|indef"] = {base:sub(1,-3) .. "stzat"}
	elseif base:sub(-2,-1) == "tx" then
		data.forms["pro|indef"] = {base:sub(1,-3) .. "xtzat"}
	elseif base:sub(-1) == "t" then
		data.forms["pro|indef"] = {base .. "-tzat"}
	end
	if args.hyph and args.ending == "V" then 
		data.forms["pro|indef"] = {base .. "-tzat"}
	end
	
	-- epenthetic "e" and "r", ending in vowel/-a. The vocalic ending can be forced in acronyms
	local e = "e"
	if base:sub(-1) == "a"  then 
		e = ""
		ending_text = 1
	elseif base:sub(-1) == "e" or base:sub(-1) == "i" or base:sub(-1) == "o" or base:sub(-1) == "u" or args.ending == "V" then -- FIXME, this can be written in a cleaner way for sure
		e = ""
		ending_text = 2
	end
	local r = "r"
	if e == "e" then
		r = ""
	end
	
	--modifications if a hyphen is needed
	if args.hyph then
		base = base .. "-"
	end
	
	-- modifications if the word ends in -r
	if	base:sub(-1) == "r" then
		if args.tap then
			ending_text = 3
		else
			base = base .. 'r' --add an r if the word ends in r
			ending_text = 4
		end
	end
	
	-- write "ending in ..."
	if ending_text == 0 then
		data.info = data.info .. "輔音)"
	elseif ending_text == 1 then
		data.info = data.info .. require("Module:links").full_link({lang = lang, alt = "-a"}, "term") .. ")"
	elseif ending_text == 2 then
		data.info = data.info .. "元音" .. ")"
	elseif ending_text == 3 then
		data.info = data.info .. "tap " .. require("Module:links").full_link({lang = lang, alt = "-r"}, "term") .. ")"
	elseif ending_text == 4 then
		data.info = data.info .. require("Module:links").full_link({lang = lang, alt = "-r"}, "term") .. ")"
	end
	
	data.forms["par|indef"] = {base .. r .. "ik"}

	data.forms["erg|indef"] = {base .. e .. "k"}
	data.forms["dat|indef"] = {base .. r .. "i"}
	data.forms["gen|indef"] = {base .. r .. "en"}
	data.forms["com|indef"] = {base .. r .. "ekin"}
	data.forms["caus|indef"] = {base .. r .. "engatik"}
	data.forms["ben|indef"] = {base .. r .. "entzat"}
	data.forms["ins|indef"] = {base .. e .. "z"}
	
	data.forms["ine|inanimate|indef"] = {base .. e  .. "n"}
	data.forms["loc|inanimate|indef"] = {base .. e .. "ko"}
	data.forms["all|inanimate|indef"] = {base .. e .. "ra"}
	data.forms["ter|inanimate|indef"] = {base .. e .. "raino"}
	data.forms["directive|inanimate|indef"] = {base .. e .. "rantz"}
	data.forms["destinative|inanimate|indef"] = {base .. e .. "rako"}
	data.forms["abl|inanimate|indef"] = {base .. e .. "tik"}
	
	data.forms["ine|animate|indef"] = {base .. r .. "engan"}
	data.forms["all|animate|indef"] = {base .. r .. "engana"}
	data.forms["ter|animate|indef"] = {base .. r .. "enganaino"}
	data.forms["directive|animate|indef"] = {base .. r .. "enganantz"}
	data.forms["destinative|animate|indef"] = {base .. r .. "enganako"}
	data.forms["abl|animate|indef"] = {base .. r .. "engandik"}
	
	if	base:sub(-2,-1) == "tz" then
		data.forms["loc|inanimate|indef"] = {base:sub(1,-3) .. "zko"}
		data.forms["abl|inanimate|indef"] = {base:sub(1,-3) .. "ztik"}
	elseif base:sub(-1,-1) == "z" or base:sub(-1,-1) == "s" then
		data.forms["loc|inanimate|indef"] = {base .. "ko"}
		data.forms["abl|inanimate|indef"] = {base .. "tik"}	
	elseif base:sub(-1,-1) == "r" then
		data.forms["loc|inanimate|indef"] = {base:sub(1,-2) .. "ko"}
		data.forms["abl|inanimate|indef"] = {base:sub(1,-2) .. "tik"}
	elseif base:sub(-1,-1) == "n" or base:sub(-1,-1) == "l" then
		data.forms["loc|inanimate|indef"] = {base .. "go"}
		data.forms["abl|inanimate|indef"] = {base .. "dik"}
	end
	
	return make_table2(data)
end

function postprocess(args, data)
	data.lemma = data.forms["absv|indef"][1]
	
	-- Check if the lemma form matches the page name
	if lang:makeEntryName(data.lemma) ~= mw.title.getCurrentTitle().text then
		table.insert(data.categories, lang:getCanonicalName() .. " entries with inflection not matching pagename")
	end
end

-- Make the table
function make_table(data)
	local function repl(param)
		local accel = true
		local no_store = false
		
		if param == "info" then
			return mw.getContentLanguage():ucfirst(data.info or "")
		elseif string.sub(param, 1, 1) == "!" then
			no_store = true
			param = string.sub(param, 2)
		elseif string.sub(param, 1, 1) == "#" then
			accel = false
			param = string.sub(param, 2)
		end
		
		local forms = data.forms[param]
		
		if not forms then
			return "—"
		end
		
		local ret = {}
		
		for key, subform in ipairs(forms) do
			table.insert(ret, require("Module:links").full_link({lang = lang, term = subform, accel = accel and {form = param, lemma = data.lemma, no_store = no_store} or nil}))
		end
		
		return table.concat(ret, "<br/>")
	end
	
	local wikicode = [=[
{| class="inflection-table vsSwitcher" data-toggle-category="inflection" style="border: solid 1px #CCCCFF;" cellspacing="1" cellpadding="2"
|- style="background: #d9ebff; text-align: left;"
! class="vsToggleElement" colspan="4" | {{{info}}}
|- class="vsHide"
! style="background: #d9ebff; width: 11em;" |
! style="background: #d9ebff; width: 12em;" | 不定
! style="background: #d9ebff; width: 12em;" | 單數
! style="background: #d9ebff; width: 12em;" | 複數
|- class="vsHide" style="background: #F9F9F9;"
! style="background: #eff7ff;" | 通格
| data-accel-col="1" | {{{absv|indef}}}
| data-accel-col="2" | {{{absv|s}}}
| data-accel-col="3" | {{{absv|p}}}
|- class="vsHide" style="background: #F9F9F9;"
! style="background: #eff7ff;" | 作格
| data-accel-col="1" | {{{erg|indef}}}
| data-accel-col="2" | {{{erg|s}}}
| data-accel-col="3" | {{{erg|p}}}
|- class="vsHide" style="background: #F9F9F9;"
! style="background: #eff7ff;" | 與格
| data-accel-col="1" | {{{dat|indef}}}
| data-accel-col="2" | {{{dat|s}}}
| data-accel-col="3" | {{{dat|p}}}
|- class="vsHide" style="background: #F9F9F9;"
! style="background: #eff7ff;" | 屬格
| data-accel-col="1" | {{{gen|indef}}}
| data-accel-col="2" | {{{gen|s}}}
| data-accel-col="3" | {{{gen|p}}}
|- class="vsHide" style="background: #F9F9F9;"
! style="background: #eff7ff;" | 共格
| data-accel-col="1" | {{{com|indef}}}
| data-accel-col="2" | {{{com|s}}}
| data-accel-col="3" | {{{com|p}}}
|- class="vsHide" style="background: #F9F9F9;"
! style="background: #eff7ff;" | 使役格
| data-accel-col="1" | {{{caus|indef}}}
| data-accel-col="2" | {{{caus|s}}}
| data-accel-col="3" | {{{caus|p}}}
|- class="vsHide" style="background: #F9F9F9;"
! style="background: #eff7ff;" | 受益格
| data-accel-col="1" | {{{ben|indef}}}
| data-accel-col="2" | {{{ben|s}}}
| data-accel-col="3" | {{{ben|p}}}
|- class="vsHide" style="background: #F9F9F9;"
! style="background: #eff7ff;" | 工具格
| data-accel-col="1" | {{{ins|indef}}}
| data-accel-col="2" | {{{ins|s}}}
| data-accel-col="3" | {{{ins|p}}}
|- class="vsHide" style="background: #F9F9F9;"
! style="background: #eff7ff;" | 內格
| data-accel-col="1" | {{{ine|indef}}}
| data-accel-col="2" | {{{ine|s}}}
| data-accel-col="3" | {{{ine|p}}}
|- class="vsHide" style="background: #F9F9F9;"
! style="background: #eff7ff;" | 方位格
| data-accel-col="1" | {{{loc|indef}}}
| data-accel-col="2" | {{{loc|s}}}
| data-accel-col="3" | {{{loc|p}}}
|- class="vsHide" style="background: #F9F9F9;"
! style="background: #eff7ff;" | 向格
| data-accel-col="1" | {{{all|indef}}}
| data-accel-col="2" | {{{all|s}}}
| data-accel-col="3" | {{{all|p}}}
|- class="vsHide" style="background: #F9F9F9;"
! style="background: #eff7ff;" | 到格
| data-accel-col="1" | {{{ter|indef}}}
| data-accel-col="2" | {{{ter|s}}}
| data-accel-col="3" | {{{ter|p}}}
|- class="vsHide" style="background: #F9F9F9;"
! style="background: #eff7ff;" | directive
| data-accel-col="1" | {{{directive|indef}}}
| data-accel-col="2" | {{{directive|s}}}
| data-accel-col="3" | {{{directive|p}}}
|- class="vsHide" style="background: #F9F9F9;"
! style="background: #eff7ff;" | destinative
| data-accel-col="1" | {{{destinative|indef}}}
| data-accel-col="2" | {{{destinative|s}}}
| data-accel-col="3" | {{{destinative|p}}}
|- class="vsHide" style="background: #F9F9F9;"
! style="background: #eff7ff;" | 奪格
| data-accel-col="1" | {{{abl|indef}}}
| data-accel-col="2" | {{{abl|s}}}
| data-accel-col="3" | {{{abl|p}}}
|- class="vsHide" style="background: #F9F9F9;"
! style="background: #eff7ff;" | 部分格
| data-accel-col="1" | {{{par|indef}}}
| data-accel-col="2" | {{{par|s}}}
| data-accel-col="3" | {{{par|p}}}
|- class="vsHide" style="background: #F9F9F9;"
! style="background: #eff7ff;" | 延展格
| data-accel-col="1" | {{{pro|indef}}}
| data-accel-col="2" | {{{pro|s}}}
| data-accel-col="3" | {{{pro|p}}}
|}]=]

	return mw.ustring.gsub(wikicode, "{{{[#!]?([a-z0-9|]+)}}}", repl) .. require("Module:utilities").format_categories(data.categories, lang)
end

function make_table2(data)
	local function repl(param)
		local accel = true
		local no_store = false
		
		if param == "info" then
			return mw.getContentLanguage():ucfirst(data.info or "")
		elseif string.sub(param, 1, 1) == "!" then
			no_store = true
			param = string.sub(param, 2)
		elseif string.sub(param, 1, 1) == "#" then
			accel = false
			param = string.sub(param, 2)
		end
		
		local forms = data.forms[param]
		
		if not forms then
			return "&mdash;"
		end
		
		local ret = {}
		
		for key, subform in ipairs(forms) do
			table.insert(ret, require("Module:links").full_link({lang = lang, term = subform, accel = accel and {form = param, lemma = data.lemma, no_store = no_store} or nil}))
		end
		
		return table.concat(ret, "<br/>")
	end
	
	local wikicode = [=[
{| class="inflection-table vsSwitcher" data-toggle-category="inflection" style="border: solid 1px #CCCCFF;" cellspacing="1" cellpadding="2"
|- style="background: #d9ebff; text-align: left;"
! class="vsToggleElement" colspan="5" | {{{info}}}
|- class="vsHide"
! style="background: #d9ebff; width: 11em;" colspan="2"|
! style="background: #d9ebff; width: 12em;" | 定形
! style="background: #d9ebff; width: 12em;" | 單數
! style="background: #d9ebff; width: 12em;" | 複數
|- class="vsHide" style="background: #F9F9F9;"
! style="background: #eff7ff;" colspan="2"| 通格
| data-accel-col="1" | {{{absv|indef}}}
| data-accel-col="2" | {{{absv|s}}}
| data-accel-col="3" | {{{absv|p}}}
|- class="vsHide" style="background: #F9F9F9;"
! style="background: #eff7ff;" colspan="2"| 作格
| data-accel-col="1" | {{{erg|indef}}}
| data-accel-col="2" | {{{erg|s}}}
| data-accel-col="3" | {{{erg|p}}}
|- class="vsHide" style="background: #F9F9F9;"
! style="background: #eff7ff;" colspan="2"| 與格
| data-accel-col="1" | {{{dat|indef}}}
| data-accel-col="2" | {{{dat|s}}}
| data-accel-col="3" | {{{dat|p}}}
|- class="vsHide" style="background: #F9F9F9;"
! style="background: #eff7ff;" colspan="2"| 屬格
| data-accel-col="1" | {{{gen|indef}}}
| data-accel-col="2" | {{{gen|s}}}
| data-accel-col="3" | {{{gen|p}}}
|- class="vsHide" style="background: #F9F9F9;"
! style="background: #eff7ff;" colspan="2"| 共格
| data-accel-col="1" | {{{com|indef}}}
| data-accel-col="2" | {{{com|s}}}
| data-accel-col="3" | {{{com|p}}}
|- class="vsHide" style="background: #F9F9F9;"
! style="background: #eff7ff;" colspan="2"| 使役格
| data-accel-col="1" | {{{caus|indef}}}
| data-accel-col="2" | {{{caus|s}}}
| data-accel-col="3" | {{{caus|p}}}
|- class="vsHide" style="background: #F9F9F9;"
! style="background: #eff7ff;" colspan="2"| 受益格
| data-accel-col="1" | {{{ben|indef}}}
| data-accel-col="2" | {{{ben|s}}}
| data-accel-col="3" | {{{ben|p}}}
|- class="vsHide" style="background: #F9F9F9;"
! style="background: #eff7ff;" colspan="2"| 工具格
| data-accel-col="1" | {{{ins|indef}}}
| data-accel-col="2" | {{{ins|s}}}
| data-accel-col="3" | {{{ins|p}}}
|- class="vsHide" style="background: #F9F9F9;"
! style="background: #eff7ff;" rowspan="2"| 內格
! style="background: #eff7ff;" | 有生
| data-accel-col="1" | {{{ine|animate|indef}}}
| data-accel-col="2" | {{{ine|animate|s}}}
| data-accel-col="3" | {{{ine|animate|p}}}
|- class="vsHide" style="background: #F9F9F9;"
! style="background: #eff7ff;" | 無生
| data-accel-col="1" | {{{ine|inanimate|indef}}}
| data-accel-col="2" | {{{ine|inanimate|s}}}
| data-accel-col="3" | {{{ine|inanimate|p}}}
|- class="vsHide" style="background: #F9F9F9;"
! style="background: #eff7ff;" rowspan="2"| 方位格
! style="background: #eff7ff;" | 有生
| data-accel-col="1" | {{{loc|animate|indef}}}
| data-accel-col="2" | {{{loc|animate|s}}}
| data-accel-col="3" | {{{loc|animate|p}}}
|- class="vsHide" style="background: #F9F9F9;"
! style="background: #eff7ff;" | 無生
| data-accel-col="1" | {{{loc|inanimate|indef}}}
| data-accel-col="2" | {{{loc|inanimate|s}}}
| data-accel-col="3" | {{{loc|inanimate|p}}}
|- class="vsHide" style="background: #F9F9F9;"
! style="background: #eff7ff;" rowspan="2"| 向格
! style="background: #eff7ff;" | 有生
| data-accel-col="1" | {{{all|animate|indef}}}
| data-accel-col="2" | {{{all|animate|s}}}
| data-accel-col="3" | {{{all|animate|p}}}
|- class="vsHide" style="background: #F9F9F9;"
! style="background: #eff7ff;" | 無生
| data-accel-col="1" | {{{all|inanimate|indef}}}
| data-accel-col="2" | {{{all|inanimate|s}}}
| data-accel-col="3" | {{{all|inanimate|p}}}
|- class="vsHide" style="background: #F9F9F9;"
! style="background: #eff7ff;" rowspan="2"| 到格
! style="background: #eff7ff;" | 有生
| data-accel-col="1" | {{{ter|animate|indef}}}
| data-accel-col="2" | {{{ter|animate|s}}}
| data-accel-col="3" | {{{ter|animate|p}}}
|- class="vsHide" style="background: #F9F9F9;"
! style="background: #eff7ff;" | 無生
| data-accel-col="1" | {{{ter|inanimate|indef}}}
| data-accel-col="2" | {{{ter|inanimate|s}}}
| data-accel-col="3" | {{{ter|inanimate|p}}}
|- class="vsHide" style="background: #F9F9F9;"
! style="background: #eff7ff;" rowspan="2"| directive
! style="background: #eff7ff;" | 有生
| data-accel-col="1" | {{{directive|animate|indef}}}
| data-accel-col="2" | {{{directive|animate|s}}}
| data-accel-col="3" | {{{directive|animate|p}}}
|- class="vsHide" style="background: #F9F9F9;"
! style="background: #eff7ff;" | 無生
| data-accel-col="1" | {{{directive|inanimate|indef}}}
| data-accel-col="2" | {{{directive|inanimate|s}}}
| data-accel-col="3" | {{{directive|inanimate|p}}}
|- class="vsHide" style="background: #F9F9F9;"
! style="background: #eff7ff;" rowspan="2"| destinative
! style="background: #eff7ff;" | 有生
| data-accel-col="1" | {{{destinative|animate|indef}}}
| data-accel-col="2" | {{{destinative|animate|s}}}
| data-accel-col="3" | {{{destinative|animate|p}}}
|- class="vsHide" style="background: #F9F9F9;"
! style="background: #eff7ff;" | 無生
| data-accel-col="1" | {{{destinative|inanimate|indef}}}
| data-accel-col="2" | {{{destinative|inanimate|s}}}
| data-accel-col="3" | {{{destinative|inanimate|p}}}
|- class="vsHide" style="background: #F9F9F9;"
! style="background: #eff7ff;" rowspan="2"| 奪格
! style="background: #eff7ff;" | 有生
| data-accel-col="1" | {{{abl|animate|indef}}}
| data-accel-col="2" | {{{abl|animate|s}}}
| data-accel-col="3" | {{{abl|animate|p}}}
|- class="vsHide" style="background: #F9F9F9;"
! style="background: #eff7ff;" | 無生
| data-accel-col="1" | {{{abl|inanimate|indef}}}
| data-accel-col="2" | {{{abl|inanimate|s}}}
| data-accel-col="3" | {{{abl|inanimate|p}}}
|- class="vsHide" style="background: #F9F9F9;"
! style="background: #eff7ff;" colspan="2"| 部分格
| data-accel-col="1" | {{{par|indef}}}
| data-accel-col="2" | {{{par|s}}}
| data-accel-col="3" | {{{par|p}}}
|- class="vsHide" style="background: #F9F9F9;"
! style="background: #eff7ff;" colspan="2"| 延展格
| data-accel-col="1" | {{{pro|indef}}}
| data-accel-col="2" | {{{pro|s}}}
| data-accel-col="3" | {{{pro|p}}}
|}]=]

	return mw.ustring.gsub(wikicode, "{{{[#!]?([a-z0-9|]+)}}}", repl) .. require("Module:utilities").format_categories(data.categories, lang)
end

return export