class Olelo::PatchFormatter

Attributes

html[R]

Public Class Methods

new(options = {}) click to toggle source
# File lib/olelo/patch.rb, line 245
def initialize(options = {})
  @options = options
end

Public Instance Methods

begin!(src, dst) click to toggle source
Calls superclass method Olelo::PatchParser::Handler#begin!
# File lib/olelo/patch.rb, line 254
def begin!(src, dst)
  super
  @html << '<table class="patch"'
  @html << %{ id="patch-#{@file}"} if @options[:links]
  if @options[:header]
    @html << '><thead><tr class="'
    if src && dst
      if src == dst
        @html << 'edit"><th>' << escape_html(src)
      else
        @html << 'move"><th>' << escape_html(src) << ' &#8594; ' << escape_html(dst)
      end
    elsif src
      @html << 'delete"><th>' << escape_html(src)
    else
      @html << 'new"><th>' << escape_html(dst)
    end
    @html << '</th></tr></thead><tbody><tr><td><pre>'
  else
    @html << '><tbody><tr><td><pre>'
  end
end
binary!() click to toggle source
# File lib/olelo/patch.rb, line 283
def binary!
  @html << escape_html(:binary_file.t)
end
context!(text) click to toggle source
# File lib/olelo/patch.rb, line 307
def context!(text)
  @html << escape_html(text)
end
deleted!() click to toggle source
# File lib/olelo/patch.rb, line 287
def deleted!
  @html << escape_html(:deleted.t)
end
deletion!(text) click to toggle source
# File lib/olelo/patch.rb, line 303
def deletion!(text)
  @html << '<del>' << escape_html(text) << '</del>'
end
end!() click to toggle source
Calls superclass method Olelo::PatchParser::ChangeHandler#end!
# File lib/olelo/patch.rb, line 277
def end!
  super
  @html << '</pre></td></tr></tbody></table>'
  @file += 1
end
initialize!() click to toggle source
# File lib/olelo/patch.rb, line 249
def initialize!
  @html = ''
  @file = 0
end
insertion!(text) click to toggle source
# File lib/olelo/patch.rb, line 299
def insertion!(text)
  @html << '<ins>' << escape_html(text) << '</ins>'
end
no_changes!() click to toggle source
# File lib/olelo/patch.rb, line 291
def no_changes!
  @html << escape_html(:no_changes.t)
end
separator!() click to toggle source
# File lib/olelo/patch.rb, line 295
def separator!
  @html << '</pre></td></tr><tr><td><pre>'
end