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.
Files changed (62) hide show
  1. checksums.yaml +4 -4
  2. data/Makefile +27 -49
  3. data/README.md +351 -0
  4. data/README_ja.md +351 -0
  5. data/Rakefile +2 -42
  6. data/bin/docdiff +66 -29
  7. data/{docdiff.conf.example → doc/example/docdiff.conf.example} +4 -3
  8. data/doc/man/docdiff.adoc +146 -0
  9. data/doc/news.md +180 -0
  10. data/doc/shell_completion/_docdiff.zsh +51 -0
  11. data/doc/shell_completion/docdiff.bash +68 -0
  12. data/docdiff.gemspec +2 -1
  13. data/lib/doc_diff.rb +13 -0
  14. data/lib/docdiff/charstring.rb +4 -3
  15. data/lib/docdiff/diff/unidiff.rb +0 -1
  16. data/lib/docdiff/encoding/en_ascii.rb +12 -39
  17. data/lib/docdiff/encoding/ja_eucjp.rb +12 -39
  18. data/lib/docdiff/encoding/ja_sjis.rb +12 -39
  19. data/lib/docdiff/encoding/ja_utf8.rb +12 -39
  20. data/lib/docdiff/version.rb +1 -1
  21. data/lib/docdiff/view.rb +16 -8
  22. data/test/charstring_test.rb +124 -121
  23. data/test/docdiff_test.rb +5 -3
  24. data/test/document_test.rb +112 -109
  25. data/test/fixture/01_ja_utf8_lf.txt +2 -0
  26. data/test/fixture/02_ja_utf8_lf.txt +2 -0
  27. data/test/view_test.rb +135 -111
  28. metadata +41 -43
  29. data/devutil/changelog.sh +0 -40
  30. data/index.html +0 -181
  31. data/langfilter.rb +0 -10
  32. data/lib/viewdiff.rb +0 -379
  33. data/readme.html +0 -733
  34. data/readme.md +0 -184
  35. data/test/viewdiff_test.rb +0 -911
  36. /data/{docdiffwebui.cgi → doc/example/docdiffwebui.cgi} +0 -0
  37. /data/{docdiffwebui.html → doc/example/docdiffwebui.html} +0 -0
  38. /data/{img/docdiff-screenshot-format-html-digest-firefox.png → doc/img/screenshot-format-html-digest-firefox.png} +0 -0
  39. /data/{img/docdiff-screenshot-format-html-firefox.png → doc/img/screenshot-format-html-firefox.png} +0 -0
  40. /data/{img/docdiff-screenshot-format-tty-cmdexe-en.png → doc/img/screenshot-format-tty-cmdexe-en.png} +0 -0
  41. /data/{img/docdiff-screenshot-format-tty-cmdexe-ja.png → doc/img/screenshot-format-tty-cmdexe-ja.png} +0 -0
  42. /data/{img/docdiff-screenshot-format-tty-rxvtunicode-en.png → doc/img/screenshot-format-tty-rxvtunicode-en.png} +0 -0
  43. /data/{img/docdiff-screenshot-format-tty-rxvtunicode-ja.png → doc/img/screenshot-format-tty-rxvtunicode-ja.png} +0 -0
  44. /data/{img/docdiff-screenshot-format-tty-xterm-en.png → doc/img/screenshot-format-tty-xterm-en.png} +0 -0
  45. /data/{img/docdiff-screenshot-format-tty-xterm-ja.png → doc/img/screenshot-format-tty-xterm-ja.png} +0 -0
  46. /data/{img/docdiff-screenshot-resolution-linewordchar-xterm.png → doc/img/screenshot-resolution-linewordchar-xterm.png} +0 -0
  47. /data/{sample/01.en.ascii.cr → test/fixture/01_en_ascii_cr.txt} +0 -0
  48. /data/{sample/01.en.ascii.crlf → test/fixture/01_en_ascii_crlf.txt} +0 -0
  49. /data/{sample/01.en.ascii.lf → test/fixture/01_en_ascii_lf.txt} +0 -0
  50. /data/{sample/01.ja.eucjp.lf → test/fixture/01_ja_eucjp_lf.txt} +0 -0
  51. /data/{sample/01.ja.sjis.cr → test/fixture/01_ja_sjis_cr.txt} +0 -0
  52. /data/{sample/01.ja.sjis.crlf → test/fixture/01_ja_sjis_crlf.txt} +0 -0
  53. /data/{sample/01.ja.utf8.crlf → test/fixture/01_ja_utf8_crlf.txt} +0 -0
  54. /data/{sample/02.en.ascii.cr → test/fixture/02_en_ascii_cr.txt} +0 -0
  55. /data/{sample/02.en.ascii.crlf → test/fixture/02_en_ascii_crlf.txt} +0 -0
  56. /data/{sample/02.en.ascii.lf → test/fixture/02_en_ascii_lf.txt} +0 -0
  57. /data/{sample/02.ja.eucjp.lf → test/fixture/02_ja_eucjp_lf.txt} +0 -0
  58. /data/{sample/02.ja.sjis.cr → test/fixture/02_ja_sjis_cr.txt} +0 -0
  59. /data/{sample/02.ja.sjis.crlf → test/fixture/02_ja_sjis_crlf.txt} +0 -0
  60. /data/{sample/02.ja.utf8.crlf → test/fixture/02_ja_utf8_crlf.txt} +0 -0
  61. /data/{sample/humpty_dumpty01.ascii.lf → test/fixture/humpty_dumpty01_ascii_lf.txt} +0 -0
  62. /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: euc-jp; -*-
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��\033[0m",
171
- "��",
172
- "\033[7;1;34m��\033[0m",
173
- "��"]
174
- assert_equal(expected, View.new(Difference.new(array1, array2), "EUC-JP", nil).to_tty(nil, false))
175
- assert_equal(expected.collect{|i|NKF.nkf("-s",i)},
176
- View.new(Difference.new(array1.collect{|i|NKF.nkf("-s",i)},
177
- array2.collect{|i|NKF.nkf("-s",i)}),
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.collect{|i|NKF.nkf("-E -w", i)},
180
- View.new(Difference.new(array1.collect{|i|NKF.nkf("-E -w", i)},
181
- array2.collect{|i|NKF.nkf("-E -w", i)}),
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��\033[0m\033[7;1;32m��\033[0m",
189
- "��"]
190
- assert_equal(expected, View.new(Difference.new(array1, array2), "EUC-JP", nil).to_tty(nil, false))
191
- assert_equal(expected.collect{|i|NKF.nkf("-s",i)},
192
- View.new(Difference.new(array1.collect{|i|NKF.nkf("-s",i)},
193
- array2.collect{|i|NKF.nkf("-s",i)}),
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.collect{|i|NKF.nkf("-E -w", i)},
196
- View.new(Difference.new(array1.collect{|i|NKF.nkf("-E -w", i)},
197
- array2.collect{|i|NKF.nkf("-E -w", i)}),
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 test_to_tty_digest_multi()
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=>'multi'}, false))
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 test_to_html_digest_multi()
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=>'multi'},false))
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>��</del></span>',
291
- '<span class="common">��</span>',
292
- '<span class="add"><ins>��</ins></span>',
293
- '<span class="common">��</span>']
294
- assert_equal(expected, View.new(Difference.new(array1, array2), "EUC-JP", nil).to_html(nil, false))
295
- assert_equal(expected.collect{|i|NKF.nkf("-s",i)},
296
- View.new(Difference.new(array1.collect{|i|NKF.nkf("-s",i)},
297
- array2.collect{|i|NKF.nkf("-s",i)}),
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.collect{|i|NKF.nkf("-E -w", i)},
300
- View.new(Difference.new(array1.collect{|i|NKF.nkf("-E -w", i)},
301
- array2.collect{|i|NKF.nkf("-E -w", i)}),
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">��</span>',
308
- '<span class="before-change"><del>��</del></span><span class="after-change"><ins>��</ins></span>',
309
- '<span class="common">��</span>']
310
- assert_equal(expected, View.new(Difference.new(array1, array2), "EUC-JP", nil).to_html(nil, false))
311
- assert_equal(expected.collect{|i|NKF.nkf("-s",i)},
312
- View.new(Difference.new(array1.collect{|i|NKF.nkf("-s",i)},
313
- array2.collect{|i|NKF.nkf("-s",i)}),
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.collect{|i|NKF.nkf("-E -w", i)},
316
- View.new(Difference.new(array1.collect{|i|NKF.nkf("-E -w", i)},
317
- array2.collect{|i|NKF.nkf("-E -w", i)}),
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, View.new(Difference.new(array1, array2), "EUC-JP", nil).to_manued(nil, false))
348
- assert_equal(expected.collect{|i|NKF.nkf("-s",i)},
349
- View.new(Difference.new(array1.collect{|i|NKF.nkf("-s",i)},
350
- array2.collect{|i|NKF.nkf("-s",i)}),
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.collect{|i|NKF.nkf("-E -w", i)},
353
- View.new(Difference.new(array1.collect{|i|NKF.nkf("-E -w", i)},
354
- array2.collect{|i|NKF.nkf("-E -w", i)}),
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, View.new(Difference.new(array1, array2), "EUC-JP", nil).to_manued(nil, false))
364
- assert_equal(expected.collect{|i|NKF.nkf("-s",i)},
365
- View.new(Difference.new(array1.collect{|i|NKF.nkf("-s",i)},
366
- array2.collect{|i|NKF.nkf("-s",i)}),
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.collect{|i|NKF.nkf("-E -w", i)},
369
- View.new(Difference.new(array1.collect{|i|NKF.nkf("-E -w", i)},
370
- array2.collect{|i|NKF.nkf("-E -w", i)}),
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 test_to_manued_digest_multi()
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=>'multi'},false))
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, View.new(Difference.new(array1, array2), "EUC-JP", nil).to_wdiff(nil, false))
426
- assert_equal(expected.collect{|i|NKF.nkf("-s",i)},
427
- View.new(Difference.new(array1.collect{|i|NKF.nkf("-s",i)},
428
- array2.collect{|i|NKF.nkf("-s",i)}),
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.collect{|i|NKF.nkf("-E -w", i)},
431
- View.new(Difference.new(array1.collect{|i|NKF.nkf("-E -w", i)},
432
- array2.collect{|i|NKF.nkf("-E -w", i)}),
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, View.new(Difference.new(array1, array2), "EUC-JP", nil).to_wdiff(nil, false))
442
- assert_equal(expected.collect{|i|NKF.nkf("-s",i)},
443
- View.new(Difference.new(array1.collect{|i|NKF.nkf("-s",i)},
444
- array2.collect{|i|NKF.nkf("-s",i)}),
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.collect{|i|NKF.nkf("-E -w", i)},
447
- View.new(Difference.new(array1.collect{|i|NKF.nkf("-E -w", i)},
448
- array2.collect{|i|NKF.nkf("-E -w", i)}),
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 test_to_wdiff_digest_multi()
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 => 'multi'}, false))
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 test_to_user_digest_multi()
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 => 'multi'}
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,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: docdiff
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.6.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hisashi Morita
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2021-06-07 00:00:00.000000000 Z
10
+ date: 2025-12-13 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 at workbook.org
19
+ - hisashim@icloud.com
21
20
  executables:
22
21
  - docdiff
23
22
  extensions: []
@@ -28,29 +27,32 @@ files:
28
27
  - Gemfile
29
28
  - Guardfile
30
29
  - Makefile
30
+ - README.md
31
+ - README_ja.md
31
32
  - Rakefile
32
33
  - bin/docdiff
33
34
  - devutil/Rakefile
34
- - devutil/changelog.sh
35
35
  - devutil/char_by_charclass.rb
36
36
  - devutil/charclass_by_char.rb
37
37
  - devutil/jis0208.rb
38
38
  - devutil/testjis0208.rb
39
- - 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
40
55
  - docdiff.gemspec
41
- - docdiffwebui.cgi
42
- - docdiffwebui.html
43
- - img/docdiff-screenshot-format-html-digest-firefox.png
44
- - img/docdiff-screenshot-format-html-firefox.png
45
- - img/docdiff-screenshot-format-tty-cmdexe-en.png
46
- - img/docdiff-screenshot-format-tty-cmdexe-ja.png
47
- - img/docdiff-screenshot-format-tty-rxvtunicode-en.png
48
- - img/docdiff-screenshot-format-tty-rxvtunicode-ja.png
49
- - img/docdiff-screenshot-format-tty-xterm-en.png
50
- - img/docdiff-screenshot-format-tty-xterm-ja.png
51
- - img/docdiff-screenshot-resolution-linewordchar-xterm.png
52
- - index.html
53
- - langfilter.rb
54
56
  - lib/doc_diff.rb
55
57
  - lib/docdiff.rb
56
58
  - lib/docdiff/charstring.rb
@@ -70,38 +72,35 @@ files:
70
72
  - lib/docdiff/encoding/ja_utf8.rb
71
73
  - lib/docdiff/version.rb
72
74
  - lib/docdiff/view.rb
73
- - lib/viewdiff.rb
74
- - readme.html
75
- - readme.md
76
- - sample/01.en.ascii.cr
77
- - sample/01.en.ascii.crlf
78
- - sample/01.en.ascii.lf
79
- - sample/01.ja.eucjp.lf
80
- - sample/01.ja.sjis.cr
81
- - sample/01.ja.sjis.crlf
82
- - sample/01.ja.utf8.crlf
83
- - sample/02.en.ascii.cr
84
- - sample/02.en.ascii.crlf
85
- - sample/02.en.ascii.lf
86
- - sample/02.ja.eucjp.lf
87
- - sample/02.ja.sjis.cr
88
- - sample/02.ja.sjis.crlf
89
- - sample/02.ja.utf8.crlf
90
- - sample/humpty_dumpty01.ascii.lf
91
- - sample/humpty_dumpty02.ascii.lf
92
75
  - test/charstring_test.rb
93
76
  - test/diff_test.rb
94
77
  - test/difference_test.rb
95
78
  - test/docdiff_test.rb
96
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
97
98
  - test/test_helper.rb
98
99
  - test/view_test.rb
99
- - test/viewdiff_test.rb
100
100
  homepage: https://github.com/hisashim/docdiff
101
101
  licenses:
102
102
  - BSD-3-Clause
103
103
  metadata: {}
104
- post_install_message:
105
104
  rdoc_options: []
106
105
  require_paths:
107
106
  - lib
@@ -109,15 +108,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
109
108
  requirements:
110
109
  - - ">="
111
110
  - !ruby/object:Gem::Version
112
- version: '0'
111
+ version: '3.0'
113
112
  required_rubygems_version: !ruby/object:Gem::Requirement
114
113
  requirements:
115
114
  - - ">="
116
115
  - !ruby/object:Gem::Version
117
116
  version: '0'
118
117
  requirements: []
119
- rubygems_version: 3.2.0.rc.2
120
- signing_key:
118
+ rubygems_version: 3.6.9
121
119
  specification_version: 4
122
120
  summary: Word-by-word diff
123
121
  test_files: []
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