Модуль:Check

Материал из Справочника наблюдателя
Перейти к:навигация, поиск

(i)      Описание модуля[]

Документация отсутствует!


local p={}

function p.re( para, re, defa, l )
--	defa = defa or '{{error|недопустимый параметр HTML}}'
	if l and mw.ustring.len( para ) > l then
		return defa
	end
	if mw.ustring.match( para, re ) then
		return para
	end
	return defa
end

function p.RE( frame )
	return p.re( frame.args[1], '^' .. frame.args[2] .. '$', frame.args[3], frame.args[4] )
end

function p.Number( frame )
	return p.re( frame.args[1], '%d+', frame.args[2] )
end
function p.NoQuote( frame )
	return p.re( frame.args[1], '^[^"]+$', frame.args[2] or 'Недопустимый параметр HTML', frame.args[3] )
end


return p