-
Notifications
You must be signed in to change notification settings - Fork 2
/
README
53 lines (33 loc) · 1.26 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
=RailsDiff
====
This is a small plug-in to provide an easy way to display a diff of two "files"
(long strings...) as html. It uses the diff-lcs gem to calculate the diff.
The default output "generator" creates table-rows in the following scheme:
| Old-Line-Nr | Old-File | New-File | Old-Line-Nr |
It applies different css classes to the elements depending on match/difference.
==Source
====
http://github.com/universal/rails-diff/tree/master
==Requirements
====
This plug-in relies on the diff-lcs gem.
==Installation
====
install it as any other plug-in and be sure to include the provided sample css or
your own css rules to the applications-stylesheet.
==Example
====
in your view simply call:
<%= diff(@difftest.old, @difftest.new) %>
which results in:
<tr><td>1. </td><td><pre class="only_a">require 'digest/sha1'</pre></td><td><pre class="only_b">require 'digest/sha2'</pre></td><td>1. </td></tr>
<tr><td>2. </td><td colspan="2"><pre class="match"></pre></td><td>2. </td></tr>
<tr><td>3. </td><td colspan="2"><pre class="match">class User < ActiveRecord::Base</pre></td><td>3. </td></tr>
...
==Credits
====
diff-lcs author and the provided exampels ;)
==ToDo
====
Tests...
Copyright (c) 2008 [Johannes / [email protected]], released under the MIT license