hyp_diff 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 2ddcbe306c71c3ed8cf653ae08042e6b9b22189a
4
+ data.tar.gz: 98c92e73576764d907ed40ae27860bc691779fb4
5
+ SHA512:
6
+ metadata.gz: 7e1409658fa73b7c63d0cfe6294661ae0c1dd25d26347bdf2b65c2bdfca5cfc49be17f5c01994713cc5323157814932b9b3453ae227ed37318945c21e13f0b0e
7
+ data.tar.gz: 5bce9f5fe68120ccadcd33898b3f682a6a23e45015b7adf00212742fb218f4825373f94f3d18885a29ea11824bfebbc2f6644f6671c9e7ea92a732d1a14c90f5
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.0.0
4
+ script: bundle exec rspec
data/README.md CHANGED
@@ -1,27 +1,15 @@
1
1
  # HypDiff
2
2
 
3
+ [![Build Status](https://travis-ci.org/krishan/hyp_diff.svg?branch=master)](https://travis-ci.org/krishan/hyp_diff)
4
+
3
5
  HypDiff compares HTML snippets. It generates a diff between two input snippets. The diff is a new HTML snippet that highlights textual changes. The tag structure and formatting of the input snippets is preserved. The generated diff snippet is valid, well-formed HTML and suitable for presentation inside a WYSIWYG environment.
4
6
 
5
- ## Usage
7
+ ## Basic Usage
6
8
 
7
- # compare using the defaults: <ins> and <del> tags are inserted into the markup
8
- HypDiff.compare("<p>byebye world</p>", "<p>hello world</p>")
9
- # => '<p><del>byebye</del><ins>hello</ins> world</p> '
9
+ Compare two HTML snippets:
10
10
 
11
- # use custom markup by providing callbacks for rendering insertions and deletions
12
- HypDiff.compare("<p>byebye world</p>", "<p>hello world</p>",
13
- render_insertion: proc { |html| "<span data-diff='ins'>#{html}</span>" },
14
- render_deletion: proc { |html| "<span data-diff='del'>#{html}</span>" }
15
- )
16
- # '<p><span data-diff='del'>byebye</span><span data-diff='ins'>hello</span> world</p> '
17
-
18
- # choose which markup should be the basis for the results:
19
- HypDiff.compare("<div>byebye world</div>", "<p>hello world</p>", markup_from: "before")
20
- # => '<div><del>byebye</del><ins>hello</ins> world</div> '
21
- HypDiff.compare("<div>byebye world</div>", "<p>hello world</p>", markup_from: "after")
22
- # => '<p><del>byebye</del><ins>hello</ins> world</p> '
23
-
24
- For more examples, take a look at the [specs](https://github.com/krishan/hyp_diff/blob/master/spec/hyp_diff_spec.rb).
11
+ HypDiff.compare("<p>byebye world</p>", "<p>hello world</p>")
12
+ => '<p><del>byebye</del><ins>hello</ins> world</p>'
25
13
 
26
14
  ## Why another diff tool?
27
15
 
@@ -39,6 +27,23 @@ HypDiff does not rely on regular expressions, but actually parses the input snip
39
27
 
40
28
  HypDiff does not perform a comparison of the html source code or the DOM tree, but compares changes to visible text. It does not care about changes that do not involve visible text.
41
29
 
30
+ ## Advanced Usage
31
+
32
+ # use custom markup by providing callbacks for rendering insertions and deletions
33
+ HypDiff.compare("<p>byebye world</p>", "<p>hello world</p>",
34
+ render_insertion: proc { |html| "<span data-diff='ins'>#{html}</span>" },
35
+ render_deletion: proc { |html| "<span data-diff='del'>#{html}</span>" }
36
+ )
37
+ # '<p><span data-diff='del'>byebye</span><span data-diff='ins'>hello</span> world</p> '
38
+
39
+ # choose which markup should be the basis for the results:
40
+ HypDiff.compare("<div>byebye world</div>", "<p>hello world</p>", markup_from: "before")
41
+ # => '<div><del>byebye</del><ins>hello</ins> world</div> '
42
+ HypDiff.compare("<div>byebye world</div>", "<p>hello world</p>", markup_from: "after")
43
+ # => '<p><del>byebye</del><ins>hello</ins> world</p> '
44
+
45
+ For more examples, take a look at the [specs](https://github.com/krishan/hyp_diff/blob/master/spec/hyp_diff_spec.rb).
46
+
42
47
  ## Installation
43
48
 
44
49
  Add this line to your application's Gemfile:
@@ -20,7 +20,7 @@ HypDiff compares HTML snippets. It generates a diff between two input snippets.
20
20
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
21
21
  spec.require_paths = ["lib"]
22
22
 
23
- spec.add_dependency "nokogiri", "~> 1.5.6"
23
+ spec.add_dependency "nokogiri", "~> 1.6.5"
24
24
  spec.add_dependency "diff-lcs", "~> 1.2.5"
25
25
 
26
26
  spec.add_development_dependency "bundler", "~> 1.5"
@@ -1,3 +1,3 @@
1
1
  module HypDiff
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
@@ -1,3 +1,4 @@
1
+ # encoding: utf-8
1
2
  require "hyp_diff"
2
3
 
3
4
  describe HypDiff do
@@ -111,7 +112,7 @@ describe HypDiff do
111
112
  expect_diff(
112
113
  "f&#252; b&#228;r",
113
114
  "f&#246; b&#228;r",
114
- "<del>f&#252;</del><ins>f&#246;</ins> b&#228;r"
115
+ "<del>fü</del><ins>fö</ins> bär"
115
116
  )
116
117
  end
117
118
  end
metadata CHANGED
@@ -1,36 +1,32 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hyp_diff
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
5
- prerelease:
4
+ version: 0.0.4
6
5
  platform: ruby
7
6
  authors:
8
7
  - Kristian Hanekamp
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2014-04-01 00:00:00.000000000 Z
11
+ date: 2015-02-02 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: nokogiri
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - ~>
20
18
  - !ruby/object:Gem::Version
21
- version: 1.5.6
19
+ version: 1.6.5
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
24
  - - ~>
28
25
  - !ruby/object:Gem::Version
29
- version: 1.5.6
26
+ version: 1.6.5
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: diff-lcs
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
31
  - - ~>
36
32
  - !ruby/object:Gem::Version
@@ -38,7 +34,6 @@ dependencies:
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
38
  - - ~>
44
39
  - !ruby/object:Gem::Version
@@ -46,7 +41,6 @@ dependencies:
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: bundler
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
45
  - - ~>
52
46
  - !ruby/object:Gem::Version
@@ -54,7 +48,6 @@ dependencies:
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
52
  - - ~>
60
53
  - !ruby/object:Gem::Version
@@ -62,7 +55,6 @@ dependencies:
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: rspec
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
59
  - - ~>
68
60
  - !ruby/object:Gem::Version
@@ -70,7 +62,6 @@ dependencies:
70
62
  type: :development
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
66
  - - ~>
76
67
  - !ruby/object:Gem::Version
@@ -78,7 +69,6 @@ dependencies:
78
69
  - !ruby/object:Gem::Dependency
79
70
  name: rake
80
71
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
72
  requirements:
83
73
  - - ~>
84
74
  - !ruby/object:Gem::Version
@@ -86,15 +76,14 @@ dependencies:
86
76
  type: :development
87
77
  prerelease: false
88
78
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
79
  requirements:
91
80
  - - ~>
92
81
  - !ruby/object:Gem::Version
93
82
  version: '10.1'
94
- description: ! "\nHypDiff compares HTML snippets. It generates a diff between two
95
- input snippets. The diff is a new HTML snippet that highlights textual changes.
96
- The tag structure and formatting of the input snippets is preserved. The generated
97
- diff snippet is valid, well-formed HTML and suitable for presentation inside a WYSIWYG
83
+ description: "\nHypDiff compares HTML snippets. It generates a diff between two input
84
+ snippets. The diff is a new HTML snippet that highlights textual changes. The tag
85
+ structure and formatting of the input snippets is preserved. The generated diff
86
+ snippet is valid, well-formed HTML and suitable for presentation inside a WYSIWYG
98
87
  environment.\n "
99
88
  email:
100
89
  - kris.hanekamp@gmail.com
@@ -103,6 +92,7 @@ extensions: []
103
92
  extra_rdoc_files: []
104
93
  files:
105
94
  - .gitignore
95
+ - .travis.yml
106
96
  - .yardopts
107
97
  - Gemfile
108
98
  - LICENSE.txt
@@ -118,33 +108,26 @@ files:
118
108
  homepage: https://github.com/krishan/hyp_diff
119
109
  licenses:
120
110
  - MIT
111
+ metadata: {}
121
112
  post_install_message:
122
113
  rdoc_options: []
123
114
  require_paths:
124
115
  - lib
125
116
  required_ruby_version: !ruby/object:Gem::Requirement
126
- none: false
127
117
  requirements:
128
- - - ! '>='
118
+ - - '>='
129
119
  - !ruby/object:Gem::Version
130
120
  version: '0'
131
- segments:
132
- - 0
133
- hash: -2073153059126079532
134
121
  required_rubygems_version: !ruby/object:Gem::Requirement
135
- none: false
136
122
  requirements:
137
- - - ! '>='
123
+ - - '>='
138
124
  - !ruby/object:Gem::Version
139
125
  version: '0'
140
- segments:
141
- - 0
142
- hash: -2073153059126079532
143
126
  requirements: []
144
127
  rubyforge_project:
145
- rubygems_version: 1.8.23
128
+ rubygems_version: 2.0.14
146
129
  signing_key:
147
- specification_version: 3
130
+ specification_version: 4
148
131
  summary: HypDiff compares html snippets
149
132
  test_files:
150
133
  - spec/hyp_diff_spec.rb