Module:links: Difference between revisions

No edit summary
Undo revision 523165 by Sware (talk)
Tag: Undo
 
(5 intermediate revisions by the same user not shown)
Line 321: Line 321:


if target:sub(1, 1) == ":" then
if target:sub(1, 1) == ":" then
-- FIXME, the auto_display (second return value) should probably remove the colon
local link_target = target:sub(2)
return target:sub(2), orig_target
link_target = (lang:hasType("conlang") and "Contionary:" or "wikt:") .. link_target
return link_target, orig_target
end
end


Line 356: Line 357:
end
end
end
end
target, escaped = target:gsub("^(\\-)\\%*", "%1*")
target, escaped = target:gsub("^(\\-)\\%%*", "%1*")
if reconstructed == 0 and lang:hasType("reconstructed") and not lang:hasType("conlang") then
if reconstructed == 0 and lang:hasType("reconstructed") then
orig_target = "*" .. target
orig_target = "*" .. target
reconstructed = 1
reconstructed = 1
Line 400: Line 401:
--.. " 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.")
orig_target = "*" .. target
orig_target = "*" .. target
end
else
if reconstructed == 1 then
target = "*" .. target
end
end
end
end
Line 451: Line 456:
-- 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:getFullName() .. " links with redundant alt parameters")
else
else
local ok, check
local ok, check
Line 459: Line 463:
ok = true
ok = true
check = export.get_link_page(orig_display, lang, sc, plain)
check = export.get_link_page(orig_display, lang, sc, plain)
end
if ok and link.target == check then
insert(cats, lang:getFullName() .. " links with redundant target parameters")
end
end
end
end