Module:script utilities: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
No edit summary
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 find(sc:getCode(), "Lat") and true or false
return sc:getCode():find("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


Line 94: Line 102:
return (txt:gsub("%-", ""))
return (txt:gsub("%-", ""))
end)
end)
end
if sc:getCode() == "Imag" then
face = nil
end
end


Navigation menu