Module:links: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
No edit summary
Line 161: Line 161:
end
end
reconstructed = lang:hasType("reconstructed") and 1 or 0
reconstructed = lang:hasType("reconstructed") and 1 or 0
conlang = lang:hasType("conlang") and 1 or 0
target, escaped = target:gsub("^(\\-)\\%*", "%1*")
target, escaped = target:gsub("^(\\-)\\%*", "%1*")


Line 185: Line 186:
return ":" .. target
return ":" .. target
elseif target:find("^Reconstruction:") then
elseif target:find("^Reconstruction:") then
return 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.
Line 195: Line 196:
end
end
-- Reconstructed languages and substrates require an initial *.
-- Reconstructed languages and substrates require an initial *.
elseif lang:hasType("reconstructed") or lang:getFamilyCode() == "qfa-sub" then
elseif (reconstructed or lang:getFamilyCode() == "qfa-sub") and not conlang then
local check = target:match("^:*([^:]*):")
local check = target:match("^:*([^:]*):")
check = check and ulower(check)
check = check and ulower(check)
Line 209: Line 210:


elseif lang:hasType("appendix-constructed") then
elseif lang:hasType("appendix-constructed") then
target = "Appendix:" .. lang:getCanonicalName() .. "/" .. target
target = "wik:Appendix:" .. lang:getCanonicalName() .. "/" .. target
end
end


Line 521: Line 522:
text = text and trim(text)
text = text and trim(text)
data.alt = data.alt and trim(data.alt)
data.alt = data.alt and trim(data.alt)
return make_link({target = text, display = data.alt, fragment = data.fragment}, data.lang, data.sc, data.id, true, nil, data.cats, data.no_alt_ast, data.to_wikt)
return make_link({target = text, display = data.alt, fragment = data.fragment}, data.lang, data.sc, data.id, true, nil, data.cats, data.no_alt_ast) --, data.to_wikt)
end
end


Line 774: Line 775:
* If <code class="n">no_alt_ast</code> is specified, then the alt text does not need to contain an asterisk if the language is reconstructed. This should only be used by modules which really need to allow links to reconstructions that don't display asterisks (e.g. number boxes).
* If <code class="n">no_alt_ast</code> is specified, then the alt text does not need to contain an asterisk if the language is reconstructed. This should only be used by modules which really need to allow links to reconstructions that don't display asterisks (e.g. number boxes).
* If <code class="n">show_qualifiers</code> is specified, left and right qualifiers and references will be displayed. (This is for compatibility reasons, since a fair amount of code stores qualifiers and/or references in these fields and displays them itself, expecting {{code|lua|full_link()}} to ignore them.]==]
* If <code class="n">show_qualifiers</code> is specified, left and right qualifiers and references will be displayed. (This is for compatibility reasons, since a fair amount of code stores qualifiers and/or references in these fields and displays them itself, expecting {{code|lua|full_link()}} to ignore them.]==]
function export.full_link(data, face, allow_self_link, show_qualifiers, to_wikt)
function export.full_link(data, face, allow_self_link, show_qualifiers) --, to_wikt)
-- Prevent data from being destructively modified.
-- Prevent data from being destructively modified.
local data = shallowcopy(data)
local data = shallowcopy(data)
Line 928: Line 929:
cats = data.cats,
cats = data.cats,
no_alt_ast = data.no_alt_ast,
no_alt_ast = data.no_alt_ast,
to_wikt = data.to_wikt
--to_wikt = data.to_wikt
}
}
link = require("Module:script utilities").tag_text(
link = require("Module:script utilities").tag_text(

Navigation menu