Forum: Ruby on Rails Diff tool in Ruby with HTML output

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Maurício L. (Guest)
on 2009-02-08 22:24
(Received via mailing list)

Anyone knows of any tool that can generate a diff between two files
and output HTML code that i could use in a page?

Doesn't need to be a Ruby tool, any Unix compatible tool would do the
trick, I just need it to output HTML.

Maurício Linhares (pt-br) |
Jeff B. (Guest)
on 2009-02-09 20:37
(Received via mailing list)
$ irb
>> `echo "testing 123\ntesting" > ./file1.txt`
=> ""
>> `echo "testing 123\nhey, something new\ntesting" > ./file2.txt`
=> ""
>> puts "<html><body><pre>\n#{`diff -cws file1.txt file2.txt`}\n</pre></body></html>"
*** file1.txt  2009-02-09 10:25:44.000000000 -0800
--- file2.txt  2009-02-09 10:28:31.000000000 -0800
*** 1,2 ****
--- 1,3 ----
  testing 123
+ hey, something new

=> nil


On Feb 8, 12:08 pm, Maurício Linhares <removed_email_address@domain.invalid>
Maurício L. (Guest)
on 2009-02-09 22:01
(Received via mailing list)
I was looking for something that could turn the diff output into nice
HTML, but thanks anyway.

Maurício Linhares (pt-br) |
This topic is locked and can not be replied to.