Module:pollasena-roots/templates: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
| (5 intermediate revisions by the same user not shown) | |||
| Line 6: | Line 6: | ||
local function concat_etymologies(args, etymologies) | local function concat_etymologies(args, etymologies) | ||
local str = | local str = table.concat(etymologies, ", ") .. "." | ||
if args.nocap then | if not args.nocap then | ||
str = str:gsub("^.", mw.ustring. | str = str:gsub("^.", mw.ustring.upper) | ||
end | end | ||
| Line 47: | Line 47: | ||
parent_args.borrowing = true | parent_args.borrowing = true | ||
local source_code = parent_args[1] or "und" | local source_code = parent_args[1] or "und" | ||
local extra_params = { | |||
mid = {type = "boolean"}, | |||
old = {type = "boolean"}, | |||
} | |||
local ancestor_codes = { | local ancestor_codes = { | ||
{code = source_code, options = {borrowed = true}}, | {code = source_code, options = {borrowed = true}}, | ||
} | } | ||
if parent_args.mid or parent_args.old then | |||
mid = { | table.insert(ancestor_codes, 1, {code = "lyti-mid", options = {optional = not parent_args.mid}}) | ||
old | 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) | local evolution, args, categories = m_pr.parse_args(parent_args, "lyti", ancestor_codes, extra_params) | ||
Latest revision as of 16:32, 20 April 2026
- The following documentation is located at Module:pollasena-roots/templates/doc.[edit]
- Useful links: root page • root page's subpages • links • transclusions • testcases • sandbox
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
return export