class Diff::LCS::HTMLDiff

def run

def run
  verify_options
  if @options[:expand_tabs].positive? && self.class.can_expand_tabs
    formatter = Text::Format.new
    formatter.tabstop = @options[:expand_tabs]
    @left.map! do |line| formatter.expand(line.chomp) end
    @right.map! do |line| formatter.expand(line.chomp) end
  end
  @left.map! do |line| CGI.escapeHTML(line.chomp) end
  @right.map! do |line| CGI.escapeHTML(line.chomp) end
  @options[:output] << <<-OUTPUT
tml>
<head>
  <title>#{@options[:title]}</title>
  <style type="text/css">
  #{@options[:css]}
  </style>
</head>
<body>
  <h1>#{@options[:title]}</h1>
  <p>Legend: <span class="only_a">Only in Old</span>&nbsp;
  <span class="only_b">Only in New</span></p>
  <div class="diff">
  OUTPUT
  callbacks = Callbacks.new(@options[:output])
  Diff::LCS.traverse_sequences(@left, @right, callbacks)
  @options[:output] << <<-OUTPUT
  </div>
</body>
html>
  OUTPUT
end