Module:headword: Difference between revisions

Jump to navigation Jump to search
1,014 bytes removed ,  5 August 2024
no edit summary
No edit summary
No edit summary
Line 725: Line 725:
if head_term:sub(1, 1) ~= "*" then
if head_term:sub(1, 1) ~= "*" then
error("The headword '"  .. head_term .. "' must begin with '*' to indicate that it is reconstructed.")
error("The headword '"  .. head_term .. "' must begin with '*' to indicate that it is reconstructed.")
end
end
------ 6b. Try to detect the script(s) if not provided. If a per-head script is provided, that takes precedence,
------    otherwise fall back to the overall script if given. If neither given, autodetect the script.
local auto_sc = require("Module:scripts").getByCode(data.lang:getScriptCodes(head.term))
if (
auto_sc:getCode() == "None" and
require(scripts_module).findBestScriptWithoutLang(head.term):getCode() ~= "None"
) then
insert(data.categories, full_langname .. " terms in nonstandard scripts")
end
if not (head.sc or data.sc) then -- No script code given, so use autodetected script.
head.sc = auto_sc
else
if not head.sc then -- Overall script code given.
head.sc = data.sc
end
-- Track uses of sc parameter.
if head.sc:getCode() == auto_sc:getCode() then
insert(data.categories, full_langname .. " terms with redundant script codes")
else
insert(data.categories, full_langname .. " terms with non-redundant manual script codes")
end
end
end
end

Navigation menu