45,647
edits
No edit summary |
No edit summary |
||
Line 189: | Line 189: | ||
-- Link to appendix for reconstructed terms and terms in appendix-only languages. Plain links interpret * literally, however. | -- Link to appendix for reconstructed terms and terms in appendix-only languages. Plain links interpret * literally, however. | ||
elseif reconstructed == 1 then | elseif reconstructed == 1 then | ||
if lang: | if lang:getCode() == "und" then | ||
return nil | return nil | ||
else | else | ||
target = "Reconstruction:" .. lang: | target = "Reconstruction:" .. lang:getCanonicalName() .. "/" .. target | ||
end | end | ||
-- Reconstructed languages and substrates require an initial *. | -- Reconstructed languages and substrates require an initial *. | ||
Line 209: | Line 209: | ||
elseif lang:hasType("appendix-constructed") then | elseif lang:hasType("appendix-constructed") then | ||
target = "Appendix:" .. lang: | target = "Appendix:" .. lang:getCanonicalName() .. "/" .. target | ||
end | end | ||
Line 250: | Line 250: | ||
-- If `no_alt_ast` is true, use pcall to catch the error which will be thrown if this is a reconstructed lang and the alt text doesn't have *. | -- If `no_alt_ast` is true, use pcall to catch the error which will be thrown if this is a reconstructed lang and the alt text doesn't have *. | ||
if link.display == auto_display then | if link.display == auto_display then | ||
insert(cats, lang: | insert(cats, lang:getCanonicalName() .. " links with redundant alt parameters") | ||
else | else | ||
local ok, check | local ok, check | ||
Line 260: | Line 260: | ||
end | end | ||
if ok and link.target == check then | if ok and link.target == check then | ||
insert(cats, lang: | insert(cats, lang:getCanonicalName() .. " links with redundant target parameters") | ||
end | end | ||
end | end | ||
Line 279: | Line 279: | ||
if ( | if ( | ||
fragment and fragment == current_L2 or | fragment and fragment == current_L2 or | ||
not (id or fragment) and (lang: | not (id or fragment) and (lang:getCode() == "und" or lang:getCanonicalName() == current_L2) | ||
) then | ) then | ||
return tostring(mw.html.create("strong") | return tostring(mw.html.create("strong") | ||
Line 297: | Line 297: | ||
if (link.fragment or link.target:find("#$")) and not plain then | if (link.fragment or link.target:find("#$")) and not plain then | ||
if cats then | if cats then | ||
insert(cats, lang: | insert(cats, lang:getCanonicalName() .. " links with manual fragments") | ||
end | end | ||
end | end | ||
if (not link.fragment) and lang: | if (not link.fragment) and lang:getCode() ~= "und" then | ||
if id then | if id then | ||
link.fragment = require("Module:senseid").anchor(lang, id) | link.fragment = require("Module:senseid").anchor(lang, id) | ||
elseif not (link.target:find("^Appendix:") or link.target:find("^Reconstruction:") or plain) then | elseif not (link.target:find("^Appendix:") or link.target:find("^Reconstruction:") or plain) then | ||
link.fragment = lang: | link.fragment = lang:getCanonicalName() | ||
end | end | ||
elseif plain and id then | elseif plain and id then | ||
Line 373: | Line 373: | ||
if data.alt then | if data.alt then | ||
mw.log("(from Module:links)", "text with embedded wikilinks:", text, | mw.log("(from Module:links)", "text with embedded wikilinks:", text, | ||
"ignored alt:", data.alt, "lang:", data.lang: | "ignored alt:", data.alt, "lang:", data.lang:getCode()) | ||
if data.cats then | if data.cats then | ||
insert(data.cats, data.lang: | insert(data.cats, data.lang:getCanonicalName() .. " links with ignored alt parameters") | ||
end | end | ||
end | end | ||
Line 381: | Line 381: | ||
if data.id then | if data.id then | ||
mw.log("(from Module:links)", "text with embedded wikilinks:", text, | mw.log("(from Module:links)", "text with embedded wikilinks:", text, | ||
"ignored id:", data.id, "lang:", data.lang: | "ignored id:", data.id, "lang:", data.lang:getCode()) | ||
if data.cats then | if data.cats then | ||
insert(data.cats, data.lang: | insert(data.cats, data.lang:getCanonicalName() .. " links with ignored id parameters") | ||
end | end | ||
end | end | ||
Line 452: | Line 452: | ||
data.term, data.alt = term, pipe and pipe ~= #text and sub(text, pipe + 1) or nil | data.term, data.alt = term, pipe and pipe ~= #text and sub(text, pipe + 1) or nil | ||
if data.cats then | if data.cats then | ||
insert(data.cats, data.lang: | insert(data.cats, data.lang:getCanonicalName() .. " links with redundant wikilinks") | ||
end | end | ||
end | end | ||
Line 583: | Line 583: | ||
elseif item_type == "tr" then | elseif item_type == "tr" then | ||
if face == "term" then | if face == "term" then | ||
tag = { '<span lang="' .. lang: | tag = { '<span lang="' .. lang:getCode() .. '" class="tr mention-tr Latn">', | ||
'</span>' } | '</span>' } | ||
else | else | ||
tag = { '<span lang="' .. lang: | tag = { '<span lang="' .. lang:getCode() .. '" class="tr Latn">', '</span>' } | ||
end | end | ||
elseif item_type == "ts" then | elseif item_type == "ts" then | ||
Line 811: | Line 811: | ||
require("Module:scripts").findBestScriptWithoutLang(display_term):getCode() ~= "None" | require("Module:scripts").findBestScriptWithoutLang(display_term):getCode() ~= "None" | ||
) then | ) then | ||
insert(data.cats, data.lang: | insert(data.cats, data.lang:getCanonicalName() .. " terms in nonstandard scripts") | ||
end | end | ||
if not data.sc[i] then | if not data.sc[i] then | ||
Line 818: | Line 818: | ||
elseif data.track_sc then | elseif data.track_sc then | ||
if data.sc[i]:getCode() == best:getCode() then | if data.sc[i]:getCode() == best:getCode() then | ||
insert(data.cats, data.lang: | insert(data.cats, data.lang:getCanonicalName() .. " terms with redundant script codes") | ||
else | else | ||
insert(data.cats, data.lang: | insert(data.cats, data.lang:getCanonicalName() .. " terms with non-redundant manual script codes") | ||
end | end | ||
end | end | ||
Line 896: | Line 896: | ||
no_store .. " " | no_store .. " " | ||
class = "form-of lang-" .. data.lang: | class = "form-of lang-" .. data.lang:getCode() .. " " .. accel | ||
end | end | ||
Line 932: | Line 932: | ||
break | break | ||
elseif mw.title.getCurrentTitle().nsText ~= "Template" then | elseif mw.title.getCurrentTitle().nsText ~= "Template" then | ||
insert(data.cats, data.lang: | insert(data.cats, data.lang:getCanonicalName() .. " term requests") | ||
end | end | ||
link = "<small>[Term?]</small>" | link = "<small>[Term?]</small>" | ||
Line 947: | Line 947: | ||
else | else | ||
local phonetic_extraction = mw.loadData("Module:links/data").phonetic_extraction | local phonetic_extraction = mw.loadData("Module:links/data").phonetic_extraction | ||
phonetic_extraction = phonetic_extraction[data.lang:getCode()] or phonetic_extraction[data.lang: | phonetic_extraction = phonetic_extraction[data.lang:getCode()] or phonetic_extraction[data.lang:getCode()] | ||
if phonetic_extraction then | if phonetic_extraction then | ||
Line 975: | Line 975: | ||
if manual_tr then | if manual_tr then | ||
if (export.remove_links(manual_tr) == export.remove_links(automated_tr)) and (not data.tr_fail) then | if (export.remove_links(manual_tr) == export.remove_links(automated_tr)) and (not data.tr_fail) then | ||
insert(data.cats, data.lang: | insert(data.cats, data.lang:getCanonicalName() .. " terms with redundant transliterations") | ||
elseif not data.tr_fail then | elseif not data.tr_fail then | ||
-- Prevents Arabic root categories from flooding the tracking categories. | -- Prevents Arabic root categories from flooding the tracking categories. | ||
if mw.title.getCurrentTitle().nsText ~= "Category" then | if mw.title.getCurrentTitle().nsText ~= "Category" then | ||
insert(data.cats, data.lang: | insert(data.cats, data.lang:getCanonicalName() .. " terms with non-redundant manual transliterations") | ||
end | end | ||
end | end |