45,333
edits
No edit summary |
No edit summary |
||
(30 intermediate revisions by the same user not shown) | |||
Line 12: | Line 12: | ||
[[Module:utilities]] | [[Module:utilities]] | ||
[[Module:string]] | [[Module:string]] | ||
]=] | ]=] | ||
Line 64: | Line 63: | ||
if target:sub(1, 1) == "/" then | if target:sub(1, 1) == "/" then | ||
return ":" .. target | return ":" .. target | ||
end | end | ||
Line 127: | Line 113: | ||
end | end | ||
end | end | ||
-- Process the target | -- Process the target | ||
link.target = link.nocont and link.target:gsub("^%*", "Reconstruction:" .. lang:getCanonicalName() .. "/") or link.target | |||
link.target = export.getLinkPage(link.target, lang) | link.target = export.getLinkPage(link.target, lang) | ||
Line 171: | Line 158: | ||
end | end | ||
return "[[" .. link.target .. "|" .. link.display .. "]]" | return "[[" .. (link.nocont and "wikt:" or "Contionary:") .. link.target .. "#" .. lang:getCanonicalName() .. "|" .. link.display .. "]]" | ||
end | end | ||
Line 264: | Line 251: | ||
else | else | ||
-- There is no embedded wikilink, make a link using the parameters. | -- There is no embedded wikilink, make a link using the parameters. | ||
text = makeLangLink({ target = text, display = data.alt }, data.lang, data.id, allow_self_link) | text = makeLangLink({ target = text, display = data.alt, nocont = data.nocont}, data.lang, data.id, allow_self_link) | ||
end | end | ||
Line 384: | Line 371: | ||
-- Is there any text to show? | -- Is there any text to show? | ||
if (data.term or data.alt) then | if (data.term or data.alt) and data.term ~= "-" then | ||
-- Try to detect the script if it was not provided | -- Try to detect the script if it was not provided | ||
if not data.sc then | if not data.sc then | ||
Line 429: | Line 416: | ||
Is there at least a transliteration we can work from? ]] | Is there at least a transliteration we can work from? ]] | ||
link = require("Module:script utilities").request_script(data.lang, data.sc) | link = require("Module:script utilities").request_script(data.lang, data.sc) | ||
if link == "" or not data.tr or data.tr == "-" then | if not data.sc then | ||
data.sc = require("Module:scripts").findBestScript(data.alt or data.term, data.lang) | |||
else | |||
-- Track uses of sc parameter | |||
local best = require("Module:scripts").findBestScript(data.alt or data.term, data.lang) | |||
end | |||
if link == "" or link == "-" or link == "?" or not data.tr or data.tr == "-" then | |||
-- No link to show, and no transliteration either. Show a term request. | -- No link to show, and no transliteration either. Show a term request. | ||
local category = "" | local category = "" | ||
Line 458: | Line 452: | ||
-- is tight. `no_check_redundant_translit` is currently set when called ultimately from | -- is tight. `no_check_redundant_translit` is currently set when called ultimately from | ||
-- {{multitrans|...|no-check-redundant-translit=1}}.) | -- {{multitrans|...|no-check-redundant-translit=1}}.) | ||
if not | if not data.tr then | ||
local automated_tr = data.lang:transliterate(export.remove_links(data.alt or data.term), data.sc) | local automated_tr = data.lang:transliterate(export.remove_links(data.alt or data.term), data.sc) | ||
Line 491: | Line 482: | ||
-- Link to the transliteration entry for languages that require this | -- Link to the transliteration entry for languages that require this | ||
if data.tr and data.lang:link_tr() then | if data.tr and data.lang:link_tr() then | ||
data.tr = export.language_link { lang = data.lang, term = data.tr } | data.tr = require("Module:script utilities").tag_text( | ||
export.language_link({ lang = data.lang, term = data.tr, nocont = data.nocont}, allow_self_link), | |||
data.lang, data.sc, face, class) | |||
--data.tr = export.language_link { lang = data.lang, term = data.tr, nocont = data.nocont} | |||
elseif data.tr then | |||
data.tr = "''" .. data.tr .. "''" | |||
end | end | ||
Line 498: | Line 494: | ||
return table_concat(output) .. table_concat(categories) | return table_concat(output) .. table_concat(categories) | ||
end | end | ||
--[[ Strips links: deletes category links, | --[[ Strips links: deletes category links, |