Module:etymology/templates: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 32: Line 32:




local function fetch_script(sc, source)
local function fetch_script(sc)
if sc then
if sc then
return require("Module:scripts").getByCode(sc) or error("The script code \"" .. sc .. "\" is not valid.")
return require("Module:scripts").getByCode(sc) or error("The script code \"" .. sc .. "\" is not valid.")
else
else
return require("Module:scripts").getByCode(sc)
return nil
end
end
end
end
Line 94: Line 94:
local source = fetch_source(args[1])
local source = fetch_source(args[1])
local sc = fetch_script(args["sc"], source)
local sc = fetch_script(args["sc"])


return m_etymology.format_cognate(
return m_etymology.format_cognate(
Line 150: Line 150:
local lang = fetch_lang(args[1], 1)
local lang = fetch_lang(args[1], 1)
local source = fetch_source(args[2], no_family)
local source = fetch_source(args[2], no_family)
local sc = fetch_script(args["sc"], source)
local sc = fetch_script(args["sc"])


return args, lang, {
return args, lang, {
Line 163: Line 163:
gloss = args["t"],
gloss = args["t"],
pos = args["pos"],
pos = args["pos"],
lit = args["lit"],
lit = args["lit"]
nocont = true,
}
}
end
end
Line 360: Line 359:
local languageName = lang:getCanonicalName()
local languageName = lang:getCanonicalName()
languageName = mw.ustring.gsub(languageName, "^Proto%-", "")
local link = ""
local link = ""
Line 396: Line 393:
:gsub("<small>%[Term%?%]</small>&nbsp;", "")
:gsub("<small>%[Term%?%]</small>&nbsp;", "")
:gsub("%[%[Category:[^%[%]]+ term requests%]%]", "")
:gsub("%[%[Category:[^%[%]]+ term requests%]%]", "")
else -- display no link at all
end
end
Line 417: Line 415:
arrow = add_tooltip("→", "borrowed")
arrow = add_tooltip("→", "borrowed")
elseif args["lbor"] then
elseif args["lbor"] then
arrow = add_tooltip("→", "learned borrowed")
arrow = add_tooltip("→", "learned borrowing")
elseif args["slb"] then
elseif args["slb"] then
arrow = add_tooltip("→", "semi-learned borrowing")
arrow = add_tooltip("→", "semi-learned borrowing")
Line 514: Line 512:
function export.descendant(frame)
function export.descendant(frame)
return desc_or_desc_tree(frame, false) .. require("Module:TemplateStyles")("Template:descendant/style.css")
return desc_or_desc_tree(frame, false) .. require("Module:TemplateStyles")("Module:etymology/style.css")
end
end


Line 569: Line 567:
local lang = fetch_lang(args[1], 1)
local lang = fetch_lang(args[1], 1)
local sc = fetch_script(args["sc"], lang)
local sc = fetch_script(args["sc"])


local parts = {}
local parts = {}
Line 636: Line 634:
local g = args["g"][i]
local g = args["g"][i]


if term or alt or tr or ts then
if not (term or alt or tr or ts) then
return nil
else
return require("Module:links").full_link(
return require("Module:links").full_link(
{ term = term, alt = alt, id = id, lang = lang, sc = sc, tr = tr,
{ term = term, alt = alt, id = id, lang = lang, sc = sc, tr = tr,