docdiff 0.6.1 → 0.6.4
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/Makefile +27 -49
- data/README.md +351 -0
- data/README_ja.md +351 -0
- data/Rakefile +2 -42
- data/bin/docdiff +66 -29
- data/{docdiff.conf.example → doc/example/docdiff.conf.example} +4 -3
- data/doc/man/docdiff.adoc +146 -0
- data/doc/news.md +180 -0
- data/doc/shell_completion/_docdiff.zsh +51 -0
- data/doc/shell_completion/docdiff.bash +68 -0
- data/docdiff.gemspec +2 -1
- data/lib/doc_diff.rb +13 -0
- 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 +16 -8
- data/test/charstring_test.rb +124 -121
- data/test/docdiff_test.rb +5 -3
- data/test/document_test.rb +112 -109
- data/test/fixture/01_ja_utf8_lf.txt +2 -0
- data/test/fixture/02_ja_utf8_lf.txt +2 -0
- data/test/view_test.rb +135 -111
- metadata +41 -43
- data/devutil/changelog.sh +0 -40
- data/index.html +0 -181
- data/langfilter.rb +0 -10
- data/lib/viewdiff.rb +0 -379
- data/readme.html +0 -733
- data/readme.md +0 -184
- data/test/viewdiff_test.rb +0 -911
- /data/{docdiffwebui.cgi → doc/example/docdiffwebui.cgi} +0 -0
- /data/{docdiffwebui.html → doc/example/docdiffwebui.html} +0 -0
- /data/{img/docdiff-screenshot-format-html-digest-firefox.png → doc/img/screenshot-format-html-digest-firefox.png} +0 -0
- /data/{img/docdiff-screenshot-format-html-firefox.png → doc/img/screenshot-format-html-firefox.png} +0 -0
- /data/{img/docdiff-screenshot-format-tty-cmdexe-en.png → doc/img/screenshot-format-tty-cmdexe-en.png} +0 -0
- /data/{img/docdiff-screenshot-format-tty-cmdexe-ja.png → doc/img/screenshot-format-tty-cmdexe-ja.png} +0 -0
- /data/{img/docdiff-screenshot-format-tty-rxvtunicode-en.png → doc/img/screenshot-format-tty-rxvtunicode-en.png} +0 -0
- /data/{img/docdiff-screenshot-format-tty-rxvtunicode-ja.png → doc/img/screenshot-format-tty-rxvtunicode-ja.png} +0 -0
- /data/{img/docdiff-screenshot-format-tty-xterm-en.png → doc/img/screenshot-format-tty-xterm-en.png} +0 -0
- /data/{img/docdiff-screenshot-format-tty-xterm-ja.png → doc/img/screenshot-format-tty-xterm-ja.png} +0 -0
- /data/{img/docdiff-screenshot-resolution-linewordchar-xterm.png → doc/img/screenshot-resolution-linewordchar-xterm.png} +0 -0
- /data/{sample/01.en.ascii.cr → test/fixture/01_en_ascii_cr.txt} +0 -0
- /data/{sample/01.en.ascii.crlf → test/fixture/01_en_ascii_crlf.txt} +0 -0
- /data/{sample/01.en.ascii.lf → test/fixture/01_en_ascii_lf.txt} +0 -0
- /data/{sample/01.ja.eucjp.lf → test/fixture/01_ja_eucjp_lf.txt} +0 -0
- /data/{sample/01.ja.sjis.cr → test/fixture/01_ja_sjis_cr.txt} +0 -0
- /data/{sample/01.ja.sjis.crlf → test/fixture/01_ja_sjis_crlf.txt} +0 -0
- /data/{sample/01.ja.utf8.crlf → test/fixture/01_ja_utf8_crlf.txt} +0 -0
- /data/{sample/02.en.ascii.cr → test/fixture/02_en_ascii_cr.txt} +0 -0
- /data/{sample/02.en.ascii.crlf → test/fixture/02_en_ascii_crlf.txt} +0 -0
- /data/{sample/02.en.ascii.lf → test/fixture/02_en_ascii_lf.txt} +0 -0
- /data/{sample/02.ja.eucjp.lf → test/fixture/02_ja_eucjp_lf.txt} +0 -0
- /data/{sample/02.ja.sjis.cr → test/fixture/02_ja_sjis_cr.txt} +0 -0
- /data/{sample/02.ja.sjis.crlf → test/fixture/02_ja_sjis_crlf.txt} +0 -0
- /data/{sample/02.ja.utf8.crlf → test/fixture/02_ja_utf8_crlf.txt} +0 -0
- /data/{sample/humpty_dumpty01.ascii.lf → test/fixture/humpty_dumpty01_ascii_lf.txt} +0 -0
- /data/{sample/humpty_dumpty02.ascii.lf → test/fixture/humpty_dumpty02_ascii_lf.txt} +0 -0
|
@@ -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
|
|
@@ -144,7 +152,7 @@ class View
|
|
|
144
152
|
case display
|
|
145
153
|
when 'inline'
|
|
146
154
|
result << (e_head.call(pos_str) + e_cxt_pre + e_chg + e_cxt_post + e_foot)
|
|
147
|
-
when
|
|
155
|
+
when /block|multi/
|
|
148
156
|
result << (e_head.call(pos_str) + e_cxt_pre + e_chgdel + e_cxt_post +
|
|
149
157
|
e_cxt_pre + e_chgadd + e_cxt_post + e_foot)
|
|
150
158
|
else raise "Unsupported display type: #{display}"
|
|
@@ -155,7 +163,7 @@ class View
|
|
|
155
163
|
case display
|
|
156
164
|
when 'inline'
|
|
157
165
|
result << (e_head.call(pos_str) + e_cxt_pre + e_del + e_cxt_post + e_foot)
|
|
158
|
-
when
|
|
166
|
+
when /block|multi/
|
|
159
167
|
result << (e_head.call(pos_str) + e_cxt_pre + e_src + e_cxt_post +
|
|
160
168
|
e_cxt_pre + e_del + e_cxt_post + e_foot)
|
|
161
169
|
else raise "Unsupported display type: #{display}"
|
|
@@ -166,7 +174,7 @@ class View
|
|
|
166
174
|
case display
|
|
167
175
|
when 'inline'
|
|
168
176
|
result << (e_head.call(pos_str) + e_cxt_pre + e_add + e_cxt_post + e_foot)
|
|
169
|
-
when
|
|
177
|
+
when /block|multi/
|
|
170
178
|
result << (e_head.call(pos_str) + e_cxt_pre + e_src + e_cxt_post +
|
|
171
179
|
e_cxt_pre + e_add + e_cxt_post + e_foot)
|
|
172
180
|
else raise "Unsupported display type: #{display}"
|
|
@@ -364,7 +372,7 @@ class View
|
|
|
364
372
|
tags = manued_tags()
|
|
365
373
|
# manued specific kludge: change should be [a/b] in inline, [a/][/b] in multi
|
|
366
374
|
display = (overriding_opts and overriding_opts[:display]) || 'inline'
|
|
367
|
-
if display
|
|
375
|
+
if /block|multi/.match display
|
|
368
376
|
tags.update({:end_before_change => '/]', :start_after_change => '[/'})
|
|
369
377
|
end
|
|
370
378
|
tags.update(overriding_opts) if overriding_opts
|