Hoppa till innehållet

Modul:ISBN

Från Wikipedia

Dokumentation [visa] [redigera] [historik] [rensa sidcachen]


Den här modulen används av mallen {{ISBN}}.

p = {}
p.ISBN = function( frame )
	local pframe = frame:getParent()
	local args = pframe.args
	local arg = args[ 1 ]
	if arg then
		local template = '{{ISBN|' .. arg .. '}}'
		local copy = arg -- Kopiera så att vi kan vandalisera ISBN-numret internt och sedan returnera arg
		copy = copy:gsub( '-', '' )
		copy = copy:gsub( ' ', '' )
		local length = copy:len()
		if length ~= 10 and length ~= 13 then
			return pframe:preprocess( template .. '[[Kategori:Sidor med felaktigt ISBN]]' )
		end
		return pframe:preprocess( template )
	else
		return '<span class="error">[[Mall:ISBN]] anropad utan argument</span>[[Kategori:Sidor som anropar Mall:ISBN utan argument]]'
	end
end
return p