45,333
edits
No edit summary |
No edit summary |
||
Line 75: | Line 75: | ||
["alt"] = {list = true, allow_holes = true, require_index = true}, | ["alt"] = {list = true, allow_holes = true, require_index = true}, | ||
["q"] = {list = true, allow_holes = true, require_index = true}, | ["q"] = {list = true, allow_holes = true, require_index = true}, | ||
["lit"] = {list = | ["lit"] = {}, | ||
-- Note, lit1=, lit2=, ... are different from lit= | |||
["partlit"] = {list = "lit", allow_holes = true, require_index = true}, | |||
["pos"] = {}, | ["pos"] = {}, | ||
-- Note, pos1=, pos2=, ... are different from pos= | -- Note, pos1=, pos2=, ... are different from pos= | ||
Line 90: | Line 92: | ||
["sort"] = {}, | ["sort"] = {}, | ||
["nocat"] = {type = "boolean"}, | ["nocat"] = {type = "boolean"}, | ||
["force_cat"] = {type = "boolean"}, | |||
} | } | ||
Line 112: | Line 115: | ||
local gloss = args["t"][i] | local gloss = args["t"][i] | ||
local pos = args["partpos"][i] | local pos = args["partpos"][i] | ||
local lit = args[" | local lit = args["partlit"][i] | ||
local q = args["q"][i] | local q = args["q"][i] | ||
local g = args["g"][i] | local g = args["g"][i] | ||
Line 123: | Line 126: | ||
end | end | ||
if term or alt or tr or ts then | if not (term or alt or tr or ts) then | ||
return nil | |||
else | |||
return { term = term, alt = alt, id = id, lang = lang, sc = sc, tr = tr, | return { term = term, alt = alt, id = id, lang = lang, sc = sc, tr = tr, | ||
ts = ts, gloss = gloss, pos = pos, lit = lit, q = q, | ts = ts, gloss = gloss, pos = pos, lit = lit, q = q, | ||
Line 154: | Line 159: | ||
function export.affix(frame) | function export.affix(frame) | ||
local args, terms, lang, sc = parse_args(frame:getParent().args) | local function hack_params(params) | ||
params["type"] = {} | |||
params["nocap"] = {type = "boolean"} | |||
params["notext"] = {type = "boolean"} | |||
end | |||
local args, terms, lang, sc = parse_args(frame:getParent().args, nil, hack_params) | |||
if args["type"] and not m_compound.compound_types[args["type"]] then | |||
error("Unrecognized compound type: '" .. args["type"] .. "'") | |||
end | |||
local parts = get_parsed_parts("affix", args, terms) | local parts = get_parsed_parts("affix", args, terms) | ||
Line 160: | Line 175: | ||
-- There must be at least one part to display. If there are gaps, a term | -- There must be at least one part to display. If there are gaps, a term | ||
-- request will be shown. | -- request will be shown. | ||
if not next(parts) then | if not next(parts) and not args["type"] then | ||
if mw.title.getCurrentTitle().nsText == "Template" then | if mw.title.getCurrentTitle().nsText == "Template" then | ||
parts = { {term = "prefix-"}, {term = "base"}, {term = "-suffix"} } | parts = { {term = "prefix-"}, {term = "base"}, {term = "-suffix"} } | ||
Line 168: | Line 183: | ||
end | end | ||
return m_compound.show_affixes(lang, sc, parts, args["pos"], args["sort"], args["nocat"]) | return m_compound.show_affixes(lang, sc, parts, args["pos"], args["sort"], | ||
args["type"], args["nocap"], args["notext"], args["nocat"], args["lit"], args["force_cat"]) | |||
end | end | ||
function export.compound(frame) | function export.compound(frame) | ||
local args, terms, lang, sc = parse_args(frame:getParent().args) | local function hack_params(params) | ||
params["type"] = {} | |||
params["nocap"] = {type = "boolean"} | |||
params["notext"] = {type = "boolean"} | |||
end | |||
local args, terms, lang, sc = parse_args(frame:getParent().args, nil, hack_params) | |||
if args["type"] and not m_compound.compound_types[args["type"]] then | |||
error("Unrecognized compound type: '" .. args["type"] .. "'") | |||
end | |||
local parts = get_parsed_parts("compound", args, terms) | local parts = get_parsed_parts("compound", args, terms) | ||
Line 179: | Line 205: | ||
-- There must be at least one part to display. If there are gaps, a term | -- There must be at least one part to display. If there are gaps, a term | ||
-- request will be shown. | -- request will be shown. | ||
if not next(parts) then | if not next(parts) and not args["type"] then | ||
if mw.title.getCurrentTitle().nsText == "Template" then | if mw.title.getCurrentTitle().nsText == "Template" then | ||
parts = { {term = "first"}, {term = "second"} } | parts = { {term = "first"}, {term = "second"} } | ||
Line 187: | Line 213: | ||
end | end | ||
return m_compound.show_compound(lang, sc, parts, args["pos"], args["sort"], args["nocat"]) | return m_compound.show_compound(lang, sc, parts, args["pos"], args["sort"], | ||
args["type"], args["nocap"], args["notext"], args["nocat"], args["lit"], args["force_cat"]) | |||
end | end | ||
Line 215: | Line 242: | ||
end | end | ||
return m_compound.show_compound_like(lang, sc, parts, args["sort"], text, oftext, cat) | return m_compound.show_compound_like(lang, sc, parts, args["sort"], text, oftext, cat, args["lit"], args["force_cat"]) | ||
end | end | ||
Line 238: | Line 265: | ||
end | end | ||
return m_compound.show_interfix_compound(lang, sc, base1, interfix, base2, args["pos"], args["sort"], args["nocat"]) | return m_compound.show_interfix_compound(lang, sc, base1, interfix, base2, args["pos"], args["sort"], args["nocat"], args["lit"], args["force_cat"]) | ||
end | end | ||
Line 261: | Line 288: | ||
end | end | ||
return m_compound.show_circumfix(lang, sc, prefix, base, suffix, args["pos"], args["sort"], args["nocat"]) | return m_compound.show_circumfix(lang, sc, prefix, base, suffix, args["pos"], args["sort"], args["nocat"], args["lit"], args["force_cat"]) | ||
end | end | ||
Line 283: | Line 310: | ||
end | end | ||
return m_compound.show_confix(lang, sc, prefix, base, suffix, args["pos"], args["sort"], args["nocat"]) | return m_compound.show_confix(lang, sc, prefix, base, suffix, args["pos"], args["sort"], args["nocat"], args["lit"], args["force_cat"]) | ||
end | end | ||
Line 304: | Line 331: | ||
end | end | ||
return m_compound.show_infix(lang, sc, base, infix, args["pos"], args["sort"], args["nocat"]) | return m_compound.show_infix(lang, sc, base, infix, args["pos"], args["sort"], args["nocat"], args["lit"], args["force_cat"]) | ||
end | end | ||
Line 329: | Line 356: | ||
end | end | ||
return m_compound.show_prefixes(lang, sc, prefixes, base, args["pos"], args["sort"], args["nocat"]) | return m_compound.show_prefixes(lang, sc, prefixes, base, args["pos"], args["sort"], args["nocat"], args["lit"], args["force_cat"]) | ||
end | end | ||
Line 349: | Line 376: | ||
end | end | ||
return m_compound.show_suffixes(lang, sc, base, suffixes, args["pos"], args["sort"], args["nocat"]) | return m_compound.show_suffixes(lang, sc, base, suffixes, args["pos"], args["sort"], args["nocat"], args["lit"], args["force_cat"]) | ||
end | end | ||
Line 363: | Line 390: | ||
["sc"] = {}, | ["sc"] = {}, | ||
["sort"] = {}, | ["sort"] = {}, | ||
["lit"] = {}, | |||
} | } | ||
Line 373: | Line 401: | ||
local transfix = {term = args[3]} | local transfix = {term = args[3]} | ||
return m_compound.show_transfix(lang, sc, base, transfix, args["pos"], args["sort"], args["nocat"]) | return m_compound.show_transfix(lang, sc, base, transfix, args["pos"], args["sort"], args["nocat"], args["lit"], args["force_cat"]) | ||
end | end | ||
Line 428: | Line 456: | ||
name = "#categorytree", | name = "#categorytree", | ||
args = { | args = { | ||
"Terms derived from the | "Terms derived from the Proto-Indo-European root " .. term .. (id and " (" .. id .. ")" or ""), | ||
depth = 0, | depth = 0, | ||
class = "\"derivedterms\"", | class = "\"derivedterms\"", | ||
Line 436: | Line 464: | ||
end | end | ||
if derivtype == "compound" then | if (derivtype == "compound" and pos == nil) then | ||
category = lang:getCanonicalName() .. " compounds with " .. term | category = lang:getCanonicalName() .. " compounds with " .. term | ||
elseif derivtype == "compound" then | |||
category = lang:getCanonicalName() .. " compound " .. pos .. " with " .. term | |||
else | else | ||
category = lang:getCanonicalName() .. " " .. pos .. " " .. derivtype .. "ed with " .. term .. (id and " (" .. id .. ")" or "") | category = lang:getCanonicalName() .. " " .. pos .. " " .. derivtype .. "ed with " .. term .. (id and " (" .. id .. ")" or "") |