Module:IsLatin
Apparence
La documentation pour ce module peut être créée à Module:IsLatin/doc
--[[
Source script: https://it.wikivoyage.org/wiki/Modulo:IsLatin
Maintainer: Andyrom75
]]
local function _isDefined(s)
return s ~= '' and s
end
local p = {}
function p.IsLatin(frame)
return frame.args and p.IsLatinValue(frame.args[1]) or ''
end
function p.IsLatinValue(txt)
if _isDefined(txt) then
local len = mw.ustring.len(txt)
local pos = 1
while ( pos <= len ) do
local charval = mw.ustring.codepoint(mw.ustring.sub(txt, pos))
-- note 8364 is the € symbol
if charval>687 and charval~=8364 then
return -1
end
pos = pos + 1
end
return 1
else
return 0
end
end
return p