47,726
edits
![]() | We're back! Sorry, bad combo of sickness, funeral and a month-long trip abroad. The site is back now. ![]() |
No edit summary |
No edit summary |
||
Line 146: | Line 146: | ||
local prefix = target:gsub("^:*(.-):.*", ulower) | local prefix = target:gsub("^:*(.-):.*", ulower) | ||
if ( | if ( | ||
load_data("Module:data/namespaces")[prefix] or | |||
load_data("Module:data/interwikis")[prefix] | |||
) then | ) then | ||
return ":" .. target:gsub("^:+", ""), nil, {} | return ":" .. target:gsub("^:+", ""), nil, {} | ||
Line 158: | Line 158: | ||
local reconstructed, escaped | local reconstructed, escaped | ||
if not plain then | if not plain then | ||
target = target:gsub("^%*(.)", "%1") | target, reconstructed = target:gsub("^%*(.)", "%1") | ||
end | end | ||
target, escaped = target:gsub("^(\\-)\\%*", "%1*") | target, escaped = target:gsub("^(\\-)\\%*", "%1*") | ||
Line 185: | Line 183: | ||
if target:sub(1, 1) == "/" then | if target:sub(1, 1) == "/" then | ||
return ":" .. target | return ":" .. target | ||
elseif target:find("^Reconstruction:") then | elseif target:find("^Reconstruction:") then | ||
return "wikt:" .. target | return "wikt:" .. target | ||
-- 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 | ||
Line 196: | Line 195: | ||
end | end | ||
-- Reconstructed languages and substrates require an initial *. | -- Reconstructed languages and substrates require an initial *. | ||
elseif (reconstructed or lang:getFamilyCode() == "qfa-sub" | elseif lang:hasType("reconstructed") or lang:getFamilyCode() == "qfa-sub" then | ||
local check = target:match("^:*([^:]*):") | local check = target:match("^:*([^:]*):") | ||
check = check and ulower(check) | check = check and ulower(check) | ||
if ( | if ( | ||
load_data("Module:data/namespaces")[check] or | |||
load_data("Module:data/interwikis")[check] | |||
) then | ) then | ||
return target | return target | ||
else | else | ||
error("The specified language " .. lang:getCanonicalName() | --[[error("The specified language " .. lang:getCanonicalName() | ||
.. " is unattested, while the given term does not begin with '*' to indicate that it is reconstructed.") | .. " is unattested, while the given term does not begin with '*' to indicate that it is reconstructed.")]] | ||
return "*" .. target | |||
end | end | ||
elseif lang:hasType("appendix-constructed") then | elseif lang:hasType("appendix-constructed") then | ||
target = "wikt:Appendix:" .. lang: | target = "wikt:Appendix:" .. lang:getFullName() .. "/" .. target | ||
end | end | ||