codenotifier diff
I wanted to add diff viewing function to my codenotifier tool and all I found in Ruby was this CGI/command line script. I adopted it to show line numbers, handle multifile diffs and make output similar to one of Trac, and integrated it to codenotifier. Plus, in case anybody else needs it, I created diff_to_html.rb opensource project at GitHub (liked it a lot btw!), which makes it available as a gem, like this:

gem install artemv-diff_to_html --source=http://gems.github.com

Enjoy!

The code is far from being perfect, actually I wonder why it works in some cases, plus it could output better (e.g. I like changeset viewer at GitHub – it puts the changes and line numbers in separate DIVs – this way you could simply select changes without line numbers.. at price of (sometimes) horizontal scrollbar I guess. The funny thing is that at GitHub result is still mixed with comment counters for each line – it was so close to being perfect.. as always :)

So, patches/contributions are very welcome.

Related links:



2 Responses to “Formatting diff files as HTML”  

  1. 1 bjorne

    Thanks for this! Just got the latest version working (the one you committed an hour ago). I found an error though,
    http://github.com/artemv/diff_to_html.rb/tree/master/lib%2Fdiff_to_html.rb#L56
    has a missing “>”. Just wanted to let you know, it seems to be working anyway.

  2. 2 thirstydoh

    Thanks Bjorne!


Leave a Reply