diffy 3.3.0 → 3.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of diffy might be problematic. Click here for more details.
- checksums.yaml +5 -5
- data/README.md +9 -0
- data/lib/diffy/diff.rb +1 -1
- data/lib/diffy/html_formatter.rb +8 -4
- data/lib/diffy/version.rb +1 -1
- data/spec/diffy_spec.rb +7 -0
- metadata +6 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: ce6a165c4ad246372cf5e6888ca531c55da86a43051895900df4e466cef6c940
|
4
|
+
data.tar.gz: 066c70ac2cbd41e1d34c2a9fc68f9ba9b4cc1ccea132e289638c5aeb927c0ad6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 911e04010bddf3a49726684822857ffdc1f05b62017367afef5e022f56b2eeecf618282bf40f381901bbded973c06f2273cecb1ada0292f94337cfc2690a3d4a
|
7
|
+
data.tar.gz: a41fa95586a3f16ddcc19e5f3bbd6682d492cb4b0b44b1e6c16fcbd2556cd453d931720458d842caf04610a83067fb4b4daa86eef6010aa0f9d4da9110307cbd
|
data/README.md
CHANGED
@@ -277,6 +277,15 @@ combined with the `:context` option.
|
|
277
277
|
foo
|
278
278
|
bar
|
279
279
|
|
280
|
+
### `:ignore_crlf` when doing HTML compares
|
281
|
+
|
282
|
+
You can make the HTML output ignore the CRLF by passing the `:ignore_crlf` option a truthy value.
|
283
|
+
|
284
|
+
>> puts Diffy::Diff.new(" foo\nbar\n", "foo\r\nbar\r\n", ignore_crlf: true).to_s(:html)
|
285
|
+
"<div class=\"diff\"></div>"
|
286
|
+
|
287
|
+
|
288
|
+
|
280
289
|
Default Diff Options
|
281
290
|
--------------------
|
282
291
|
|
data/lib/diffy/diff.rb
CHANGED
data/lib/diffy/html_formatter.rb
CHANGED
@@ -90,10 +90,14 @@ module Diffy
|
|
90
90
|
|
91
91
|
def split_characters(chunk)
|
92
92
|
chunk.gsub(/^./, '').each_line.map do |line|
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
93
|
+
if @options[:ignore_crlf]
|
94
|
+
(line.chomp.split('') + ['\n']).map{|chr| ERB::Util.h(chr) }
|
95
|
+
else
|
96
|
+
chars = line.sub(/([\r\n]$)/, '').split('')
|
97
|
+
# add escaped newlines
|
98
|
+
chars << '\n'
|
99
|
+
chars.map{|chr| ERB::Util.h(chr) }
|
100
|
+
end
|
97
101
|
end.flatten.join("\n") + "\n"
|
98
102
|
end
|
99
103
|
|
data/lib/diffy/version.rb
CHANGED
data/spec/diffy_spec.rb
CHANGED
@@ -503,6 +503,13 @@ baz
|
|
503
503
|
expect(@diff.to_s(:html)).to eq(html)
|
504
504
|
end
|
505
505
|
|
506
|
+
it "should treat unix vs windows newlines as same if option :ignore_crlf" do
|
507
|
+
@diff = Diffy::Diff.new("one\ntwo\nthree\n", "one\r\ntwo\r\nthree\r\n",
|
508
|
+
ignore_crlf: true)
|
509
|
+
empty_diff = "<div class=\"diff\"></div>"
|
510
|
+
expect(@diff.to_s(:html)).to eq(empty_diff)
|
511
|
+
end
|
512
|
+
|
506
513
|
describe 'with lines that include \n' do
|
507
514
|
before do
|
508
515
|
string1 = 'a\nb'"\n"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: diffy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sam Goldstein
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-08-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -68,7 +68,7 @@ homepage: http://github.com/samg/diffy
|
|
68
68
|
licenses:
|
69
69
|
- MIT
|
70
70
|
metadata: {}
|
71
|
-
post_install_message:
|
71
|
+
post_install_message:
|
72
72
|
rdoc_options: []
|
73
73
|
require_paths:
|
74
74
|
- lib
|
@@ -83,9 +83,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
83
83
|
- !ruby/object:Gem::Version
|
84
84
|
version: '0'
|
85
85
|
requirements: []
|
86
|
-
|
87
|
-
|
88
|
-
signing_key:
|
86
|
+
rubygems_version: 3.0.6
|
87
|
+
signing_key:
|
89
88
|
specification_version: 4
|
90
89
|
summary: A convenient way to diff string in ruby
|
91
90
|
test_files:
|