module Diff
module Renderer
class Diff < Base
def before_addblock(block)
%q{
}
end
def before_remblock(block)
%Q{
}
end
def before_modblock(block)
%Q{
}
end
def before_unmodblock(block)
%Q{
}
end
def before_sepblock(block)
%Q{
}
end
# After blocks
def after_addblock(block)
"
"
end
def after_remblock(block)
""
end
def after_modblock(block)
""
end
def after_unmodblock(block)
""
end
def after_sepblock(block)
""
end
# Before lines
def addline(line)
# adds go on the right
%Q{#{line.old_number} | } +
%Q{ | } +
%Q{#{line.new_number} | } +
%Q{#{line} | }
end
def remline(line)
# rems go on the left (hide the right side)
%Q{#{line.old_number} | } +
%Q{#{line} | } +
%Q{#{line.new_number} | } +
%Q{#{line} | }
end
def modline(line)
# TODO: figure how we best display these
# %Q{#{line.old_number} | } +
# %Q{#{render_line(line)} | } +
# %Q{#{line.new_number} | } +
# %Q{#{render_line(line)} | }
end
def unmodline(line)
# unmods goes on both sides
%Q{#{line.old_number} | } +
%Q{#{line} | } +
%Q{#{line.new_number} | } +
%Q{#{line} | }
end
def sepline(line)
%Q{… | } +
%Q{ | } +
%Q{… | } +
%Q{ | }
end
def nonewlineline(line)
%Q{… | } +
%Q{ | } +
%Q{… | } +
%Q{#{line} | }
end
end
end
end