2012-01-30 20:39:34 +00:00
|
|
|
# -*- encoding : utf-8 -*-
|
2011-03-10 13:33:50 +00:00
|
|
|
module DiffHelper
|
|
|
|
|
2011-04-01 04:44:21 +01:00
|
|
|
def render_diff(diff)
|
|
|
|
diff_display ||= Diff::Display::Unified.new(diff.diff)
|
|
|
|
|
2012-02-29 01:30:22 +00:00
|
|
|
#res = "<a name='#{h(diff.a_path)}'></a>"
|
2011-03-10 13:33:50 +00:00
|
|
|
|
2012-02-29 01:30:22 +00:00
|
|
|
res = "<table class='diff inline' cellspacing='0' cellpadding='0'>"
|
2011-04-01 04:44:21 +01:00
|
|
|
res += "<tbody>"
|
2012-03-21 19:55:14 +00:00
|
|
|
res += diff_display.render(Git::Diff::InlineCallback.new)
|
2011-04-01 04:44:21 +01:00
|
|
|
res += "</tbody>"
|
|
|
|
res += "</table>"
|
2011-03-10 13:33:50 +00:00
|
|
|
|
2012-03-21 19:55:14 +00:00
|
|
|
res.html_safe
|
2011-03-10 13:33:50 +00:00
|
|
|
end
|
|
|
|
|
2012-01-30 20:39:34 +00:00
|
|
|
end
|