Aller au contenu

Module:Bac à sable/Lowercase

Une page de Wikipédia, l'encyclopédie libre.
Ceci est une version archivée de cette page, en date du 11 juillet 2021 à 00:05 et modifiée en dernier par Od1n (discuter | contributions). Elle peut contenir des erreurs, des inexactitudes ou des contenus vandalisés non présents dans la version actuelle.

 Documentation[créer] [purger]
local p = {}

local dataLangue = mw.loadData( 'Module:Langue/Data' )
local noms = {}
for k, v in pairs( dataLangue ) do
	noms[ #noms + 1 ] = v.nom
end

function p.v1( frame )
	local args = frame:getParent().args

	local texts
	if args['data langue'] == 'oui' then
		texts = noms
	else
		texts = { args.text }
	end

	for i = 1, args.nb do
		for j = 1, #texts do
			local text = texts[ j ]
			mw.ustring.lower( text )
		end
	end
end

function p.v2( frame )
	local args = frame:getParent().args

	local texts
	if args['data langue'] == 'oui' then
		texts = noms
	else
		texts = { args.text }
	end

	for i = 1, args.nb do
		for j = 1, #texts do
			local text = texts[ j ]
			if text:find( '[^a-z ]' ) then
				mw.ustring.lower( text )
			end
		end
	end
end

return p