Module:pollasena-roots/templates

From Linguifex
Jump to navigation Jump to search



local m_pr = require("Module:pollasena-roots")

local export = {}

local function concat_etymologies(args, etymologies)
	local capital = args.nocap and "f" or "F"
	return capital .. "rom " .. table.concat(etymologies, ", from ") .. "."	
end

function export.qsc(frame)
	local parent_args = frame:getParent().args
	
	local ancestor_codes = {
		{ code = "sekh", options = {} },
		{ code = "wasc", options = {optional = true, roots = true } }
	}
	
	local evolution, args, categories = m_pr.parse_args(parent_args, "qsc", ancestor_codes)
	
	return concat_etymologies(args, evolution) .. categories
end

function export.lyti_inh(frame)
	local parent_args = frame:getParent().args
	
	local ancestor_codes = {
		{ code = "lyti-mid", options = {} },
		{ code = "lyti-old", options = {} },
		{ code = "cel-pro", options = {annotated = true} },
		{ code = "ine-pro", options = {roots = true} },
	}
	
	local evolution, args, categories = m_pr.parse_args(parent_args, "lyti", ancestor_codes)
	
	return concat_etymologies(args, evolution) .. categories
end

--[[
oltic (lyti) [< middle oltic (lyti-mid) < old oltic (lyti-old)] < proto-celtic (cel-pro)
]]

function export.lyti_loan(frame)
	local parent_args = frame:getParent().args
	local source_code = parent_args.source or "und"
	
	local ancestor_codes = {
		{ code = "lyti-mid", options = {optional = not parent_args.mid} },
		{ code = "lyti-old", options = {optional = not parent_args.old} },
		{ code = source_code, options = {} },
	}
	
	local extra_params = {
		mid = {type = "boolean"},
		old = {type = "boolean"},
		source = {},
	}
	
	local evolution, args, categories = m_pr.parse_args(parent_args, "lyti", ancestor_codes)
	
	return concat_etymologies(args, evolution) .. categories
end

function export.gwax_wasc(frame)
	local parent_args = frame:getParent().args
	
	local ancestor_codes = {
		{ code = "wasc", options = {roots = true } }
	}
	
	local evolution, args, categories = m_pr.parse_args(parent_args, "gwax", ancestor_codes)
	
	return concat_etymologies(args, evolution) .. categories
end

function export.guim(frame)
	local parent_args = frame:getParent().args
	
	local ancestor_codes = {
		{ code = "ine-pro", options = { roots = true } }
	}
	
	local evolution, args, categories = m_pr.parse_args(parent_args, "guim", ancestor_codes)
	
	return concat_etymologies(args, evolution) .. categories
end

function export.sekh(frame)
	local parent_args = frame:getParent().args
	
	local ancestor_codes = {
		{ code = "wasc", options = {optional = true, roots = true } }
	}
	
	local evolution, args, categories = m_pr.parse_args(parent_args, "sekh", ancestor_codes)
	
	return concat_etymologies(args, evolution) .. categories
end

function export.hzlc(frame)
	local parent_args = frame:getParent().args
	
	local ancestor_codes = {
		{ code = "wasc", options = {optional = true, roots = true } }
	}
	
	local evolution, args, categories = m_pr.parse_args(parent_args, "hzlc", ancestor_codes)
	
	return concat_etymologies(args, evolution) .. categories
end

function export.soky(frame)
	local parent_args = frame:getParent().args
	
	local ancestor_codes = {
		{ code = "qsc", options = {} },
		{ code = "sekh", options = {} },
		{ code = "wasc", options = {optional = true, roots = true } }
	}
	
	local evolution, args, categories = m_pr.parse_args(parent_args, "soky", ancestor_codes)
	
	return concat_etymologies(args, evolution) .. categories
end

function export.azms(frame)
	local parent_args = frame:getParent().args
	
	local ancestor_codes = {
		{ code = "azms-old", options = {optional = true} },
		{ code = "arto-pro", options = {} },
		{ code = "mish-pro", options = {} },
		{ code = "ine-pro", options = {optional = true, roots = true } }
	}
	
	local evolution, args, categories = m_pr.parse_args(parent_args, "azms", ancestor_codes)
	
	return concat_etymologies(args, evolution) .. categories
end

return export