A quick and dirty way might be:
#!/usr/bin/ruby
input = File.open( "file.rb" , "r" )
output = File.new( "file.html" , "w+" )
input.each_byte{ |c|
case c.chr!
when "\n"
output.write( "<br>\n" )
when "\s"
output.write( " " )
when "\t"
output.write( 4.times{ "nbsp;" } )
else
output.write( c )
end }
Zach