Module:script utilities: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
Tag: Undo |
||
Line 9: | Line 9: | ||
[[Module:languages]] | [[Module:languages]] | ||
[[Module:parameters]] | [[Module:parameters]] | ||
[[Module:utilities | [[Module:utilities]] | ||
]=] | ]=] | ||
function export.is_Latin_script(sc) | function export.is_Latin_script(sc) | ||
-- Latn, Latf, Latinx, pjt-Latn | -- Latn, Latf, Latinx, pjt-Latn | ||
return | return mw.ustring.find(require("Module:scripts").getByCode(sc)["_code"], "Lat") and true or false | ||
end | end | ||
Line 41: | Line 41: | ||
return export.tag_text(text, lang, sc, face, class) | return export.tag_text(text, lang, sc, face, class) | ||
end | end | ||
Line 176: | Line 84: | ||
if not sc then | if not sc then | ||
sc = require("Module:scripts").findBestScript(text, lang) | sc = require("Module:scripts").findBestScript(text, lang) | ||
end | end | ||
-- Hack Korean | -- Hack Korean text to remove hyphens. This should be handled in a more general fashion, but needs to | ||
-- be efficient by not doing anything if no hyphens are present, and currently this is the only | -- be efficient by not doing anything if no hyphens are present, and currently this is the only | ||
-- language needing such processing. | -- language needing such processing. | ||
if lang:getCode() == "ko" and text:find("%-") then | |||
text = munge_text(text, function(txt) | text = munge_text(text, function(txt) | ||
-- having extra parentheses makes sure only the first return value gets through | -- having extra parentheses makes sure only the first return value gets through | ||
Line 353: | Line 249: | ||
return "<small>[" .. disp_script .. " needed]</small>" .. | return "<small>[" .. disp_script .. " needed]</small>" .. | ||
(nocat and "" or require("Module:utilities | (nocat and "" or require("Module:utilities").format_categories({category}, lang, sort_key)) | ||
end | end | ||