This module generates content for the etymology templates {{cognate}}
and {{noncognate}}
.
local export = {}
local etymology_module = "Module:etymology"
local etymology_multi_module = "Module:etymology/multi"
local process_params = require("Module:parameters").process
do
local function get_args(parent_args)
local alias_of_t = {alias_of = "t"}
local plain = {}
return process_params(parent_args, {
= {
required = true,
sublist = true,
type = "language",
family = true,
default = "und"
},
= plain,
= {alias_of = "alt"},
= alias_of_t,
= plain,
= plain,
= {list = true},
= alias_of_t,
= plain,
= plain,
= plain,
= {type = "script"},
= plain,
= plain,
= plain,
= plain,
})
end
function export.cognate(frame)
local parent_args = frame:getParent().args
if parent_args.gloss then
require("Module:debug/track")("cognate/gloss param")
end
local args = get_args(parent_args)
local sources = args
local terminfo = {
lang = sources,
sc = args,
term = args,
alt = args,
id = args,
genders = args,
tr = args,
ts = args,
gloss = args,
pos = args,
lit = args
}
if #sources > 1 then
return require(etymology_multi_module).format_multi_cognate {
sources = sources,
terminfo = terminfo,
sort_key = args.sort,
conj = args.conj,
}
end
return require(etymology_module).format_cognate {
terminfo = terminfo,
sort_key = args.sort,
}
end
end
function export.noncognate(frame)
return export.cognate(frame)
end
return export