# A very simple formatter for imported emails
class EmailCook
def initialize(raw)
@raw = raw
end
def cook
result = ""
in_quote = false
quote_buffer = ""
@raw.each_line do |l|
if l =~ /^\s*>/
in_quote = true
quote_buffer << l.sub(/^[\s>]*/, '') << "
"
elsif in_quote
result << "
#{quote_buffer}" quote_buffer = "" in_quote = false else result << l << "
#{quote_buffer}" end result.gsub!(/(