Commit e460e04e authored by Hannes Rosenögger's avatar Hannes Rosenögger

Add Diff syntax colors for email-on-push notifications

parent ada6c608
...@@ -5,7 +5,7 @@ v 7.8.0 ...@@ -5,7 +5,7 @@ v 7.8.0
- -
- -
- -
- - Add diff syntax highlighting in email-on-push service notifications (Hannes Rosenögger)
- -
- -
- -
......
...@@ -29,4 +29,14 @@ module EmailsHelper ...@@ -29,4 +29,14 @@ module EmailsHelper
end end
end end
end end
def add_email_highlight_css
Rugments::Themes::Github.render(:scope => '.highlight')
end
def color_email_diff(diffcontent)
formatter = Rugments::Formatters::HTML.new(cssclass: 'highlight')
lexer = Rugments::Lexers::Diff.new
raw formatter.format(lexer.lex(diffcontent))
end
end end
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
font-size:small; font-size:small;
color:#777 color:#777
} }
#{add_email_highlight_css}
%body %body
%div.content %div.content
= yield = yield
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
= diff.new_path || diff.old_path = diff.new_path || diff.old_path
%hr %hr
%pre %pre
= diff.diff = color_email_diff(diff.diff)
%br %br
- if @compare.timeout - if @compare.timeout
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment