Formatting diff files as HTML

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:
- blog entry on Codenotifier’s diffs
- sample diff at Codenotifier, from Shoes project
- original code by Adam Doppelt (thanks man!) appears in his blog entry (blogs became an important source of code, huh?)
- diff_to_html.rb project at GitHub
Filed under: codenotifier, diff_to_html.rb, my projects, opensource, ruby | 2 Comments
Search
-
You are currently browsing the Artem Vasiliev's Weblog weblog archives.
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.
Thanks Bjorne!