Module:affixusex: Difference between revisions
Jump to navigation
Jump to search
Tag: Undo |
No edit summary |
||
Line 38: | Line 38: | ||
table.insert(result, require("Module:etymology").format_derived(nil, terminfo, nil, "affixusex")) | table.insert(result, require("Module:etymology").format_derived(nil, terminfo, nil, "affixusex")) | ||
else | else | ||
table.insert(result, m_links.full_link(terminfo, " | table.insert(result, m_links.full_link(terminfo, "usex")) | ||
end | end | ||
Latest revision as of 15:50, 2 September 2021
- The following documentation is located at Module:affixusex/doc.[edit]
- Useful links: subpage list • links • transclusions • testcases • sandbox
local export = {}
local m_links = require("Module:links")
local rsplit = mw.text.split
-- main function
function export.format_affixusex(lang, sc, parts)
result = {}
-- Loop over all terms. We simply call full_link() on each term, along with the
-- associated params, to format the link, but need some special-casing for affixes.
for index, part in ipairs(parts) do
local term = part.term
local alt = part.alt
if part.fulljoiner then
table.insert(result, part.fulljoiner)
elseif part.joiner then
table.insert(result, " " .. part.joiner .. " ")
elseif index == #parts or part.arrow then
table.insert(result, " → ")
elseif index > 1 then
table.insert(result, " + ")
end
table.insert(result, "‎")
terminfo = {
lang = lang, sc = sc, term = term, gloss = part.t, tr = part.tr, ts = part.ts,
genders = part.g and rsplit(part.g, ",") or {}, id = part.id, alt = alt,
lit = part.lit, pos = part.pos, accel = part.accel
}
if part.lang then
terminfo.lang = part.lang
terminfo.sc = part.sc
table.insert(result, require("Module:etymology").format_derived(nil, terminfo, nil, "affixusex"))
else
table.insert(result, m_links.full_link(terminfo, "usex"))
end
if part.q then
table.insert(result, " " .. require("Module:qualifier").format_qualifier(part.q))
end
end
return table.concat(result)
end
return export