Module:IsLatin

Dae Wikipedia, s'entziclopedia lìbera.
Jump to navigation Jump to search

Documentation for this module may be created at Module:IsLatin/doc

local p = {}

-- Funtzionalidade pro s'impreu dae àteros mòdulos
function p._IsLatin(args)
	local txt = args[1] or ''
	if mw.text.trim(txt) == '' then return nil end
	
	local len = mw.ustring.len(txt)
	local pos = 1
	while (pos <= len) do
		local charval = mw.ustring.codepoint(mw.ustring.sub(txt, pos))
		if charval >= 880 and charval < 8192 then
			return false
		elseif charval >= 8960 then
			return false
		end
		pos = pos + 1
	end
	return true
end

-- Funtzionalidade pro su template IsLatin
function p.IsLatin(frame)
	return p._IsLatin(frame.args) and 'sì' or ''
end

return p