Hoppa till innehållet

Modul:ISBN

Från Wikipedia
Version från den 8 november 2017 kl. 17.12 av Nirmos (Diskussion | Bidrag) (oops)

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


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

p = {}
p.ISBN = function( f )
	local args = f:getParent().args
	local arg = args[ 1 ]
	if arg then
		local copy = arg -- Kopiera så att vi kan vandalisera ISBN-numret internt och sedan returnera arg
		copy = copy:gsub( '-', '' )
		copy = copy:gsub( ' ', '' )
		local length = string.len( copy )
		if ( length ~= 10 ) and ( length ~= 13 ) then
			return length
		end
		return mw.getCurrentFrame():preprocess( '{{ISBN|' .. arg .. '}}' )
	end
end
return p