Module:links: Difference between revisions
No edit summary |
No edit summary |
||
| (3 intermediate revisions by the same user not shown) | |||
| Line 337: | Line 337: | ||
end | end | ||
end | end | ||
-- Check if the term is reconstructed and remove any asterisk. Also check for anti-asterisk (!!). | -- Check if the term is reconstructed and remove any asterisk. Also check for anti-asterisk (!!). | ||
-- Otherwise, handle the escapes. | -- Otherwise, handle the escapes. | ||
| Line 354: | Line 354: | ||
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 | |||
orig_target = "*" .. target | |||
reconstructed = 1 | |||
end | |||
if not (sc and sc:getCode() ~= "None") then | if not (sc and sc:getCode() ~= "None") then | ||
| Line 377: | Line 382: | ||
-- Link to appendix for reconstructed terms and terms in appendix-only languages. Plain links interpret * | -- Link to appendix for reconstructed terms and terms in appendix-only languages. Plain links interpret * | ||
-- literally, however. | -- literally, however. | ||
if reconstructed == 1 then | if not lang:hasType("conlang") then | ||
if lang:hasType("appendix-constructed") then | |||
target = "wikt:Appendix:" .. lang:getFullName() .. "/" .. target | |||
elseif reconstructed == 1 then -- asterisk found | |||
if lang:getFullCode() == "und" then | |||
-- Return the original target as default display value. If we don't do this, we wrongly get | |||
-- [Term?] displayed instead. | |||
return nil, orig_target | |||
end | |||
target = "wikt:Reconstruction:" .. lang:getFullName() .. "/" .. target | |||
elseif anti_asterisk ~= 1 and (lang:hasType("reconstructed") or lang:getFamilyCode() == "qfa-sub") then | |||
--error("The specified language " .. lang:getCanonicalName() | |||
--.. " is unattested, while the given term does not begin with '*' to indicate that it is reconstructed.") | |||
orig_target = "*" .. target | |||
else | |||
target = target | |||
end | end | ||
else | else | ||
target = target | target = "Contionary:" .. target | ||
end | end | ||
return target, orig_target, escaped > 0 | return target, orig_target, escaped > 0 | ||
| Line 445: | Line 450: | ||
-- 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 | ||
else | else | ||
local ok, check | local ok, check | ||
| Line 453: | Line 457: | ||
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 | end | ||
end | end | ||
| Line 664: | Line 665: | ||
end | end | ||
term, alt = new_term, new_alt | term, alt = new_term, new_alt | ||
end | end | ||
end | end | ||
| Line 1,233: | Line 1,229: | ||
if automated_tr or data.tr_fail then | if automated_tr or data.tr_fail then | ||
local manual_tr = data.tr[1] | local manual_tr = data.tr[1] | ||
if (not manual_tr) or lang:overrideManualTranslit(data.sc[1]) then | if (not manual_tr) or lang:overrideManualTranslit(data.sc[1]) then | ||