Module:pollasena-roots/templates

From Linguifex
Jump to navigation Jump to search

export.qsc

function export.qsc(frame)

This function lacks documentation. Please add a description of its usages, inputs and outputs, or its difference from similar functions, or make it local to remove it from the function list.

export.lyti_inh

function export.lyti_inh(frame)

This function lacks documentation. Please add a description of its usages, inputs and outputs, or its difference from similar functions, or make it local to remove it from the function list.

export.lyti_loan

function export.lyti_loan(frame)

This function lacks documentation. Please add a description of its usages, inputs and outputs, or its difference from similar functions, or make it local to remove it from the function list.

export.gwax_wasc

function export.gwax_wasc(frame)

This function lacks documentation. Please add a description of its usages, inputs and outputs, or its difference from similar functions, or make it local to remove it from the function list.

export.gwax_nen

function export.gwax_nen(frame)

This function lacks documentation. Please add a description of its usages, inputs and outputs, or its difference from similar functions, or make it local to remove it from the function list.

export.guim

function export.guim(frame)

This function lacks documentation. Please add a description of its usages, inputs and outputs, or its difference from similar functions, or make it local to remove it from the function list.

export.sekh

function export.sekh(frame)

This function lacks documentation. Please add a description of its usages, inputs and outputs, or its difference from similar functions, or make it local to remove it from the function list.

export.hzlc

function export.hzlc(frame)

This function lacks documentation. Please add a description of its usages, inputs and outputs, or its difference from similar functions, or make it local to remove it from the function list.

export.soky

function export.soky(frame)

This function lacks documentation. Please add a description of its usages, inputs and outputs, or its difference from similar functions, or make it local to remove it from the function list.

export.azms

function export.azms(frame)

This function lacks documentation. Please add a description of its usages, inputs and outputs, or its difference from similar functions, or make it local to remove it from the function list.

export.snon

function export.snon(frame)

This function lacks documentation. Please add a description of its usages, inputs and outputs, or its difference from similar functions, or make it local to remove it from the function list.


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

local gsub = mw.ustring.gsub

local export = {}

local function concat_etymologies(args, etymologies)
	local str = table.concat(etymologies, ", ") .. "."
	
	if not args.nocap then
		str = str:gsub("^.", mw.ustring.upper)
	end
	
	return str
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

function export.lyti_loan(frame)
	local parent_args = frame:getParent().args
	parent_args.borrowing = true
	local source_code = parent_args[1] or "und"
	
	local extra_params = {
		mid = {type = "boolean"},
		old = {type = "boolean"},
	}
	
	local ancestor_codes = {
		{code = source_code, options = {borrowed = true}},
	}
	
	if parent_args.mid or parent_args.old then
		table.insert(ancestor_codes, 1, {code = "lyti-mid", options = {optional = not parent_args.mid}})
		if parent_args.old then
			table.insert(ancestor_codes, parent_args.mid and 2 or 1, {code = "lyti-old", options = {optional = not parent_args.old}})
		end
	end
	
	local evolution, args, categories = m_pr.parse_args(parent_args, "lyti", ancestor_codes, extra_params)
	
	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.gwax_nen(frame)
	local parent_args = frame:getParent().args
	parent_args.nocat = true -- no custom categories for Nentammmi
	
	local ancestor_codes = {
		{code = "nent-pro", 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 = {optional = true}},
		{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 = {optional = true}},
		{code = "mish-pro", options = {optional = true}},
		{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

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

return export