docdiff 0.6.2 → 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 +53 -30
- 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 +1 -0
- data/lib/doc_diff.rb +13 -0
- data/lib/docdiff/version.rb +1 -1
- data/lib/docdiff/view.rb +4 -4
- data/test/charstring_test.rb +121 -121
- data/test/docdiff_test.rb +1 -1
- data/test/document_test.rb +109 -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 +39 -36
- data/devutil/changelog.sh +0 -40
- data/index.html +0 -181
- data/langfilter.rb +0 -10
- data/readme.html +0 -750
- data/readme.md +0 -185
- /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
data/test/view_test.rb
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/ruby
|
|
2
|
-
# -*- coding:
|
|
2
|
+
# -*- coding: utf-8; -*-
|
|
3
3
|
require 'test/unit'
|
|
4
4
|
require 'docdiff/view'
|
|
5
5
|
require 'docdiff/difference'
|
|
@@ -165,36 +165,42 @@ class TC_DocDiff_View < Test::Unit::TestCase
|
|
|
165
165
|
assert_equal(expected, View.new(difference, "US-ASCII", nil).to_tty(nil, false))
|
|
166
166
|
end
|
|
167
167
|
def test_to_tty_del_add_ja()
|
|
168
|
-
array1 = ['
|
|
169
|
-
array2 = ['
|
|
170
|
-
expected = ["\033[7;4;31m
|
|
171
|
-
"
|
|
172
|
-
"\033[7;1;34m
|
|
173
|
-
"
|
|
174
|
-
assert_equal(expected
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
168
|
+
array1 = ['あ', 'い', 'う']
|
|
169
|
+
array2 = ['い', 'う', 'う']
|
|
170
|
+
expected = ["\033[7;4;31mあ\033[0m",
|
|
171
|
+
"い",
|
|
172
|
+
"\033[7;1;34mう\033[0m",
|
|
173
|
+
"う"]
|
|
174
|
+
assert_equal(expected.map{|i|NKF.nkf("--euc",i)},
|
|
175
|
+
View.new(Difference.new(array1.map{|i|NKF.nkf("--euc",i)},
|
|
176
|
+
array2.map{|i|NKF.nkf("--euc",i)}),
|
|
177
|
+
"EUC-JP", nil).to_tty(nil, false))
|
|
178
|
+
assert_equal(expected.map{|i|NKF.nkf("--sjis",i)},
|
|
179
|
+
View.new(Difference.new(array1.map{|i|NKF.nkf("--sjis",i)},
|
|
180
|
+
array2.map{|i|NKF.nkf("--sjis",i)}),
|
|
178
181
|
"Shift_JIS", nil).to_tty(nil, false))
|
|
179
|
-
assert_equal(expected.
|
|
180
|
-
View.new(Difference.new(array1.
|
|
181
|
-
array2.
|
|
182
|
+
assert_equal(expected.map{|i|NKF.nkf("--utf8", i)},
|
|
183
|
+
View.new(Difference.new(array1.map{|i|NKF.nkf("--utf8", i)},
|
|
184
|
+
array2.map{|i|NKF.nkf("--utf8", i)}),
|
|
182
185
|
"UTF-8", nil).to_tty(nil, false))
|
|
183
186
|
end
|
|
184
187
|
def test_to_tty_change_ja()
|
|
185
|
-
array1 = ['
|
|
186
|
-
array2 = ['
|
|
187
|
-
expected = ["
|
|
188
|
-
"\033[7;4;33m
|
|
189
|
-
"
|
|
190
|
-
assert_equal(expected
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
188
|
+
array1 = ['あ', 'い', 'う']
|
|
189
|
+
array2 = ['あ', '漢', 'う']
|
|
190
|
+
expected = ["あ",
|
|
191
|
+
"\033[7;4;33mい\033[0m\033[7;1;32m漢\033[0m",
|
|
192
|
+
"う"]
|
|
193
|
+
assert_equal(expected.map{|i|NKF.nkf("--euc",i)},
|
|
194
|
+
View.new(Difference.new(array1.map{|i|NKF.nkf("--euc",i)},
|
|
195
|
+
array2.map{|i|NKF.nkf("--euc",i)}),
|
|
196
|
+
"EUC-JP", nil).to_tty(nil, false))
|
|
197
|
+
assert_equal(expected.map{|i|NKF.nkf("--sjis",i)},
|
|
198
|
+
View.new(Difference.new(array1.map{|i|NKF.nkf("--sjis",i)},
|
|
199
|
+
array2.map{|i|NKF.nkf("--sjis",i)}),
|
|
194
200
|
"Shift_JIS", nil).to_tty(nil, false))
|
|
195
|
-
assert_equal(expected.
|
|
196
|
-
View.new(Difference.new(array1.
|
|
197
|
-
array2.
|
|
201
|
+
assert_equal(expected.map{|i|NKF.nkf("--utf8", i)},
|
|
202
|
+
View.new(Difference.new(array1.map{|i|NKF.nkf("--utf8", i)},
|
|
203
|
+
array2.map{|i|NKF.nkf("--utf8", i)}),
|
|
198
204
|
"UTF-8", nil).to_tty(nil, false))
|
|
199
205
|
end
|
|
200
206
|
def test_to_tty_digest()
|
|
@@ -206,14 +212,14 @@ class TC_DocDiff_View < Test::Unit::TestCase
|
|
|
206
212
|
"3,3\ne\n\033[7;4;33mf\033[0m\033[7;1;32mF\033[0m\n\n----\n"]
|
|
207
213
|
assert_equal(expected, View.new(Difference.new(array1, array2), "US-ASCII", "LF").to_tty_digest(nil, false))
|
|
208
214
|
end
|
|
209
|
-
def
|
|
215
|
+
def test_to_tty_digest_block()
|
|
210
216
|
array1 = ["a", "\n", "b", "c", "d", "e", "\n", "f", "\n"]
|
|
211
217
|
array2 = ["c", "d", "X", "\n", "Y", "e", "\n", "F", "\n"]
|
|
212
218
|
expected = ["----\n",
|
|
213
219
|
"1-2,(1)\na\nbcd\n\033[7;4;31ma\nb\033[0mcd\n----\n",
|
|
214
220
|
"(2),1-2\ncde\n\ncd\033[7;1;34mX\nY\033[0me\n\n----\n",
|
|
215
221
|
"3,3\ne\n\033[7;4;33mf\033[0m\n\ne\n\033[7;1;32mF\033[0m\n\n----\n"]
|
|
216
|
-
assert_equal(expected, View.new(Difference.new(array1, array2), "US-ASCII", "LF").to_tty_digest({:display=>'
|
|
222
|
+
assert_equal(expected, View.new(Difference.new(array1, array2), "US-ASCII", "LF").to_tty_digest({:display=>'block'}, false))
|
|
217
223
|
end
|
|
218
224
|
|
|
219
225
|
def test_to_html_cr_ascii()
|
|
@@ -254,7 +260,7 @@ class TC_DocDiff_View < Test::Unit::TestCase
|
|
|
254
260
|
"</ul>"]
|
|
255
261
|
assert_equal(expected, View.new(Difference.new(array1, array2), "US-ASCII", "LF").to_html_digest(nil,false))
|
|
256
262
|
end
|
|
257
|
-
def
|
|
263
|
+
def test_to_html_digest_block()
|
|
258
264
|
array1 = ["a", "\n", "b", "c", "d", "e", "\n", "f", "\n"]
|
|
259
265
|
array2 = ["c", "d", "X", "\n", "Y", "e", "\n", "F", "\n"]
|
|
260
266
|
expected = ["<ul>",
|
|
@@ -262,7 +268,7 @@ class TC_DocDiff_View < Test::Unit::TestCase
|
|
|
262
268
|
"<li class=\"entry\"><p class=\"position\">(2),1-2</p><blockquote class=\"body\"><p class=\"body\">cde<br />\n</p><p class=\"body\">cd<span class=\"add\"><ins>X<br />\nY</ins></span>e<br />\n</p></blockquote></li>\n",
|
|
263
269
|
"<li class=\"entry\"><p class=\"position\">3,3</p><blockquote class=\"body\"><p class=\"body\">e<br />\n<span class=\"before-change\"><del>f</del></span><br />\n</p><p class=\"body\">e<br />\n<span class=\"after-change\"><ins>F</ins></span><br />\n</p></blockquote></li>\n",
|
|
264
270
|
"</ul>"]
|
|
265
|
-
assert_equal(expected, View.new(Difference.new(array1, array2), "US-ASCII", "LF").to_html_digest({:display=>'
|
|
271
|
+
assert_equal(expected, View.new(Difference.new(array1, array2), "US-ASCII", "LF").to_html_digest({:display=>'block'},false))
|
|
266
272
|
end
|
|
267
273
|
|
|
268
274
|
def test_to_html_del_add_ascii()
|
|
@@ -285,36 +291,42 @@ class TC_DocDiff_View < Test::Unit::TestCase
|
|
|
285
291
|
assert_equal(expected, View.new(difference, "US-ASCII", nil).to_html(nil, false))
|
|
286
292
|
end
|
|
287
293
|
def test_to_html_del_add_ja()
|
|
288
|
-
array1 = ['
|
|
289
|
-
array2 = ['
|
|
290
|
-
expected = ['<span class="del"><del
|
|
291
|
-
'<span class="common"
|
|
292
|
-
'<span class="add"><ins
|
|
293
|
-
'<span class="common"
|
|
294
|
-
assert_equal(expected
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
294
|
+
array1 = ['あ', 'い', 'う']
|
|
295
|
+
array2 = ['い', 'う', 'う']
|
|
296
|
+
expected = ['<span class="del"><del>あ</del></span>',
|
|
297
|
+
'<span class="common">い</span>',
|
|
298
|
+
'<span class="add"><ins>う</ins></span>',
|
|
299
|
+
'<span class="common">う</span>']
|
|
300
|
+
assert_equal(expected.map{|i|NKF.nkf("--euc",i)},
|
|
301
|
+
View.new(Difference.new(array1.map{|i|NKF.nkf("--euc",i)},
|
|
302
|
+
array2.map{|i|NKF.nkf("--euc",i)}),
|
|
303
|
+
"EUC-JP", nil).to_html(nil, false))
|
|
304
|
+
assert_equal(expected.map{|i|NKF.nkf("--sjis",i)},
|
|
305
|
+
View.new(Difference.new(array1.map{|i|NKF.nkf("--sjis",i)},
|
|
306
|
+
array2.map{|i|NKF.nkf("--sjis",i)}),
|
|
298
307
|
"Shift_JIS", nil).to_html(nil, false))
|
|
299
|
-
assert_equal(expected.
|
|
300
|
-
View.new(Difference.new(array1.
|
|
301
|
-
array2.
|
|
308
|
+
assert_equal(expected.map{|i|NKF.nkf("--utf8", i)},
|
|
309
|
+
View.new(Difference.new(array1.map{|i|NKF.nkf("--utf8", i)},
|
|
310
|
+
array2.map{|i|NKF.nkf("--utf8", i)}),
|
|
302
311
|
"UTF-8", nil).to_html(nil, false))
|
|
303
312
|
end
|
|
304
313
|
def test_to_html_change_ja()
|
|
305
|
-
array1 = ['
|
|
306
|
-
array2 = ['
|
|
307
|
-
expected = ['<span class="common"
|
|
308
|
-
'<span class="before-change"><del
|
|
309
|
-
'<span class="common"
|
|
310
|
-
assert_equal(expected
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
+
array1 = ['あ', 'い', 'う']
|
|
315
|
+
array2 = ['あ', '漢', 'う']
|
|
316
|
+
expected = ['<span class="common">あ</span>',
|
|
317
|
+
'<span class="before-change"><del>い</del></span><span class="after-change"><ins>漢</ins></span>',
|
|
318
|
+
'<span class="common">う</span>']
|
|
319
|
+
assert_equal(expected.map{|i|NKF.nkf("--euc",i)},
|
|
320
|
+
View.new(Difference.new(array1.map{|i|NKF.nkf("--euc",i)},
|
|
321
|
+
array2.map{|i|NKF.nkf("--euc",i)}),
|
|
322
|
+
"EUC-JP", nil).to_html(nil, false))
|
|
323
|
+
assert_equal(expected.map{|i|NKF.nkf("--sjis",i)},
|
|
324
|
+
View.new(Difference.new(array1.map{|i|NKF.nkf("--sjis",i)},
|
|
325
|
+
array2.map{|i|NKF.nkf("--sjis",i)}),
|
|
314
326
|
"Shift_JIS", nil).to_html(nil, false))
|
|
315
|
-
assert_equal(expected.
|
|
316
|
-
View.new(Difference.new(array1.
|
|
317
|
-
array2.
|
|
327
|
+
assert_equal(expected.map{|i|NKF.nkf("--utf8", i)},
|
|
328
|
+
View.new(Difference.new(array1.map{|i|NKF.nkf("--utf8", i)},
|
|
329
|
+
array2.map{|i|NKF.nkf("--utf8", i)}),
|
|
318
330
|
"UTF-8", nil).to_html(nil, false))
|
|
319
331
|
end
|
|
320
332
|
|
|
@@ -338,36 +350,42 @@ class TC_DocDiff_View < Test::Unit::TestCase
|
|
|
338
350
|
assert_equal(expected, View.new(difference, "US-ASCII", nil).to_manued(nil, false))
|
|
339
351
|
end
|
|
340
352
|
def test_to_manued_del_add_ja()
|
|
341
|
-
array1 = ['
|
|
342
|
-
array2 = ['
|
|
343
|
-
expected = ['[
|
|
344
|
-
'
|
|
345
|
-
'[
|
|
346
|
-
'
|
|
347
|
-
assert_equal(expected
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
353
|
+
array1 = ['あ', 'い', 'う']
|
|
354
|
+
array2 = ['い', 'う', 'う']
|
|
355
|
+
expected = ['[あ/]',
|
|
356
|
+
'い',
|
|
357
|
+
'[/う]',
|
|
358
|
+
'う']
|
|
359
|
+
assert_equal(expected.map{|i|NKF.nkf("--euc",i)},
|
|
360
|
+
View.new(Difference.new(array1.map{|i|NKF.nkf("--euc",i)},
|
|
361
|
+
array2.map{|i|NKF.nkf("--euc",i)}),
|
|
362
|
+
"EUC-JP", nil).to_manued(nil, false))
|
|
363
|
+
assert_equal(expected.map{|i|NKF.nkf("--sjis",i)},
|
|
364
|
+
View.new(Difference.new(array1.map{|i|NKF.nkf("--sjis",i)},
|
|
365
|
+
array2.map{|i|NKF.nkf("--sjis",i)}),
|
|
351
366
|
"Shift_JIS", nil).to_manued(nil, false))
|
|
352
|
-
assert_equal(expected.
|
|
353
|
-
View.new(Difference.new(array1.
|
|
354
|
-
array2.
|
|
367
|
+
assert_equal(expected.map{|i|NKF.nkf("--utf8", i)},
|
|
368
|
+
View.new(Difference.new(array1.map{|i|NKF.nkf("--utf8", i)},
|
|
369
|
+
array2.map{|i|NKF.nkf("--utf8", i)}),
|
|
355
370
|
"UTF-8", nil).to_manued(nil, false))
|
|
356
371
|
end
|
|
357
372
|
def test_to_manued_change_ja()
|
|
358
|
-
array1 = ['
|
|
359
|
-
array2 = ['
|
|
360
|
-
expected = ['
|
|
361
|
-
'[
|
|
362
|
-
'
|
|
363
|
-
assert_equal(expected
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
373
|
+
array1 = ['あ', 'い', 'う']
|
|
374
|
+
array2 = ['あ', '漢', 'う']
|
|
375
|
+
expected = ['あ',
|
|
376
|
+
'[い/漢]',
|
|
377
|
+
'う']
|
|
378
|
+
assert_equal(expected.map{|i|NKF.nkf("--euc",i)},
|
|
379
|
+
View.new(Difference.new(array1.map{|i|NKF.nkf("--euc",i)},
|
|
380
|
+
array2.map{|i|NKF.nkf("--euc",i)}),
|
|
381
|
+
"EUC-JP", nil).to_manued(nil, false))
|
|
382
|
+
assert_equal(expected.map{|i|NKF.nkf("--sjis",i)},
|
|
383
|
+
View.new(Difference.new(array1.map{|i|NKF.nkf("--sjis",i)},
|
|
384
|
+
array2.map{|i|NKF.nkf("--sjis",i)}),
|
|
367
385
|
"Shift_JIS", nil).to_manued(nil, false))
|
|
368
|
-
assert_equal(expected.
|
|
369
|
-
View.new(Difference.new(array1.
|
|
370
|
-
array2.
|
|
386
|
+
assert_equal(expected.map{|i|NKF.nkf("--utf8", i)},
|
|
387
|
+
View.new(Difference.new(array1.map{|i|NKF.nkf("--utf8", i)},
|
|
388
|
+
array2.map{|i|NKF.nkf("--utf8", i)}),
|
|
371
389
|
"UTF-8", nil).to_manued(nil, false))
|
|
372
390
|
end
|
|
373
391
|
def test_to_manued_escaping_ascii()
|
|
@@ -386,14 +404,14 @@ class TC_DocDiff_View < Test::Unit::TestCase
|
|
|
386
404
|
"3,3\ne\n[f/F]\n\n----\n"]
|
|
387
405
|
assert_equal(expected, View.new(Difference.new(array1, array2), "US-ASCII", "LF").to_manued_digest(nil,false))
|
|
388
406
|
end
|
|
389
|
-
def
|
|
407
|
+
def test_to_manued_digest_block()
|
|
390
408
|
array1 = ["a", "\n", "b", "c", "d", "e", "\n", "f", "\n"]
|
|
391
409
|
array2 = ["c", "d", "X", "\n", "Y", "e", "\n", "F", "\n"]
|
|
392
410
|
expected = ["----\n",
|
|
393
411
|
"1-2,(1)\na\nbcd\n[a\nb/]cd\n----\n",
|
|
394
412
|
"(2),1-2\ncde\n\ncd[/X\nY]e\n\n----\n",
|
|
395
413
|
"3,3\ne\n[f/]\n\ne\n[/F]\n\n----\n"]
|
|
396
|
-
assert_equal(expected, View.new(Difference.new(array1, array2), "US-ASCII", "LF").to_manued_digest({:display=>'
|
|
414
|
+
assert_equal(expected, View.new(Difference.new(array1, array2), "US-ASCII", "LF").to_manued_digest({:display=>'block'},false))
|
|
397
415
|
end
|
|
398
416
|
|
|
399
417
|
def test_to_wdiff_del_add_ascii()
|
|
@@ -416,36 +434,42 @@ class TC_DocDiff_View < Test::Unit::TestCase
|
|
|
416
434
|
assert_equal(expected, View.new(difference, "US-ASCII", nil).to_wdiff(nil, false))
|
|
417
435
|
end
|
|
418
436
|
def test_to_wdiff_del_add_ja()
|
|
419
|
-
array1 = ['
|
|
420
|
-
array2 = ['
|
|
421
|
-
expected = ['[
|
|
422
|
-
'
|
|
423
|
-
'{
|
|
424
|
-
'
|
|
425
|
-
assert_equal(expected
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
437
|
+
array1 = ['あ', 'い', 'う']
|
|
438
|
+
array2 = ['い', 'う', 'う']
|
|
439
|
+
expected = ['[-あ-]',
|
|
440
|
+
'い',
|
|
441
|
+
'{+う+}',
|
|
442
|
+
'う']
|
|
443
|
+
assert_equal(expected.map{|i|NKF.nkf("--euc",i)},
|
|
444
|
+
View.new(Difference.new(array1.map{|i|NKF.nkf("--euc",i)},
|
|
445
|
+
array2.map{|i|NKF.nkf("--euc",i)}),
|
|
446
|
+
"EUC-JP", nil).to_wdiff(nil, false))
|
|
447
|
+
assert_equal(expected.map{|i|NKF.nkf("--sjis",i)},
|
|
448
|
+
View.new(Difference.new(array1.map{|i|NKF.nkf("--sjis",i)},
|
|
449
|
+
array2.map{|i|NKF.nkf("--sjis",i)}),
|
|
429
450
|
"Shift_JIS", nil).to_wdiff(nil, false))
|
|
430
|
-
assert_equal(expected.
|
|
431
|
-
View.new(Difference.new(array1.
|
|
432
|
-
array2.
|
|
451
|
+
assert_equal(expected.map{|i|NKF.nkf("--utf8", i)},
|
|
452
|
+
View.new(Difference.new(array1.map{|i|NKF.nkf("--utf8", i)},
|
|
453
|
+
array2.map{|i|NKF.nkf("--utf8", i)}),
|
|
433
454
|
"UTF-8", nil).to_wdiff(nil, false))
|
|
434
455
|
end
|
|
435
456
|
def test_to_wdiff_change_ja()
|
|
436
|
-
array1 = ['
|
|
437
|
-
array2 = ['
|
|
438
|
-
expected = ['
|
|
439
|
-
'[
|
|
440
|
-
'
|
|
441
|
-
assert_equal(expected
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
457
|
+
array1 = ['あ', 'い', 'う']
|
|
458
|
+
array2 = ['あ', '漢', 'う']
|
|
459
|
+
expected = ['あ',
|
|
460
|
+
'[-い-]{+漢+}',
|
|
461
|
+
'う']
|
|
462
|
+
assert_equal(expected.map{|i|NKF.nkf("--euc",i)},
|
|
463
|
+
View.new(Difference.new(array1.map{|i|NKF.nkf("--euc",i)},
|
|
464
|
+
array2.map{|i|NKF.nkf("--euc",i)}),
|
|
465
|
+
"EUC-JP", nil).to_wdiff(nil, false))
|
|
466
|
+
assert_equal(expected.map{|i|NKF.nkf("--sjis",i)},
|
|
467
|
+
View.new(Difference.new(array1.map{|i|NKF.nkf("--sjis",i)},
|
|
468
|
+
array2.map{|i|NKF.nkf("--sjis",i)}),
|
|
445
469
|
"Shift_JIS", nil).to_wdiff(nil, false))
|
|
446
|
-
assert_equal(expected.
|
|
447
|
-
View.new(Difference.new(array1.
|
|
448
|
-
array2.
|
|
470
|
+
assert_equal(expected.map{|i|NKF.nkf("--utf8", i)},
|
|
471
|
+
View.new(Difference.new(array1.map{|i|NKF.nkf("--utf8", i)},
|
|
472
|
+
array2.map{|i|NKF.nkf("--utf8", i)}),
|
|
449
473
|
"UTF-8", nil).to_wdiff(nil, false))
|
|
450
474
|
end
|
|
451
475
|
def test_to_wdiff_digest()
|
|
@@ -457,14 +481,14 @@ class TC_DocDiff_View < Test::Unit::TestCase
|
|
|
457
481
|
"3,3\ne\n[-f-]{+F+}\n\n----\n"]
|
|
458
482
|
assert_equal(expected, View.new(Difference.new(array1, array2), "US-ASCII", "LF").to_wdiff_digest(nil,false))
|
|
459
483
|
end
|
|
460
|
-
def
|
|
484
|
+
def test_to_wdiff_digest_block()
|
|
461
485
|
array1 = ["a", "\n", "b", "c", "d", "e", "\n", "f", "\n"]
|
|
462
486
|
array2 = ["c", "d", "X", "\n", "Y", "e", "\n", "F", "\n"]
|
|
463
487
|
expected = ["----\n",
|
|
464
488
|
"1-2,(1)\na\nbcd\n[-a\nb-]cd\n----\n",
|
|
465
489
|
"(2),1-2\ncde\n\ncd{+X\nY+}e\n\n----\n",
|
|
466
490
|
"3,3\ne\n[-f-]\n\ne\n{+F+}\n\n----\n"]
|
|
467
|
-
assert_equal(expected, View.new(Difference.new(array1, array2), "US-ASCII", "LF").to_wdiff_digest({:display => '
|
|
491
|
+
assert_equal(expected, View.new(Difference.new(array1, array2), "US-ASCII", "LF").to_wdiff_digest({:display => 'block'}, false))
|
|
468
492
|
end
|
|
469
493
|
|
|
470
494
|
def test_to_user_del_add_en()
|
|
@@ -524,7 +548,7 @@ class TC_DocDiff_View < Test::Unit::TestCase
|
|
|
524
548
|
"3,3 e\n<!->f</!-><!+>F</!+>\n\n"]
|
|
525
549
|
assert_equal(expected, View.new(Difference.new(array1, array2), "US-ASCII", "LF").to_user_digest(user_tags, false))
|
|
526
550
|
end
|
|
527
|
-
def
|
|
551
|
+
def test_to_user_digest_block()
|
|
528
552
|
array1 = ["a", "\n", "b", "c", "d", "e", "\n", "f", "\n"]
|
|
529
553
|
array2 = ["c", "d", "X", "\n", "Y", "e", "\n", "F", "\n"]
|
|
530
554
|
user_tags = {:start_common => '<=>',
|
|
@@ -537,7 +561,7 @@ class TC_DocDiff_View < Test::Unit::TestCase
|
|
|
537
561
|
:end_before_change => '</!->',
|
|
538
562
|
:start_after_change => '<!+>',
|
|
539
563
|
:end_after_change => '</!+>',
|
|
540
|
-
:display => '
|
|
564
|
+
:display => 'block'}
|
|
541
565
|
expected = ["1-2,(1) a\nbcd<->a\nb</->cd\n",
|
|
542
566
|
"(2),1-2 cde\ncd<+>X\nY</+>e\n\n",
|
|
543
567
|
"3,3 e\n<!->f</!->\ne\n<!+>F</!+>\n\n"]
|
metadata
CHANGED
|
@@ -1,13 +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.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Hisashi Morita
|
|
8
8
|
bindir: bin
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date:
|
|
10
|
+
date: 2025-12-13 00:00:00.000000000 Z
|
|
11
11
|
dependencies: []
|
|
12
12
|
description: |-
|
|
13
13
|
DocDiff compares two text files and shows the
|
|
@@ -27,29 +27,32 @@ files:
|
|
|
27
27
|
- Gemfile
|
|
28
28
|
- Guardfile
|
|
29
29
|
- Makefile
|
|
30
|
+
- README.md
|
|
31
|
+
- README_ja.md
|
|
30
32
|
- Rakefile
|
|
31
33
|
- bin/docdiff
|
|
32
34
|
- devutil/Rakefile
|
|
33
|
-
- devutil/changelog.sh
|
|
34
35
|
- devutil/char_by_charclass.rb
|
|
35
36
|
- devutil/charclass_by_char.rb
|
|
36
37
|
- devutil/jis0208.rb
|
|
37
38
|
- devutil/testjis0208.rb
|
|
38
|
-
- docdiff.conf.example
|
|
39
|
+
- doc/example/docdiff.conf.example
|
|
40
|
+
- doc/example/docdiffwebui.cgi
|
|
41
|
+
- doc/example/docdiffwebui.html
|
|
42
|
+
- doc/img/screenshot-format-html-digest-firefox.png
|
|
43
|
+
- doc/img/screenshot-format-html-firefox.png
|
|
44
|
+
- doc/img/screenshot-format-tty-cmdexe-en.png
|
|
45
|
+
- doc/img/screenshot-format-tty-cmdexe-ja.png
|
|
46
|
+
- doc/img/screenshot-format-tty-rxvtunicode-en.png
|
|
47
|
+
- doc/img/screenshot-format-tty-rxvtunicode-ja.png
|
|
48
|
+
- doc/img/screenshot-format-tty-xterm-en.png
|
|
49
|
+
- doc/img/screenshot-format-tty-xterm-ja.png
|
|
50
|
+
- doc/img/screenshot-resolution-linewordchar-xterm.png
|
|
51
|
+
- doc/man/docdiff.adoc
|
|
52
|
+
- doc/news.md
|
|
53
|
+
- doc/shell_completion/_docdiff.zsh
|
|
54
|
+
- doc/shell_completion/docdiff.bash
|
|
39
55
|
- docdiff.gemspec
|
|
40
|
-
- docdiffwebui.cgi
|
|
41
|
-
- docdiffwebui.html
|
|
42
|
-
- img/docdiff-screenshot-format-html-digest-firefox.png
|
|
43
|
-
- img/docdiff-screenshot-format-html-firefox.png
|
|
44
|
-
- img/docdiff-screenshot-format-tty-cmdexe-en.png
|
|
45
|
-
- img/docdiff-screenshot-format-tty-cmdexe-ja.png
|
|
46
|
-
- img/docdiff-screenshot-format-tty-rxvtunicode-en.png
|
|
47
|
-
- img/docdiff-screenshot-format-tty-rxvtunicode-ja.png
|
|
48
|
-
- img/docdiff-screenshot-format-tty-xterm-en.png
|
|
49
|
-
- img/docdiff-screenshot-format-tty-xterm-ja.png
|
|
50
|
-
- img/docdiff-screenshot-resolution-linewordchar-xterm.png
|
|
51
|
-
- index.html
|
|
52
|
-
- langfilter.rb
|
|
53
56
|
- lib/doc_diff.rb
|
|
54
57
|
- lib/docdiff.rb
|
|
55
58
|
- lib/docdiff/charstring.rb
|
|
@@ -69,29 +72,29 @@ files:
|
|
|
69
72
|
- lib/docdiff/encoding/ja_utf8.rb
|
|
70
73
|
- lib/docdiff/version.rb
|
|
71
74
|
- lib/docdiff/view.rb
|
|
72
|
-
- readme.html
|
|
73
|
-
- readme.md
|
|
74
|
-
- sample/01.en.ascii.cr
|
|
75
|
-
- sample/01.en.ascii.crlf
|
|
76
|
-
- sample/01.en.ascii.lf
|
|
77
|
-
- sample/01.ja.eucjp.lf
|
|
78
|
-
- sample/01.ja.sjis.cr
|
|
79
|
-
- sample/01.ja.sjis.crlf
|
|
80
|
-
- sample/01.ja.utf8.crlf
|
|
81
|
-
- sample/02.en.ascii.cr
|
|
82
|
-
- sample/02.en.ascii.crlf
|
|
83
|
-
- sample/02.en.ascii.lf
|
|
84
|
-
- sample/02.ja.eucjp.lf
|
|
85
|
-
- sample/02.ja.sjis.cr
|
|
86
|
-
- sample/02.ja.sjis.crlf
|
|
87
|
-
- sample/02.ja.utf8.crlf
|
|
88
|
-
- sample/humpty_dumpty01.ascii.lf
|
|
89
|
-
- sample/humpty_dumpty02.ascii.lf
|
|
90
75
|
- test/charstring_test.rb
|
|
91
76
|
- test/diff_test.rb
|
|
92
77
|
- test/difference_test.rb
|
|
93
78
|
- test/docdiff_test.rb
|
|
94
79
|
- test/document_test.rb
|
|
80
|
+
- test/fixture/01_en_ascii_cr.txt
|
|
81
|
+
- test/fixture/01_en_ascii_crlf.txt
|
|
82
|
+
- test/fixture/01_en_ascii_lf.txt
|
|
83
|
+
- test/fixture/01_ja_eucjp_lf.txt
|
|
84
|
+
- test/fixture/01_ja_sjis_cr.txt
|
|
85
|
+
- test/fixture/01_ja_sjis_crlf.txt
|
|
86
|
+
- test/fixture/01_ja_utf8_crlf.txt
|
|
87
|
+
- test/fixture/01_ja_utf8_lf.txt
|
|
88
|
+
- test/fixture/02_en_ascii_cr.txt
|
|
89
|
+
- test/fixture/02_en_ascii_crlf.txt
|
|
90
|
+
- test/fixture/02_en_ascii_lf.txt
|
|
91
|
+
- test/fixture/02_ja_eucjp_lf.txt
|
|
92
|
+
- test/fixture/02_ja_sjis_cr.txt
|
|
93
|
+
- test/fixture/02_ja_sjis_crlf.txt
|
|
94
|
+
- test/fixture/02_ja_utf8_crlf.txt
|
|
95
|
+
- test/fixture/02_ja_utf8_lf.txt
|
|
96
|
+
- test/fixture/humpty_dumpty01_ascii_lf.txt
|
|
97
|
+
- test/fixture/humpty_dumpty02_ascii_lf.txt
|
|
95
98
|
- test/test_helper.rb
|
|
96
99
|
- test/view_test.rb
|
|
97
100
|
homepage: https://github.com/hisashim/docdiff
|
|
@@ -105,7 +108,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
105
108
|
requirements:
|
|
106
109
|
- - ">="
|
|
107
110
|
- !ruby/object:Gem::Version
|
|
108
|
-
version: '0'
|
|
111
|
+
version: '3.0'
|
|
109
112
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
110
113
|
requirements:
|
|
111
114
|
- - ">="
|
data/devutil/changelog.sh
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
#!/bin/sh
|
|
2
|
-
# ChangeLog Generator
|
|
3
|
-
# Copyright 2011 Hisashi Morita
|
|
4
|
-
# License: Public Domain
|
|
5
|
-
#
|
|
6
|
-
# Usage:
|
|
7
|
-
# changelog.sh [WORKING_DIR] > ChangeLog
|
|
8
|
-
|
|
9
|
-
if [ "$1" ]; then
|
|
10
|
-
WD="$1"
|
|
11
|
-
else
|
|
12
|
-
WD="."
|
|
13
|
-
fi
|
|
14
|
-
|
|
15
|
-
# Subversion
|
|
16
|
-
which svn >/dev/null
|
|
17
|
-
if [ x"$?" = x0 ]; then
|
|
18
|
-
(svn info "${WD}" >/dev/null 2>&1) && SVN=TRUE
|
|
19
|
-
if [ x"${SVN}" = xTRUE ]; then
|
|
20
|
-
(cd "${WD}"; svn log -rBASE:0 -v)
|
|
21
|
-
fi
|
|
22
|
-
fi
|
|
23
|
-
|
|
24
|
-
# Git
|
|
25
|
-
which git >/dev/null
|
|
26
|
-
if [ x"$?" = x0 ]; then
|
|
27
|
-
(cd "${WD}" && git status --porcelain >/dev/null 2>&1) && GIT=TRUE
|
|
28
|
-
if [ x"${GIT}" = xTRUE ]; then
|
|
29
|
-
(cd "${WD}"; git log | cat)
|
|
30
|
-
fi
|
|
31
|
-
fi
|
|
32
|
-
|
|
33
|
-
# Mercurial
|
|
34
|
-
which hg >/dev/null
|
|
35
|
-
if [ x"$?" = x0 ]; then
|
|
36
|
-
(hg status "${WD}" >/dev/null 2>&1) && HG=TRUE
|
|
37
|
-
if [ x"${HG}" = xTRUE ]; then
|
|
38
|
-
(cd "${WD}"; hg log --rev tip:0)
|
|
39
|
-
fi
|
|
40
|
-
fi
|