48,355
edits
No edit summary |
No edit summary |
||
| (4 intermediate revisions by the same user not shown) | |||
| Line 5: | Line 5: | ||
local function term_error(terminfo) | local function term_error(terminfo) | ||
if terminfo.lang:hasType("family") then | if terminfo.lang then | ||
if terminfo.lang:hasType("family") then | |||
terminfo.term = "-" | |||
end | |||
end | end | ||
return terminfo | return terminfo | ||
| Line 12: | Line 14: | ||
local function create_link(terminfo, template_name | local function create_link(terminfo, template_name) | ||
local link = "" | local link = "" | ||
if terminfo.term ~= "-" then | if terminfo.term ~= "-" then | ||
-- mw.log(terminfo.term) | -- mw.log(terminfo.term) | ||
link = require("Module:links").full_link(terminfo, " | link = require("Module:links").full_link(terminfo, "term") | ||
if (link ~= "") then link = " " .. link end | if (link ~= "") then link = " " .. link end | ||
end | end | ||
| Line 25: | Line 27: | ||
function export.process_and_create_link(terminfo, template_name | function export.process_and_create_link(terminfo, template_name) | ||
terminfo = term_error(terminfo) | terminfo = term_error(terminfo) | ||
return create_link(terminfo, template_name or "derived" | return create_link(terminfo, template_name or "derived") | ||
end | end | ||
| Line 37: | Line 39: | ||
cat_name = "other languages" | cat_name = "other languages" | ||
elseif source:getCode() == "mul" then | elseif source:getCode() == "mul" then | ||
display = "[[w:Translingualism|translingual]]" | display = raw and "translingual" or "[[w:Translingualism|translingual]]" | ||
cat_name = "Translingual" | cat_name = "Translingual" | ||
elseif source:getCode() == "mul-tax" then | elseif source:getCode() == "mul-tax" then | ||
display = "[[w: | display = raw and "taxonomic name" or "[[w:Biological nomenclature|taxonomic name]]" | ||
cat_name = "taxonomic names" | cat_name = "taxonomic names" | ||
else | else | ||
| Line 46: | Line 48: | ||
cat_name = source:getDisplayForm() | cat_name = source:getDisplayForm() | ||
end | end | ||
return display, cat_name | return display, cat_name | ||
end | end | ||
| Line 68: | Line 69: | ||
table.insert(categories, langname .. " terms borrowed back into " .. langname) | table.insert(categories, langname .. " terms borrowed back into " .. langname) | ||
else | else | ||
table.insert(categories, langname .. " terms " .. | table.insert(categories, langname .. " terms derived from " .. cat_name) | ||
if data.borrowing_type then | |||
table.insert(categories, langname .. " terms " .. data.borrowing_type .. " from " .. cat_name) | |||
end | |||
end | end | ||
end | end | ||
| Line 189: | Line 192: | ||
-- If both are the same, we want e.g. [[:Category:English terms borrowed back into English]] not | -- If both are the same, we want e.g. [[:Category:English terms borrowed back into English]] not | ||
-- [[:Category:English terms borrowed from English]]; the former is inserted automatically by format_source(). | -- [[:Category:English terms borrowed from English]]; the former is inserted automatically by format_source(). | ||
category = " terms borrowed from " .. | -- The second parameter here doesn't matter as it only affects `display`, which we don't use. | ||
local display, cat_name = export.get_display_and_cat_name(source, "raw") | |||
category = " terms borrowed from " .. cat_name | |||
end | end | ||
if category then | if category then | ||