Module:etymology/templates: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 62: Line 62:
if lang then
if lang then
lang = fetch_lang(lang, 2)
lang = fetch_lang(lang, 2)
end
if lang and (lang:getCode() == "la" or lang:getCode() == "nl") then
require("Module:debug").track("etyl/" .. lang:getCode())
require("Module:debug").track("etyl/" .. lang:getCode() .. "/" .. source:getCode())
end
end
Line 74: Line 70:
function export.cognate(frame)
function export.cognate(frame)
local args = frame:getParent().args
local args = frame:getParent().args
if args.gloss then
require("Module:debug").track("cognate/gloss param")
end
local params = {
local params = {
Line 193: Line 185:


function export.learned_borrowing(frame)
function export.learned_borrowing(frame)
if frame:getParent().args.gloss then
require("Module:debug").track("learned_borrowing/gloss param")
end


local args, lang, term = parse_2_lang_args(frame, "has text")
local args, lang, term = parse_2_lang_args(frame, "has text")
Line 203: Line 192:


function export.semi_learned_borrowing(frame)
function export.semi_learned_borrowing(frame)
if frame:getParent().args.gloss then
require("Module:debug").track("semi_learned_borrowing/gloss param")
end


local args, lang, term = parse_2_lang_args(frame, "has text")
local args, lang, term = parse_2_lang_args(frame, "has text")
Line 213: Line 199:


function export.orthographic_borrowing(frame)
function export.orthographic_borrowing(frame)
if frame:getParent().args.gloss then
require("Module:debug").track("orthographic_borrowing/gloss param")
end


local args, lang, term = parse_2_lang_args(frame, "has text")
local args, lang, term = parse_2_lang_args(frame, "has text")
Line 223: Line 206:


function export.unadapted_borrowing(frame)
function export.unadapted_borrowing(frame)
if frame:getParent().args.gloss then
require("Module:debug").track("unadapted_borrowing/gloss param")
end


local args, lang, term = parse_2_lang_args(frame, "has text")
local args, lang, term = parse_2_lang_args(frame, "has text")
Line 249: Line 229:


function export.partial_calque(frame)
function export.partial_calque(frame)
if frame:getParent().args.gloss then
require("Module:debug").track("partial_calque/gloss param")
end


local args, lang, term = parse_2_lang_args(frame, "has text")
local args, lang, term = parse_2_lang_args(frame, "has text")
Line 375: Line 352:
if not desc_tree and entryLang:getType() == "family" then
if not desc_tree and entryLang:getType() == "family" then
error("Cannot use language family code in [[Template:desc]].")
error("Cannot use language family code in [[Template:desc]].")
end
if lang:getCode() ~= entryLang:getCode() then
-- [[Special:WhatLinksHere/Template:tracking/descendant/etymological]]
require("Module:debug").track("descendant/etymological")
require("Module:debug").track("descendant/etymological/" .. lang:getCode())
end
end
Line 410: Line 381:
true)
true)
elseif ts or gloss or #args["g"] > 0 then
elseif ts or gloss or #args["g"] > 0 then
-- [[Special:WhatLinksHere/Template:tracking/descendant/no term]]
require "Module:debug".track("descendant/no term")
link = require("Module:links").full_link(
link = require("Module:links").full_link(
{
{
Line 426: Line 395:
:gsub("<small>%[Term%?%]</small>&nbsp;", "")
:gsub("<small>%[Term%?%]</small>&nbsp;", "")
:gsub("%[%[Category:[^%[%]]+ term requests%]%]", "")
:gsub("%[%[Category:[^%[%]]+ term requests%]%]", "")
else -- display no link at all
-- [[Special:WhatLinksHere/Template:tracking/descendant/no term or annotations]]
require "Module:debug".track("descendant/no term or annotations")
end
end
Line 488: Line 454:
if desc_tree and not args["noalts"] or not desc_tree and args["alts"] then
if desc_tree and not args["noalts"] or not desc_tree and args["alts"] then
-- [[Special:WhatLinksHere/Template:tracking/desc/alts]]
require("Module:debug").track("desc/alts")
alts = m_desctree.getAlternativeForms(entryLang, term, id)
alts = m_desctree.getAlternativeForms(entryLang, term, id)
end
end
Line 671: Line 635:
local g = args["g"][i]
local g = args["g"][i]


if not (term or alt or tr or ts) then
if term or alt or tr or ts then
require("Module:debug").track(template .. "/no term or alt or tr")
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,