experiments/old-bluecloth.rb
### Transform a copy of the given email +addr+ into an escaped version safer
### for posting publicly.
Transform a copy of the given email +addr+ into an escaped version safer
for posting publicly.
Transform a copy of the given email + addr + into an escaped version safer for posting publicly .
def encode_email_address( addr )
		rval = ''
		("mailto:" + addr).each_byte {|b|
			case b
			when ?:
				rval += ":"
			when ?@
				rval += Encoders[ rand(2) ][ b ]
			else
				r = rand(100)
				rval += (
					r > 90 ? Encoders[2][ b ] :
					r < 45 ? Encoders[1][ b ] :
							 Encoders[0][ b ]
				)
			end
		}
		return %{<a href="%s">%s</a>} % [ rval, rval.sub(/.+?:/, '') ]
	end
def encode_email_address ( addr ) rval = '' ( "mailto:" + addr ) . each_byte { | b | case b when ?: rval += ":" when ?@ rval += Encoders [ rand ( 2 ) ] [ b ] else r = rand ( 100 ) rval += ( r > 90 ? Encoders [ 2 ] [ b ] : r < 45 ? Encoders [ 1 ] [ b ] : Encoders [ 0 ] [ b ] ) end } return %{<a href="%s">%s</a>} % [ rval , rval . sub ( / .+?: / , '' ) ] end
Transform a copy of the given email +addr+ into an escaped version safer
for posting publicly.
Transform a copy of the given email + addr + into an escaped version safer for posting publicly .
addr
<not_specific>