docdiff 0.6.1 → 0.6.2
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.
- checksums.yaml +4 -4
- data/bin/docdiff +16 -2
- data/docdiff.gemspec +1 -1
- data/lib/docdiff/charstring.rb +4 -3
- data/lib/docdiff/diff/unidiff.rb +0 -1
- data/lib/docdiff/encoding/en_ascii.rb +12 -39
- data/lib/docdiff/encoding/ja_eucjp.rb +12 -39
- data/lib/docdiff/encoding/ja_sjis.rb +12 -39
- data/lib/docdiff/encoding/ja_utf8.rb +12 -39
- data/lib/docdiff/version.rb +1 -1
- data/lib/docdiff/view.rb +12 -4
- data/readme.html +18 -1
- data/readme.md +2 -1
- data/test/charstring_test.rb +3 -0
- data/test/docdiff_test.rb +4 -2
- data/test/document_test.rb +3 -0
- metadata +4 -9
- data/lib/viewdiff.rb +0 -379
- data/test/viewdiff_test.rb +0 -911
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 75d0326eaf0ebe880d161beb18ccf549b7965ac0e31131b5ed860b942616d66c
|
|
4
|
+
data.tar.gz: c30d0a6a0a5cb1520d91ebdae8a0997b3ac364072c212a2be5f651b94f7b458b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 970b172f3c9e00967a7cb79113367b7036cf900afdf122f25fc36224dc31550626d7f6f8408ad12ff7fff58e0b91d2ff730b26d58f7603d040a8302d399d78b1
|
|
7
|
+
data.tar.gz: ac729648506f82b4a462d3657247dce15579a26aa247f9166408f8da9b40ff9567df8dc66f1d56fb4f215c82ffcaaac4940cfdd368adb49b57f05f5ff679e4c0
|
data/bin/docdiff
CHANGED
|
@@ -84,6 +84,8 @@ ARGV.options {|o|
|
|
|
84
84
|
o.def_option('--cache', 'use file cache (not supported yet)'){clo[:cache] = true}
|
|
85
85
|
o.def_option('--no-config-file',
|
|
86
86
|
'do not read config files'){clo[:no_config_file] = true}
|
|
87
|
+
o.def_option('--config-file=FILE',
|
|
88
|
+
'specify config file to read'){|s| clo[:config_file] = s}
|
|
87
89
|
o.def_option('--verbose', 'run verbosely (not supported yet)'){clo[:verbose] = true}
|
|
88
90
|
|
|
89
91
|
o.def_option('--help', 'show this message'){puts o; exit(0)}
|
|
@@ -117,6 +119,16 @@ unless clo[:no_config_file] == true # process_commandline_option
|
|
|
117
119
|
STDERR.print message
|
|
118
120
|
end
|
|
119
121
|
end
|
|
122
|
+
unless clo[:config_file].nil?
|
|
123
|
+
if File.exist?(clo[:config_file])
|
|
124
|
+
message = docdiff.process_config_file(clo[:config_file])
|
|
125
|
+
else
|
|
126
|
+
raise "#{clo[:config_file]} does not exist."
|
|
127
|
+
end
|
|
128
|
+
if clo[:verbose] == true || docdiff.config[:verbose] == true
|
|
129
|
+
STDERR.pring message
|
|
130
|
+
end
|
|
131
|
+
end
|
|
120
132
|
docdiff.config.update(clo)
|
|
121
133
|
|
|
122
134
|
# config stuff done
|
|
@@ -127,10 +139,12 @@ file1_content = nil
|
|
|
127
139
|
file2_content = nil
|
|
128
140
|
raise "Try `#{File.basename($0)} --help' for more information." if ARGV[0].nil?
|
|
129
141
|
raise "Specify at least 2 target files." unless ARGV[0] && ARGV[1]
|
|
142
|
+
ARGV[0] = "/dev/stdin" if ARGV[0] == "-"
|
|
143
|
+
ARGV[1] = "/dev/stdin" if ARGV[1] == "-"
|
|
130
144
|
raise "No such file: #{ARGV[0]}." unless FileTest.exist?(ARGV[0])
|
|
131
145
|
raise "No such file: #{ARGV[1]}." unless FileTest.exist?(ARGV[1])
|
|
132
|
-
raise "#{ARGV[0]} is not
|
|
133
|
-
raise "#{ARGV[1]} is not
|
|
146
|
+
raise "#{ARGV[0]} is not readable." unless FileTest.readable?(ARGV[0])
|
|
147
|
+
raise "#{ARGV[1]} is not readable." unless FileTest.readable?(ARGV[1])
|
|
134
148
|
File.open(ARGV[0], "r"){|f| file1_content = f.read}
|
|
135
149
|
File.open(ARGV[1], "r"){|f| file2_content = f.read}
|
|
136
150
|
|
data/docdiff.gemspec
CHANGED
|
@@ -7,7 +7,7 @@ Gem::Specification.new do |s|
|
|
|
7
7
|
s.version = Docdiff::VERSION
|
|
8
8
|
s.license = "BSD-3-Clause"
|
|
9
9
|
s.authors = ["Hisashi Morita"]
|
|
10
|
-
s.email = ["hisashim
|
|
10
|
+
s.email = ["hisashim@icloud.com"]
|
|
11
11
|
s.homepage = "https://github.com/hisashim/docdiff"
|
|
12
12
|
s.summary = %q{Word-by-word diff}
|
|
13
13
|
s.description = %q{DocDiff compares two text files and shows the
|
data/lib/docdiff/charstring.rb
CHANGED
|
@@ -231,10 +231,11 @@ module CharString
|
|
|
231
231
|
end
|
|
232
232
|
|
|
233
233
|
def count_graph_line()
|
|
234
|
+
graph = (Encodings['UTF-8']::GRAPH +
|
|
235
|
+
Encodings['UTF-8']::JA_GRAPH).chars.uniq.join
|
|
236
|
+
re_graph = Regexp.new("[#{Regexp.quote(graph)}]", Regexp::MULTILINE)
|
|
234
237
|
split_to_line.collect{|line|
|
|
235
|
-
line if
|
|
236
|
-
"#{Encodings['UTF-8']::JA_GRAPH}]",
|
|
237
|
-
Regexp::MULTILINE).match line.encode('UTF-8')
|
|
238
|
+
line if re_graph.match line.encode('UTF-8')
|
|
238
239
|
}.compact.size
|
|
239
240
|
end
|
|
240
241
|
|
data/lib/docdiff/diff/unidiff.rb
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# English ASCII encoding module for CharString
|
|
2
2
|
# 2003- Hisashi MORITA
|
|
3
3
|
|
|
4
|
+
# frozen_string_literal: false
|
|
5
|
+
|
|
4
6
|
class DocDiff
|
|
5
7
|
module CharString
|
|
6
8
|
module ASCII
|
|
@@ -14,50 +16,21 @@ module CharString
|
|
|
14
16
|
SPACE = "\x09\x0a\x0b\x0c\x0d\x20"
|
|
15
17
|
BLANK = "\x09\x20"
|
|
16
18
|
DIGIT = "\x30\x31\x32\x33\x34\x35\x36\x37\x38\x39"
|
|
17
|
-
|
|
18
|
-
"\x4b\x4c\x4d\x4e\x4f\x50\x51\x52\x53\x54" \
|
|
19
|
-
"\x55\x56\x57\x58\x59\x5a\x61\x62\x63\x64" \
|
|
20
|
-
"\x65\x66\x67\x68\x69\x6a\x6b\x6c\x6d\x6e" \
|
|
21
|
-
"\x6f\x70\x71\x72\x73\x74\x75\x76\x77\x78" \
|
|
22
|
-
"\x79\x7a"
|
|
23
|
-
ALNUM = "\x30\x31\x32\x33\x34\x35\x36\x37\x38\x39" \
|
|
24
|
-
"\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4a" \
|
|
19
|
+
UPPER = "\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4a" \
|
|
25
20
|
"\x4b\x4c\x4d\x4e\x4f\x50\x51\x52\x53\x54" \
|
|
26
|
-
"\x55\x56\x57\x58\x59\x5a
|
|
27
|
-
|
|
28
|
-
"\x6f\x70\x71\x72\x73\x74
|
|
29
|
-
"\x79\x7a"
|
|
21
|
+
"\x55\x56\x57\x58\x59\x5a"
|
|
22
|
+
LOWER = "\x61\x62\x63\x64\x65\x66\x67\x68\x69\x6a" \
|
|
23
|
+
"\x6b\x6c\x6d\x6e\x6f\x70\x71\x72\x73\x74" \
|
|
24
|
+
"\x75\x76\x77\x78\x79\x7a"
|
|
25
|
+
ALPHA = UPPER + LOWER
|
|
26
|
+
ALNUM = DIGIT + ALPHA
|
|
30
27
|
PUNCT = "\x21\x22\x23\x24\x25\x26\x27\x28\x29\x2a" \
|
|
31
28
|
"\x2b\x2c\x2d\x2e\x2f\x3a\x3b\x3c\x3d\x3e" \
|
|
32
29
|
"\x3f\x40\x5b\x5c\x5d\x5e\x5f\x60\x7b\x7c" \
|
|
33
30
|
"\x7d\x7e"
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
UPPER = "\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4a" \
|
|
38
|
-
"\x4b\x4c\x4d\x4e\x4f\x50\x51\x52\x53\x54" \
|
|
39
|
-
"\x55\x56\x57\x58\x59\x5a"
|
|
40
|
-
PRINT = "\x20\x21\x22\x23\x24\x25\x26\x27\x28\x29" \
|
|
41
|
-
"\x2a\x2b\x2c\x2d\x2e\x2f\x30\x31\x32\x33" \
|
|
42
|
-
"\x34\x35\x36\x37\x38\x39\x3a\x3b\x3c\x3d" \
|
|
43
|
-
"\x3e\x3f\x40\x41\x42\x43\x44\x45\x46\x47" \
|
|
44
|
-
"\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f\x50\x51" \
|
|
45
|
-
"\x52\x53\x54\x55\x56\x57\x58\x59\x5a\x5b" \
|
|
46
|
-
"\x5c\x5d\x5e\x5f\x60\x61\x62\x63\x64\x65" \
|
|
47
|
-
"\x66\x67\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f" \
|
|
48
|
-
"\x70\x71\x72\x73\x74\x75\x76\x77\x78\x79" \
|
|
49
|
-
"\x7a\x7b\x7c\x7d\x7e"
|
|
50
|
-
GRAPH = "\x21\x22\x23\x24\x25\x26\x27\x28\x29\x2a" \
|
|
51
|
-
"\x2b\x2c\x2d\x2e\x2f\x30\x31\x32\x33\x34" \
|
|
52
|
-
"\x35\x36\x37\x38\x39\x3a\x3b\x3c\x3d\x3e" \
|
|
53
|
-
"\x3f\x40\x41\x42\x43\x44\x45\x46\x47\x48" \
|
|
54
|
-
"\x49\x4a\x4b\x4c\x4d\x4e\x4f\x50\x51\x52" \
|
|
55
|
-
"\x53\x54\x55\x56\x57\x58\x59\x5a\x5b\x5c" \
|
|
56
|
-
"\x5d\x5e\x5f\x60\x61\x62\x63\x64\x65\x66" \
|
|
57
|
-
"\x67\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f\x70" \
|
|
58
|
-
"\x71\x72\x73\x74\x75\x76\x77\x78\x79\x7a" \
|
|
59
|
-
"\x7b\x7c\x7d\x7e"
|
|
60
|
-
XDIGIT = "\x30\x31\x32\x33\x34\x35\x36\x37\x38\x39" \
|
|
31
|
+
GRAPH = DIGIT + UPPER + LOWER + PUNCT
|
|
32
|
+
PRINT = "\x20" + GRAPH
|
|
33
|
+
XDIGIT = DIGIT +
|
|
61
34
|
"\x41\x42\x43\x44\x45\x46\x61\x62\x63\x64" \
|
|
62
35
|
"\x65\x66"
|
|
63
36
|
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# Japanese EUC-JP encoding module for CharString
|
|
2
2
|
# 2003- Hisashi MORITA
|
|
3
3
|
|
|
4
|
+
# frozen_string_literal: false
|
|
5
|
+
|
|
4
6
|
class DocDiff
|
|
5
7
|
module CharString
|
|
6
8
|
module EUC_JP
|
|
@@ -17,50 +19,21 @@ module CharString
|
|
|
17
19
|
SPACE = "\x09\x0a\x0b\x0c\x0d\x20"
|
|
18
20
|
BLANK = "\x09\x20"
|
|
19
21
|
DIGIT = "\x30\x31\x32\x33\x34\x35\x36\x37\x38\x39"
|
|
20
|
-
|
|
21
|
-
"\x4b\x4c\x4d\x4e\x4f\x50\x51\x52\x53\x54" \
|
|
22
|
-
"\x55\x56\x57\x58\x59\x5a\x61\x62\x63\x64" \
|
|
23
|
-
"\x65\x66\x67\x68\x69\x6a\x6b\x6c\x6d\x6e" \
|
|
24
|
-
"\x6f\x70\x71\x72\x73\x74\x75\x76\x77\x78" \
|
|
25
|
-
"\x79\x7a"
|
|
26
|
-
ALNUM = "\x30\x31\x32\x33\x34\x35\x36\x37\x38\x39" \
|
|
27
|
-
"\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4a" \
|
|
22
|
+
UPPER = "\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4a" \
|
|
28
23
|
"\x4b\x4c\x4d\x4e\x4f\x50\x51\x52\x53\x54" \
|
|
29
|
-
"\x55\x56\x57\x58\x59\x5a
|
|
30
|
-
|
|
31
|
-
"\x6f\x70\x71\x72\x73\x74
|
|
32
|
-
"\x79\x7a"
|
|
24
|
+
"\x55\x56\x57\x58\x59\x5a"
|
|
25
|
+
LOWER = "\x61\x62\x63\x64\x65\x66\x67\x68\x69\x6a" \
|
|
26
|
+
"\x6b\x6c\x6d\x6e\x6f\x70\x71\x72\x73\x74" \
|
|
27
|
+
"\x75\x76\x77\x78\x79\x7a"
|
|
28
|
+
ALPHA = UPPER + LOWER
|
|
29
|
+
ALNUM = DIGIT + ALPHA
|
|
33
30
|
PUNCT = "\x21\x22\x23\x24\x25\x26\x27\x28\x29\x2a" \
|
|
34
31
|
"\x2b\x2c\x2d\x2e\x2f\x3a\x3b\x3c\x3d\x3e" \
|
|
35
32
|
"\x3f\x40\x5b\x5c\x5d\x5e\x5f\x60\x7b\x7c" \
|
|
36
33
|
"\x7d\x7e"
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
UPPER = "\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4a" \
|
|
41
|
-
"\x4b\x4c\x4d\x4e\x4f\x50\x51\x52\x53\x54" \
|
|
42
|
-
"\x55\x56\x57\x58\x59\x5a"
|
|
43
|
-
PRINT = "\x20\x21\x22\x23\x24\x25\x26\x27\x28\x29" \
|
|
44
|
-
"\x2a\x2b\x2c\x2d\x2e\x2f\x30\x31\x32\x33" \
|
|
45
|
-
"\x34\x35\x36\x37\x38\x39\x3a\x3b\x3c\x3d" \
|
|
46
|
-
"\x3e\x3f\x40\x41\x42\x43\x44\x45\x46\x47" \
|
|
47
|
-
"\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f\x50\x51" \
|
|
48
|
-
"\x52\x53\x54\x55\x56\x57\x58\x59\x5a\x5b" \
|
|
49
|
-
"\x5c\x5d\x5e\x5f\x60\x61\x62\x63\x64\x65" \
|
|
50
|
-
"\x66\x67\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f" \
|
|
51
|
-
"\x70\x71\x72\x73\x74\x75\x76\x77\x78\x79" \
|
|
52
|
-
"\x7a\x7b\x7c\x7d\x7e"
|
|
53
|
-
GRAPH = "\x21\x22\x23\x24\x25\x26\x27\x28\x29\x2a" \
|
|
54
|
-
"\x2b\x2c\x2d\x2e\x2f\x30\x31\x32\x33\x34" \
|
|
55
|
-
"\x35\x36\x37\x38\x39\x3a\x3b\x3c\x3d\x3e" \
|
|
56
|
-
"\x3f\x40\x41\x42\x43\x44\x45\x46\x47\x48" \
|
|
57
|
-
"\x49\x4a\x4b\x4c\x4d\x4e\x4f\x50\x51\x52" \
|
|
58
|
-
"\x53\x54\x55\x56\x57\x58\x59\x5a\x5b\x5c" \
|
|
59
|
-
"\x5d\x5e\x5f\x60\x61\x62\x63\x64\x65\x66" \
|
|
60
|
-
"\x67\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f\x70" \
|
|
61
|
-
"\x71\x72\x73\x74\x75\x76\x77\x78\x79\x7a" \
|
|
62
|
-
"\x7b\x7c\x7d\x7e"
|
|
63
|
-
XDIGIT = "\x30\x31\x32\x33\x34\x35\x36\x37\x38\x39" \
|
|
34
|
+
GRAPH = DIGIT + UPPER + LOWER + PUNCT
|
|
35
|
+
PRINT = "\x20" + GRAPH
|
|
36
|
+
XDIGIT = DIGIT +
|
|
64
37
|
"\x41\x42\x43\x44\x45\x46\x61\x62\x63\x64" \
|
|
65
38
|
"\x65\x66"
|
|
66
39
|
JA_SPACE = "\xa1\xa1"
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# Japanese Shift_JIS encoding module for CharString
|
|
2
2
|
# 2003- Hisashi MORITA
|
|
3
3
|
|
|
4
|
+
# frozen_string_literal: false
|
|
5
|
+
|
|
4
6
|
class DocDiff
|
|
5
7
|
module CharString
|
|
6
8
|
module Shift_JIS
|
|
@@ -17,50 +19,21 @@ module CharString
|
|
|
17
19
|
SPACE = "\x09\x0a\x0b\x0c\x0d\x20"
|
|
18
20
|
BLANK = "\x09\x20"
|
|
19
21
|
DIGIT = "\x30\x31\x32\x33\x34\x35\x36\x37\x38\x39"
|
|
20
|
-
|
|
21
|
-
"\x4b\x4c\x4d\x4e\x4f\x50\x51\x52\x53\x54" \
|
|
22
|
-
"\x55\x56\x57\x58\x59\x5a\x61\x62\x63\x64" \
|
|
23
|
-
"\x65\x66\x67\x68\x69\x6a\x6b\x6c\x6d\x6e" \
|
|
24
|
-
"\x6f\x70\x71\x72\x73\x74\x75\x76\x77\x78" \
|
|
25
|
-
"\x79\x7a"
|
|
26
|
-
ALNUM = "\x30\x31\x32\x33\x34\x35\x36\x37\x38\x39" \
|
|
27
|
-
"\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4a" \
|
|
22
|
+
UPPER = "\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4a" \
|
|
28
23
|
"\x4b\x4c\x4d\x4e\x4f\x50\x51\x52\x53\x54" \
|
|
29
|
-
"\x55\x56\x57\x58\x59\x5a
|
|
30
|
-
|
|
31
|
-
"\x6f\x70\x71\x72\x73\x74
|
|
32
|
-
"\x79\x7a"
|
|
24
|
+
"\x55\x56\x57\x58\x59\x5a"
|
|
25
|
+
LOWER = "\x61\x62\x63\x64\x65\x66\x67\x68\x69\x6a" \
|
|
26
|
+
"\x6b\x6c\x6d\x6e\x6f\x70\x71\x72\x73\x74" \
|
|
27
|
+
"\x75\x76\x77\x78\x79\x7a"
|
|
28
|
+
ALPHA = UPPER + LOWER
|
|
29
|
+
ALNUM = DIGIT + ALPHA
|
|
33
30
|
PUNCT = "\x21\x22\x23\x24\x25\x26\x27\x28\x29\x2a" \
|
|
34
31
|
"\x2b\x2c\x2d\x2e\x2f\x3a\x3b\x3c\x3d\x3e" \
|
|
35
32
|
"\x3f\x40\x5b\x5c\x5d\x5e\x5f\x60\x7b\x7c" \
|
|
36
33
|
"\x7d\x7e"
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
UPPER = "\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4a" \
|
|
41
|
-
"\x4b\x4c\x4d\x4e\x4f\x50\x51\x52\x53\x54" \
|
|
42
|
-
"\x55\x56\x57\x58\x59\x5a"
|
|
43
|
-
PRINT = "\x20\x21\x22\x23\x24\x25\x26\x27\x28\x29" \
|
|
44
|
-
"\x2a\x2b\x2c\x2d\x2e\x2f\x30\x31\x32\x33" \
|
|
45
|
-
"\x34\x35\x36\x37\x38\x39\x3a\x3b\x3c\x3d" \
|
|
46
|
-
"\x3e\x3f\x40\x41\x42\x43\x44\x45\x46\x47" \
|
|
47
|
-
"\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f\x50\x51" \
|
|
48
|
-
"\x52\x53\x54\x55\x56\x57\x58\x59\x5a\x5b" \
|
|
49
|
-
"\x5c\x5d\x5e\x5f\x60\x61\x62\x63\x64\x65" \
|
|
50
|
-
"\x66\x67\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f" \
|
|
51
|
-
"\x70\x71\x72\x73\x74\x75\x76\x77\x78\x79" \
|
|
52
|
-
"\x7a\x7b\x7c\x7d\x7e"
|
|
53
|
-
GRAPH = "\x21\x22\x23\x24\x25\x26\x27\x28\x29\x2a" \
|
|
54
|
-
"\x2b\x2c\x2d\x2e\x2f\x30\x31\x32\x33\x34" \
|
|
55
|
-
"\x35\x36\x37\x38\x39\x3a\x3b\x3c\x3d\x3e" \
|
|
56
|
-
"\x3f\x40\x41\x42\x43\x44\x45\x46\x47\x48" \
|
|
57
|
-
"\x49\x4a\x4b\x4c\x4d\x4e\x4f\x50\x51\x52" \
|
|
58
|
-
"\x53\x54\x55\x56\x57\x58\x59\x5a\x5b\x5c" \
|
|
59
|
-
"\x5d\x5e\x5f\x60\x61\x62\x63\x64\x65\x66" \
|
|
60
|
-
"\x67\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f\x70" \
|
|
61
|
-
"\x71\x72\x73\x74\x75\x76\x77\x78\x79\x7a" \
|
|
62
|
-
"\x7b\x7c\x7d\x7e"
|
|
63
|
-
XDIGIT = "\x30\x31\x32\x33\x34\x35\x36\x37\x38\x39" \
|
|
34
|
+
GRAPH = DIGIT + UPPER + LOWER + PUNCT
|
|
35
|
+
PRINT = "\x20" + GRAPH
|
|
36
|
+
XDIGIT = DIGIT +
|
|
64
37
|
"\x41\x42\x43\x44\x45\x46\x61\x62\x63\x64" \
|
|
65
38
|
"\x65\x66"
|
|
66
39
|
JA_SPACE = "\x81\x40"
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
# Japanese UTF-8 encoding module for CharString
|
|
3
3
|
# 2003- Hisashi MORITA
|
|
4
4
|
|
|
5
|
+
# frozen_string_literal: false
|
|
6
|
+
|
|
5
7
|
class DocDiff
|
|
6
8
|
module CharString
|
|
7
9
|
module UTF8
|
|
@@ -18,50 +20,21 @@ module CharString
|
|
|
18
20
|
SPACE = "\x09\x0a\x0b\x0c\x0d\x20"
|
|
19
21
|
BLANK = "\x09\x20"
|
|
20
22
|
DIGIT = "\x30\x31\x32\x33\x34\x35\x36\x37\x38\x39"
|
|
21
|
-
|
|
22
|
-
"\x4b\x4c\x4d\x4e\x4f\x50\x51\x52\x53\x54" \
|
|
23
|
-
"\x55\x56\x57\x58\x59\x5a\x61\x62\x63\x64" \
|
|
24
|
-
"\x65\x66\x67\x68\x69\x6a\x6b\x6c\x6d\x6e" \
|
|
25
|
-
"\x6f\x70\x71\x72\x73\x74\x75\x76\x77\x78" \
|
|
26
|
-
"\x79\x7a"
|
|
27
|
-
ALNUM = "\x30\x31\x32\x33\x34\x35\x36\x37\x38\x39" \
|
|
28
|
-
"\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4a" \
|
|
23
|
+
UPPER = "\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4a" \
|
|
29
24
|
"\x4b\x4c\x4d\x4e\x4f\x50\x51\x52\x53\x54" \
|
|
30
|
-
"\x55\x56\x57\x58\x59\x5a
|
|
31
|
-
|
|
32
|
-
"\x6f\x70\x71\x72\x73\x74
|
|
33
|
-
"\x79\x7a"
|
|
25
|
+
"\x55\x56\x57\x58\x59\x5a"
|
|
26
|
+
LOWER = "\x61\x62\x63\x64\x65\x66\x67\x68\x69\x6a" \
|
|
27
|
+
"\x6b\x6c\x6d\x6e\x6f\x70\x71\x72\x73\x74" \
|
|
28
|
+
"\x75\x76\x77\x78\x79\x7a"
|
|
29
|
+
ALPHA = UPPER + LOWER
|
|
30
|
+
ALNUM = DIGIT + ALPHA
|
|
34
31
|
PUNCT = "\x21\x22\x23\x24\x25\x26\x27\x28\x29\x2a" \
|
|
35
32
|
"\x2b\x2c\x2d\x2e\x2f\x3a\x3b\x3c\x3d\x3e" \
|
|
36
33
|
"\x3f\x40\x5b\x5c\x5d\x5e\x5f\x60\x7b\x7c" \
|
|
37
34
|
"\x7d\x7e"
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
UPPER = "\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4a" \
|
|
42
|
-
"\x4b\x4c\x4d\x4e\x4f\x50\x51\x52\x53\x54" \
|
|
43
|
-
"\x55\x56\x57\x58\x59\x5a"
|
|
44
|
-
PRINT = "\x20\x21\x22\x23\x24\x25\x26\x27\x28\x29" \
|
|
45
|
-
"\x2a\x2b\x2c\x2d\x2e\x2f\x30\x31\x32\x33" \
|
|
46
|
-
"\x34\x35\x36\x37\x38\x39\x3a\x3b\x3c\x3d" \
|
|
47
|
-
"\x3e\x3f\x40\x41\x42\x43\x44\x45\x46\x47" \
|
|
48
|
-
"\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f\x50\x51" \
|
|
49
|
-
"\x52\x53\x54\x55\x56\x57\x58\x59\x5a\x5b" \
|
|
50
|
-
"\x5c\x5d\x5e\x5f\x60\x61\x62\x63\x64\x65" \
|
|
51
|
-
"\x66\x67\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f" \
|
|
52
|
-
"\x70\x71\x72\x73\x74\x75\x76\x77\x78\x79" \
|
|
53
|
-
"\x7a\x7b\x7c\x7d\x7e"
|
|
54
|
-
GRAPH = "\x21\x22\x23\x24\x25\x26\x27\x28\x29\x2a" \
|
|
55
|
-
"\x2b\x2c\x2d\x2e\x2f\x30\x31\x32\x33\x34" \
|
|
56
|
-
"\x35\x36\x37\x38\x39\x3a\x3b\x3c\x3d\x3e" \
|
|
57
|
-
"\x3f\x40\x41\x42\x43\x44\x45\x46\x47\x48" \
|
|
58
|
-
"\x49\x4a\x4b\x4c\x4d\x4e\x4f\x50\x51\x52" \
|
|
59
|
-
"\x53\x54\x55\x56\x57\x58\x59\x5a\x5b\x5c" \
|
|
60
|
-
"\x5d\x5e\x5f\x60\x61\x62\x63\x64\x65\x66" \
|
|
61
|
-
"\x67\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f\x70" \
|
|
62
|
-
"\x71\x72\x73\x74\x75\x76\x77\x78\x79\x7a" \
|
|
63
|
-
"\x7b\x7c\x7d\x7e"
|
|
64
|
-
XDIGIT = "\x30\x31\x32\x33\x34\x35\x36\x37\x38\x39" \
|
|
35
|
+
GRAPH = DIGIT + UPPER + LOWER + PUNCT
|
|
36
|
+
PRINT = "\x20" + GRAPH
|
|
37
|
+
XDIGIT = DIGIT +
|
|
65
38
|
"\x41\x42\x43\x44\x45\x46\x61\x62\x63\x64" \
|
|
66
39
|
"\x65\x66"
|
|
67
40
|
JA_SPACE = "\xe3\x80\x80"
|
data/lib/docdiff/version.rb
CHANGED
data/lib/docdiff/view.rb
CHANGED
|
@@ -92,10 +92,18 @@ class View
|
|
|
92
92
|
CONTEXT_PRE_LENGTH = 32
|
|
93
93
|
CONTEXT_POST_LENGTH = 32
|
|
94
94
|
def apply_style_digest(tags, headfoot = true)
|
|
95
|
-
cxt_pre_pat
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
95
|
+
cxt_pre_pat =
|
|
96
|
+
if RUBY_VERSION >= "2.3.1"
|
|
97
|
+
Regexp.new('.{0,'+"#{CONTEXT_PRE_LENGTH}"+'}\Z', Regexp::MULTILINE)
|
|
98
|
+
else
|
|
99
|
+
Regexp.new('.{0,'+"#{CONTEXT_PRE_LENGTH}"+'}\Z', Regexp::MULTILINE, encname_for_regexp(@encoding))
|
|
100
|
+
end
|
|
101
|
+
cxt_post_pat =
|
|
102
|
+
if RUBY_VERSION >= "2.3.1"
|
|
103
|
+
Regexp.new('\A.{0,'+"#{CONTEXT_POST_LENGTH}"+'}', Regexp::MULTILINE)
|
|
104
|
+
else
|
|
105
|
+
Regexp.new('\A.{0,'+"#{CONTEXT_POST_LENGTH}"+'}', Regexp::MULTILINE, encname_for_regexp(@encoding))
|
|
106
|
+
end
|
|
99
107
|
display = (tags and tags[:display]) || 'inline'
|
|
100
108
|
result = []
|
|
101
109
|
d1l = doc1_line_number = 1
|
data/readme.html
CHANGED
|
@@ -105,6 +105,17 @@
|
|
|
105
105
|
<li></li>
|
|
106
106
|
</ul></li>
|
|
107
107
|
-->
|
|
108
|
+
<li>0.6.2 (2025-11-28)<ul>
|
|
109
|
+
<li>User-visible changes:<ul>
|
|
110
|
+
<li>Add support for stdin (-) in command line arguments (thanks to tamo)</li>
|
|
111
|
+
<li>Add --config-file option (thanks to tamo)</li>
|
|
112
|
+
<li>Fix incompatibility with Ruby 3.4 Regexp (thanks to yoshuki)</li>
|
|
113
|
+
<li>Resolve frozen literal warnings introduced by Ruby 3.4.</li>
|
|
114
|
+
</ul></li>
|
|
115
|
+
<li>Developer-related changes:<ul>
|
|
116
|
+
<li>Update email address in .gemspec.</li>
|
|
117
|
+
</ul></li>
|
|
118
|
+
</ul></li>
|
|
108
119
|
<li>0.6.1 (2021-06-07)<ul>
|
|
109
120
|
<li>Update information in .gemspec.</li>
|
|
110
121
|
</ul></li>
|
|
@@ -235,7 +246,6 @@
|
|
|
235
246
|
<li>Better auto-recognition of encodings and eols.</li>
|
|
236
247
|
<li>Make CSS and tty escape sequence customizable in config files.</li>
|
|
237
248
|
<li>Better multilingualization using Ruby 1.9 feature.</li>
|
|
238
|
-
<li>Write "DocPatch".</li>
|
|
239
249
|
</ul>
|
|
240
250
|
|
|
241
251
|
<hr />
|
|
@@ -669,6 +679,13 @@ SUCH DAMAGE.
|
|
|
669
679
|
<li>Hiroshi OHKUBO (bug report)</li>
|
|
670
680
|
<li>Shugo MAEDA (bug report)</li>
|
|
671
681
|
<li>Kazuhiko (patch)</li>
|
|
682
|
+
<li>Shintaro Kakutani (patches)</li>
|
|
683
|
+
<li>Masayoshi Takahashi (patches)</li>
|
|
684
|
+
<li>Masakazu Takahashi (patch)</li>
|
|
685
|
+
<li>Hibariya (bug report)</li>
|
|
686
|
+
<li>Hiroshi SHIBATA (patch)</li>
|
|
687
|
+
<li>Tamotsu Takahashi (patches)</li>
|
|
688
|
+
<li>MIKAMI Yoshiyuki (patch)</li>
|
|
672
689
|
</ul>
|
|
673
690
|
|
|
674
691
|
<hr />
|
data/readme.md
CHANGED
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
* Better auto-recognition of encodings and eols.
|
|
9
9
|
* Make CSS and tty escape sequence customizable in config files.
|
|
10
10
|
* Better multilingualization using Ruby 1.9 feature.
|
|
11
|
-
* Write "DocPatch".
|
|
12
11
|
|
|
13
12
|
|
|
14
13
|
## Description
|
|
@@ -149,6 +148,8 @@ See the following for detail.
|
|
|
149
148
|
* Masakazu Takahashi (patch)
|
|
150
149
|
* Hibariya (bug report)
|
|
151
150
|
* Hiroshi SHIBATA (patch)
|
|
151
|
+
* Tamotsu Takahashi (patches)
|
|
152
|
+
* MIKAMI Yoshiyuki (patch)
|
|
152
153
|
|
|
153
154
|
Excuse us this list is far from complete and fails to acknowledge many
|
|
154
155
|
more who have helped us somehow. We really appreciate it.
|
data/test/charstring_test.rb
CHANGED
data/test/docdiff_test.rb
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/ruby
|
|
2
2
|
# -*- coding: us-ascii; -*-
|
|
3
|
+
|
|
4
|
+
# frozen_string_literal: false
|
|
5
|
+
|
|
3
6
|
require 'test/unit'
|
|
4
7
|
require 'docdiff'
|
|
5
8
|
require 'nkf'
|
|
6
9
|
|
|
7
|
-
class
|
|
10
|
+
class TC_DocDiff < Test::Unit::TestCase
|
|
8
11
|
Document = DocDiff::Document
|
|
9
12
|
|
|
10
13
|
def setup()
|
|
@@ -126,7 +129,6 @@ class TC_DocDiff_Document < Test::Unit::TestCase
|
|
|
126
129
|
"",
|
|
127
130
|
nil].join
|
|
128
131
|
expected = {:foo1=>true, :foo2=>"bar baz", :foo3=>123, :foo4=>false}
|
|
129
|
-
docdiff = DocDiff.new
|
|
130
132
|
assert_equal(expected,
|
|
131
133
|
DocDiff.parse_config_file_content(content))
|
|
132
134
|
end
|
data/test/document_test.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: docdiff
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.6.
|
|
4
|
+
version: 0.6.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Hisashi Morita
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies: []
|
|
13
12
|
description: |-
|
|
14
13
|
DocDiff compares two text files and shows the
|
|
@@ -17,7 +16,7 @@ description: |-
|
|
|
17
16
|
several output formats such as HTML, tty, Manued,
|
|
18
17
|
or user-defined markup.
|
|
19
18
|
email:
|
|
20
|
-
- hisashim
|
|
19
|
+
- hisashim@icloud.com
|
|
21
20
|
executables:
|
|
22
21
|
- docdiff
|
|
23
22
|
extensions: []
|
|
@@ -70,7 +69,6 @@ files:
|
|
|
70
69
|
- lib/docdiff/encoding/ja_utf8.rb
|
|
71
70
|
- lib/docdiff/version.rb
|
|
72
71
|
- lib/docdiff/view.rb
|
|
73
|
-
- lib/viewdiff.rb
|
|
74
72
|
- readme.html
|
|
75
73
|
- readme.md
|
|
76
74
|
- sample/01.en.ascii.cr
|
|
@@ -96,12 +94,10 @@ files:
|
|
|
96
94
|
- test/document_test.rb
|
|
97
95
|
- test/test_helper.rb
|
|
98
96
|
- test/view_test.rb
|
|
99
|
-
- test/viewdiff_test.rb
|
|
100
97
|
homepage: https://github.com/hisashim/docdiff
|
|
101
98
|
licenses:
|
|
102
99
|
- BSD-3-Clause
|
|
103
100
|
metadata: {}
|
|
104
|
-
post_install_message:
|
|
105
101
|
rdoc_options: []
|
|
106
102
|
require_paths:
|
|
107
103
|
- lib
|
|
@@ -116,8 +112,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
116
112
|
- !ruby/object:Gem::Version
|
|
117
113
|
version: '0'
|
|
118
114
|
requirements: []
|
|
119
|
-
rubygems_version: 3.
|
|
120
|
-
signing_key:
|
|
115
|
+
rubygems_version: 3.6.9
|
|
121
116
|
specification_version: 4
|
|
122
117
|
summary: Word-by-word diff
|
|
123
118
|
test_files: []
|