Module:script utilities: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
No edit summary
(5 intermediate revisions by the same user not shown)
Line 14: Line 14:
function export.is_Latin_script(sc)
function export.is_Latin_script(sc)
-- Latn, Latf, Latinx, pjt-Latn
-- Latn, Latf, Latinx, pjt-Latn
return sc:getCode():find("Lat") and true or false
return mw.ustring.find(require("Module:scripts").getByCode(sc)["_code"], "Lat") and true or false
end
end


Line 84: 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
-- Replace space characters with newlines in Mongolian-script text, which is written top-to-bottom.
if sc and sc:getDirection() == "down" and text:find(" ") then
text = munge_text(text, function(txt)
-- having extra parentheses makes sure only the first return value gets through
return (txt:gsub(" +", "<br>"))
end)
end
end


Navigation menu