Logo Voyage

Module:IsLatin Voyage Tips and guide

You can check the original Wikivoyage article Here

--[[
	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
			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


Discover



Powered by GetYourGuide