Module:etymology: Difference between revisions

ਕੋਈ ਸੋਧ ਸਾਰ ਨਹੀਂ
No edit summary
No edit summary
Line 112: Line 112:
         categories = {"reduplications"},
         categories = {"reduplications"},
     },
     },
}
local multi_term_params = {
[1] = {required = true},
[2] = {list = true},
["alt"] = {list = true, allow_holes = true},
["t"] = {list = true, allow_holes = true},
["pos"] = {list = true, allow_holes = true},
["nocap"] = {type = "boolean"},
["nc"] = {alias_of = "nocap"},
["notext"] = {type = "boolean"},
["nocat"] = {type = "boolean"},
}
local multi_term_data = {
["blend"] = {
text = true,
categories = {"blends"},
},
}
}


Line 327: Line 345:
     if not args["nocat"] then categories = hydrate_categories(data["categories"], language, nil, args["newpos"]) end
     if not args["nocat"] then categories = hydrate_categories(data["categories"], language, nil, args["newpos"]) end
     return format_etymology(out, categories)
     return format_etymology(out, categories)
end
local function multi_term_etymology(template, frame)
local data, args = multi_term_data[template], m_parameters.process(frame:getParent().args, multi_term_params)
local out, categories = "", {}
local language = m_languages.get_by_code(args[1])
if not args["notext"] then out = out .. format_prefixed_text(template, data["text"], args["nocap"]) end
for i, word in ipairs(args[2]) do
local i_term, i_args = m_inline.parse(word)
if i > 1 then out = out .. " + " end
out = out .. m_links.full_link({
term = i_term,
language = language,
alt = args["alt"][i] or i_args["alt"],
gloss = args["t"][i] or i_args["t"],
pos = args["pos"][i] or i_args["pos"],
}, "term")
end
if not args["nocat"] then categories = hydrate_categories(data["categories"], language, nil, args["preposition"]) end
return format_etymology(out, categories)
end
end


Line 412: Line 450:
     if no_term_data[template] then return no_term_etymology(template, frame) end
     if no_term_data[template] then return no_term_etymology(template, frame) end
     if single_term_data[template] then return single_term_etymology(template, frame) end
     if single_term_data[template] then return single_term_etymology(template, frame) end
    if multi_term_data[template] then return multi_term_etymology(template, frame) end
     if derived_term_data[template] then return derived_term_etymology(template, frame) end
     if derived_term_data[template] then return derived_term_etymology(template, frame) end
     if affix_data[template] then return affix_etymology(template, frame) end
     if affix_data[template] then return affix_etymology(template, frame) end