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.
Files changed (54) 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 +53 -30
  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 +1 -0
  13. data/lib/doc_diff.rb +13 -0
  14. data/lib/docdiff/version.rb +1 -1
  15. data/lib/docdiff/view.rb +4 -4
  16. data/test/charstring_test.rb +121 -121
  17. data/test/docdiff_test.rb +1 -1
  18. data/test/document_test.rb +109 -109
  19. data/test/fixture/01_ja_utf8_lf.txt +2 -0
  20. data/test/fixture/02_ja_utf8_lf.txt +2 -0
  21. data/test/view_test.rb +135 -111
  22. metadata +39 -36
  23. data/devutil/changelog.sh +0 -40
  24. data/index.html +0 -181
  25. data/langfilter.rb +0 -10
  26. data/readme.html +0 -750
  27. data/readme.md +0 -185
  28. /data/{docdiffwebui.cgi → doc/example/docdiffwebui.cgi} +0 -0
  29. /data/{docdiffwebui.html → doc/example/docdiffwebui.html} +0 -0
  30. /data/{img/docdiff-screenshot-format-html-digest-firefox.png → doc/img/screenshot-format-html-digest-firefox.png} +0 -0
  31. /data/{img/docdiff-screenshot-format-html-firefox.png → doc/img/screenshot-format-html-firefox.png} +0 -0
  32. /data/{img/docdiff-screenshot-format-tty-cmdexe-en.png → doc/img/screenshot-format-tty-cmdexe-en.png} +0 -0
  33. /data/{img/docdiff-screenshot-format-tty-cmdexe-ja.png → doc/img/screenshot-format-tty-cmdexe-ja.png} +0 -0
  34. /data/{img/docdiff-screenshot-format-tty-rxvtunicode-en.png → doc/img/screenshot-format-tty-rxvtunicode-en.png} +0 -0
  35. /data/{img/docdiff-screenshot-format-tty-rxvtunicode-ja.png → doc/img/screenshot-format-tty-rxvtunicode-ja.png} +0 -0
  36. /data/{img/docdiff-screenshot-format-tty-xterm-en.png → doc/img/screenshot-format-tty-xterm-en.png} +0 -0
  37. /data/{img/docdiff-screenshot-format-tty-xterm-ja.png → doc/img/screenshot-format-tty-xterm-ja.png} +0 -0
  38. /data/{img/docdiff-screenshot-resolution-linewordchar-xterm.png → doc/img/screenshot-resolution-linewordchar-xterm.png} +0 -0
  39. /data/{sample/01.en.ascii.cr → test/fixture/01_en_ascii_cr.txt} +0 -0
  40. /data/{sample/01.en.ascii.crlf → test/fixture/01_en_ascii_crlf.txt} +0 -0
  41. /data/{sample/01.en.ascii.lf → test/fixture/01_en_ascii_lf.txt} +0 -0
  42. /data/{sample/01.ja.eucjp.lf → test/fixture/01_ja_eucjp_lf.txt} +0 -0
  43. /data/{sample/01.ja.sjis.cr → test/fixture/01_ja_sjis_cr.txt} +0 -0
  44. /data/{sample/01.ja.sjis.crlf → test/fixture/01_ja_sjis_crlf.txt} +0 -0
  45. /data/{sample/01.ja.utf8.crlf → test/fixture/01_ja_utf8_crlf.txt} +0 -0
  46. /data/{sample/02.en.ascii.cr → test/fixture/02_en_ascii_cr.txt} +0 -0
  47. /data/{sample/02.en.ascii.crlf → test/fixture/02_en_ascii_crlf.txt} +0 -0
  48. /data/{sample/02.en.ascii.lf → test/fixture/02_en_ascii_lf.txt} +0 -0
  49. /data/{sample/02.ja.eucjp.lf → test/fixture/02_ja_eucjp_lf.txt} +0 -0
  50. /data/{sample/02.ja.sjis.cr → test/fixture/02_ja_sjis_cr.txt} +0 -0
  51. /data/{sample/02.ja.sjis.crlf → test/fixture/02_ja_sjis_crlf.txt} +0 -0
  52. /data/{sample/02.ja.utf8.crlf → test/fixture/02_ja_utf8_crlf.txt} +0 -0
  53. /data/{sample/humpty_dumpty01.ascii.lf → test/fixture/humpty_dumpty01_ascii_lf.txt} +0 -0
  54. /data/{sample/humpty_dumpty02.ascii.lf → test/fixture/humpty_dumpty02_ascii_lf.txt} +0 -0
@@ -0,0 +1,146 @@
1
+ = docdiff(1)
2
+
3
+ == NAME
4
+
5
+ docdiff - character/word-oriented diff
6
+
7
+ == SYNOPSIS
8
+
9
+ *docdiff* [_OPTIONS_] _FILE1_ _FILE2_
10
+
11
+ == DESCRIPTION
12
+
13
+ Compares two text files by word, by character, or by line
14
+
15
+ DocDiff compares two text files and shows the difference. It can compare files word by word, character by character, or line by line. It has several output formats such as HTML, tty, Manued, or user-defined markup.
16
+
17
+ It supports several encodings and end-of-line characters, including ASCII (and other single byte encodings such as ISO-8859-*), UTF-8, EUC-JP, Shift_JIS (Windows-31J), CR, LF, and CRLF.
18
+
19
+ == OPTIONS
20
+
21
+ *--resolution*=RESOLUTION::
22
+ specify resolution (granularity)
23
+ _line_|_word_|_char_ (default: _word_)
24
+
25
+ *--line*::
26
+ same as --resolution=_line_
27
+
28
+ *--word*::
29
+ same as --resolution=_word_
30
+
31
+ *--char*::
32
+ same as --resolution=_char_
33
+
34
+ *--encoding*=ENCODING::
35
+ specify character encoding
36
+ _ASCII_|_EUC-JP_|_Shift_JIS_|_CP932_|_UTF-8_|_auto_ (default: _auto_)
37
+ (try _ASCII_ for single byte encodings such as ISO-8859-X)
38
+
39
+ *--ascii*::
40
+ same as *--encoding*=_ASCII_
41
+
42
+ *--iso8859*::
43
+ same as *--encoding*=_ASCII_
44
+
45
+ *--iso8859x*::
46
+ same as *--encoding*=_ASCII_ (deprecated)
47
+
48
+ *--eucjp*::
49
+ same as *--encoding*=_EUC-JP_
50
+
51
+ *--sjis*::
52
+ same as *--encoding*=_Shift_JIS_
53
+
54
+ *--cp932*::
55
+ same as *--encoding*=_CP932_
56
+
57
+ *--utf8*::
58
+ same as *--encoding*=_UTF-8_
59
+
60
+ *--eol*=EOL::
61
+ specify end-of-line character
62
+ _CR_|_LF_|_CRLF_|_auto_ (default: _auto_)
63
+
64
+ *--cr*::
65
+ same as *--eol*=_CR_
66
+
67
+ *--lf*::
68
+ same as *--eol*=_LF_
69
+
70
+ *--crlf*::
71
+ same as *--eol*=_CRLF_
72
+
73
+ *--format*=FORMAT::
74
+ specify output format
75
+ _tty_|_manued_|_html_|_wdiff_|_stat_|_user_ (default: _html_) (_stat_ is deprecated)
76
+ (user tags can be defined in config file)
77
+
78
+ *--tty*::
79
+ same as *--format*=_tty_
80
+
81
+ *--manued*::
82
+ same as *--format*=_manued_
83
+
84
+ *--html*::
85
+ same as *--format*=_html_
86
+
87
+ *--wdiff*::
88
+ same as *--format*=_wdiff_
89
+
90
+ *--stat*::
91
+ same as *--format*=_stat_ (not implemented) (deprecated)
92
+
93
+ *-L*, *--label* LABEL::
94
+ use label instead of file name (not implemented; exists for compatibility with diff)
95
+
96
+ *--digest*::
97
+ digest output, do not show all
98
+
99
+ *--summary*::
100
+ same as *--digest*
101
+
102
+ *--display*=DISPLAY::
103
+ specify presentation type (effective only with digest; experimental feature)
104
+ _inline_|_block_|_multi_ (default: _inline_) (_multi_ is deprecated)
105
+
106
+ *--cache*::
107
+ use file cache (not implemented) (deprecated)
108
+
109
+ *--pager*=PAGER::
110
+ specify pager (if available, $_DOCDIFF_PAGER_ is used by default)
111
+
112
+ *--no-pager*::
113
+ do not use pager
114
+
115
+ *--config-file*=FILE::
116
+ specify config file to read
117
+
118
+ *--no-config-file*::
119
+ do not read config files
120
+
121
+ *--verbose*::
122
+ run verbosely (not well-supported) (deprecated)
123
+
124
+ *--help*::
125
+ show this message
126
+
127
+ *--version*::
128
+ show version
129
+
130
+ *--license*::
131
+ show license (deprecated)
132
+
133
+ *--author*::
134
+ show author(s) (deprecated)
135
+
136
+ When invoked as *worddiff* or *chardiff*, resolution will be set accordingly.
137
+
138
+ Config files: _/etc/docdiff/docdiff.conf_, _~/.config/docdiff/docdiff.conf_
139
+
140
+ == SEE ALSO
141
+
142
+ _/path/to/README.html_.
143
+
144
+ == AUTHOR
145
+
146
+ Hisashi Morita
data/doc/news.md ADDED
@@ -0,0 +1,180 @@
1
+ # News
2
+
3
+ ### 0.6.4 (2025-12-13)
4
+
5
+ * User-visible changes:
6
+ - Removed ChangeLog.
7
+ - Reorganized and updated documents: most documents are moved to `doc/`.
8
+ - `$XDG_CONFIG_HOME`-style user configuration file name (`~/.config/docdiff/docdiff.conf`) is supported and encouraged to use.
9
+ - Added a manual page (`doc/man/docdiff.1` will be generated from `.adoc` by `make docs`).
10
+ - Added shell completion scripts for Zsh and Bash.
11
+ - Cleaned up CLI help message a bit.
12
+ - Added pager support with `--pager=` and `--no-pager` options. `$DOCDIFF_PAGER` is consulted as well.
13
+ - Added `--iso8859` to supersede `--iso8859x`; ditto for `--display=block` and `--display=multi`.
14
+ - Marked to-be-deprecated features as deprecated, e.g.: `--format=stat`, `--stat`, `--cache`, `--iso8859x`, `--display=multi`, `--verbose`, `--license`, `--author`, `~/etc/docdiff/docdiff.conf`, and `~/.docdiff/docdiff.conf`.
15
+ * Developer-related changes:
16
+ - Removed test logging.
17
+ - Fixed erroneous tarball generation (`make dist`).
18
+ - Introduced additional development requirements: git, md2html, asciidoctor.
19
+ - Fixed irregular time stamps of gem members by setting `$SOURCE_DATE_EPOCH`.
20
+ - Converted EUC-JP code files to UTF-8.
21
+
22
+ ### 0.6.3 (2025-12-13)
23
+
24
+ This version was revoked due to a mistake in the release procedure.
25
+
26
+ ### 0.6.2 (2025-11-28)
27
+
28
+ * User-visible changes:
29
+ - Add support for stdin (`-`) in command line arguments (thanks to tamo)
30
+ - Add `--config-file` option (thanks to tamo)
31
+ - Fix incompatibility with Ruby 3.4 `Regexp` (thanks to yoshuki)
32
+ - Resolve frozen literal warnings introduced by Ruby 3.4.
33
+ * Developer-related changes:
34
+ - Remove unused files: ViewDiff and its tests.
35
+ - Update email address in `.gemspec`.
36
+
37
+ ### 0.6.1 (2021-06-07)
38
+
39
+ * User-visible changes:
40
+ - none
41
+ * Developer-related changes:
42
+ - Update information in `.gemspec`. (Primary repository is now GitHub, etc.)
43
+ - Fix: Use `VERSION` from local library when building a gem.
44
+
45
+ ### 0.6.0 (2020-07-10)
46
+
47
+ * User-visible changes:
48
+ - Drop support for Ruby 1.8 (thanks to takahashim).
49
+ - Fix various encoding problems (thanks to takahashim).
50
+ - Add CP932 (Windows-31J) support through a new option `--cp932` (thanks to emasaka).
51
+ - Introduce `readme.md`, which will obsolete `readme.html` eventually (thanks to takahashim).
52
+ * Developer-related changes:
53
+ - Use Mutex#synchronize instead of Thread.exclusive (thanks to hsbt).
54
+ - Remove `JIS0208.TXT` to comply with its terms of use (thanks to kmuto).
55
+ - Introduce top-level class `DocDiff` to avoid name conflict (thanks to hibariya).
56
+
57
+ ### 0.5.0 (2011-08-12)
58
+
59
+ * Gemify. Now you can download docdiff via rubygems.org.
60
+ * Fix failing test on ruby1.9.2-p290.
61
+
62
+ ### 0.4.0 (2011-02-23)
63
+
64
+ * Compatible with Ruby 1.9 (thanks to Kazuhiko).
65
+
66
+ ### 0.3.4 (2007-12-10)
67
+
68
+ * Increased context length in digest mode from 16 to 32.
69
+ * Added `--display=inline|multi` option. With inline, things before change and things after change are displayed inline. With multi, they are displayed in separate blocks. Default is inline.
70
+ * Added `--iso8859x` option as an alias to `--encoding=ASCII`, so that users notice DocDiff can handle text in ISO-8859-* encoding.
71
+
72
+ ### 0.3.3 (2006-02-03)
73
+
74
+ * Fixed arg test so that we can compare non-normal files, such as device files and named pipes (thanks to Shugo Maeda).
75
+ * Added DocDiff Web UI sample (experimental).
76
+ * Fixed HTML output to produce valid XHTML (thanks to Hiroshi OHKUBO). Note that CSS in HTML output is slightly changed.
77
+ * Replaced underscores(`_`) in CSS class names to hyphens(`-`) so that older UAs can understand them (thanks to Kazuhiro NISHIYAMA).
78
+
79
+ ### 0.3.2 (2005-01-03)
80
+
81
+ * Readme is multilingualized (added partial Japanese translation). Try switching CSS between en and ja. Monolingual files are also available (`readme.en.html`, `readme.ja.html`).
82
+ * Outputs better error messages when it failed to auto-detect the encoding and/or eol, though the accuracy is the same.
83
+ * Switched revision control system from CVS to Subversion.
84
+
85
+ ### 0.3.1 (2004-08-29)
86
+
87
+ * Added `-L` (`--label`) option place holder in order to be used as external diff program from Subversion.
88
+
89
+ ### 0.3.0 (2004-05-29)
90
+
91
+ * Re-designed and re-written from scratch.
92
+ * Supports multiple encodings (ASCII, EUC-JP, Shift_JIS, UTF-8) and multiple eols (CR, LF, CRLF).
93
+ * Supports more output formats (tty, HTML, Manued, wdiff-like, user-defined markup text).
94
+ * Supports configuration files (`/etc/docdiff/docdiff.conf`, `~/etc/docdiff/docdiff.conf` (or `~/.docdiff/docdiff.conf`)).
95
+ * Introduced digest (summary) mode.
96
+ * Approximately 200% faster than older versions, thanks to akr's diff library.
97
+ * Better documentation and help message.
98
+ * License changed from Ruby's to modified BSD style.
99
+ * Pure Ruby. Does not require external diff program such as GNU diff, or morphological analyzer such as ChaSen.
100
+ * Runs on both Unix and Windows (tested on Debian GNU/Linux and Cygwin).
101
+ * Unit tests introduced to decrease bugs and to encourage faster development.
102
+ * Makefile introduced.
103
+
104
+ ### 0.1.8 (2003-12-14)
105
+
106
+ * Displays warning when `--bymorpheme` is specified but ChaSen is not available (patch by Akira YAMADA: Debian bug #192258).
107
+ * Supports system-wide configuration file (if `~/.chasenrc.docdiff` does not exist, reads `/etc/docdiff/chasenrc`) (patch by Akira YAMADA: Debian bug #192261).
108
+
109
+ ### 0.1.7 (2003-11-21)
110
+
111
+ * HTML output retains spaces (` ` patch by Akira YAMADA).
112
+ * Manued output is added. Use `--manued` command line option to get result in Manued-like format.
113
+ * Fixed `.chasenrc.docdiff` to be compatible with the latest ChaSen, so that it does not cause error.
114
+ * Alphabet words in the output may look ugly, since ChaSen does not keep spaces between alphabetical words recently.
115
+ * Other minor bug fixes and code cleanup.
116
+
117
+ ### 0.2.0b2 (2001-08-31)
118
+
119
+ * Code cleanup.
120
+
121
+ ### 0.2.0b1 (2001-08-31)
122
+
123
+ * A bit faster than 0.1.x, using file cache.
124
+ * A bit cleaner code.
125
+
126
+ ### 0.1.6 (2001-05-16)
127
+
128
+ * Increased diff option number from 100000 to 1000000 in order to support 900KB+ text files.
129
+
130
+ ### 0.1.5 (2001-01-17)
131
+
132
+ * Erased useless old code which were already commented out.
133
+ * Added documentation. (Updated README, more comments)
134
+ * First public release. Registered to RAA.
135
+
136
+ ### 0.1.4 (2001-01-16)
137
+
138
+ * Output is like `<tag>ab</tag>`, instead of ugly `<tag>a</tag><tag>b</tag>` (thanks again to Masatoshi Seki for suggestion).
139
+ * Fixed hidden bug (`puts` was used to output result).
140
+ * Some code clean-up, though still hairy enough.
141
+
142
+ ### 0.1.3 (2001-01-09)
143
+
144
+ * Tested with Ruby 1.6.2.
145
+ * Fixed `meth(a,b,)` bug (thanks to Masatoshi Seki).
146
+ * Switched development platform from Windows to Linux, but it should work fine on Windows too, except for ChaSen stuff.
147
+
148
+ ### 0.1.2 (2000-12-28)
149
+
150
+ * Mostly bug fix.
151
+
152
+ ### 0.1.1 (2000-12-25)
153
+
154
+ * Bug fix and some cleanup.
155
+ * Quotes some of HTML special characters (`<>&`) when output in HTML.
156
+ * Added support for tty output using escape sequence.
157
+
158
+ ### 0.1.0 (2000-12-19)
159
+
160
+ * ChaSen works fine now.
161
+ * GetOptLong was introduced to support command line options.
162
+
163
+ ### 0.1.0a1 (2000-12-16)
164
+
165
+ * Added ChaSen support. Japanese word by word comparison requires ChaSen.
166
+ * Converted scripts from Shift_JIS/CRLF to EUC-JP/LF.
167
+
168
+ ### 0.0.2 (2000-12-10)
169
+
170
+ * Rewritten to use class.
171
+
172
+ ### 0.0.1 (2000-12-09)
173
+
174
+ * First version. Proof-of-concept.
175
+ * Supports ASCII, EUC-JP, LF only.
176
+ * Supports HTML output only.
177
+ * Requires GNU diff.
178
+ * Distributed under the same license as Ruby's.
179
+
180
+ See the source repository for detail.
@@ -0,0 +1,51 @@
1
+ #compdef docdiff
2
+
3
+ # Zsh completion for DocDiff
4
+
5
+ _docdiff() {
6
+ integer ret=1
7
+ local -a args
8
+ args+=(
9
+ '--resolution=[specify resolution (granularity)]:resolution:(line word char)'
10
+ '--line[same as --resolution=line]'
11
+ '--word[same as --resolution=word]'
12
+ '--char[same as --resolution=char]'
13
+ '--encoding=[specify character encoding]:encoding:(ASCII EUC-JP Shift_JIS CP932 UTF-8 auto)'
14
+ '--ascii[same as --encoding=ASCII]'
15
+ '--iso8859[same as --encoding=ASCII]'
16
+ '--iso8859x[same as --encoding=ASCII (deprecated)]'
17
+ '--eucjp[same as --encoding=EUC-JP]'
18
+ '--sjis[same as --encoding=Shift_JIS]'
19
+ '--cp932[same as --encoding=CP932]'
20
+ '--utf8[same as --encoding=UTF-8]'
21
+ '--eol=[specify end-of-line character]:eol:(CR LF CRLF auto)'
22
+ '--cr[same as --eol=CR]'
23
+ '--lf[same as --eol=LF]'
24
+ '--crlf[same as --eol=CRLF]'
25
+ '--format=[specify output format]:format:(tty manued html wdiff stat user)'
26
+ '--tty[same as --format=tty]'
27
+ '--manued[same as --format=manued]'
28
+ '--html[same as --format=html]'
29
+ '--wdiff[same as --format=wdiff]'
30
+ '--stat[same as --format=stat (not implemented) (deprecated)]'
31
+ '(--label= -L)'{--label=,-L}'[use label instead of file name (not implemented)]:label'
32
+ '--digest[digest output, do not show all]'
33
+ '--summary[same as --digest]'
34
+ '--display=[specify presentation type (effective only with digest)]:type:(inline block multi)'
35
+ '--cache[use file cache (not implemented) (deprecated)]'
36
+ '--pager=[specify pager]:pager:_command_names'
37
+ '--no-pager[do not use pager]'
38
+ '--config-file=[specify config file to read]:config_file:_files'
39
+ '--no-config-file[do not read config files]'
40
+ '--verbose[run verbosely (not well-supported) (deprecated)]'
41
+ '(- *)--help[show this message]'
42
+ '(- *)--version[show version]'
43
+ '(- *)--license[show license (deprecated)]'
44
+ '(- *)--author[show author(s) (deprecated)]'
45
+ '*:file:_files'
46
+ )
47
+ _arguments $args[@] && ret=0
48
+ return ret
49
+ }
50
+
51
+ _docdiff
@@ -0,0 +1,68 @@
1
+ # Bash completion for DocDiff
2
+
3
+ _docdiff_completions()
4
+ {
5
+ local cur prev opts
6
+ cur="${COMP_WORDS[COMP_CWORD]}"
7
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
8
+ opts="\
9
+ --resolution \
10
+ --line --word --char \
11
+ --encoding \
12
+ --ascii --iso8859 --iso8859x --eucjp --sjis --cp932 --utf8 \
13
+ --eol \
14
+ --cr --lf --crlf \
15
+ --format \
16
+ --tty --manued --html --wdiff --stat \
17
+ -L --label \
18
+ --digest --summary \
19
+ --display \
20
+ --cache \
21
+ --pager \
22
+ --no-pager \
23
+ --config-file \
24
+ --no-config-file \
25
+ --verbose \
26
+ --help \
27
+ --version \
28
+ --license \
29
+ --author\
30
+ "
31
+ COMPREPLY=()
32
+
33
+ case ${prev} in
34
+ --resolution)
35
+ COMPREPLY=( $(compgen -W 'line word char' -- "${cur}") )
36
+ return 0
37
+ ;;
38
+ --encoding)
39
+ COMPREPLY=( $(compgen -W 'ASCII EUC-JP Shift_JIS CP932 UTF-8 auto' -- "${cur}") )
40
+ return 0
41
+ ;;
42
+ --eol)
43
+ COMPREPLY=( $(compgen -W 'CR LF CRLF auto' -- "${cur}") )
44
+ return 0
45
+ ;;
46
+ --format)
47
+ COMPREPLY=( $(compgen -W 'tty manued html wdiff stat user' -- "${cur}") )
48
+ return 0
49
+ ;;
50
+ --display)
51
+ COMPREPLY=( $(compgen -W 'inline block multi' -- "${cur}") )
52
+ return 0
53
+ ;;
54
+ --config-file)
55
+ COMPREPLY=( $(compgen -A file -- "${cur}") )
56
+ return 0
57
+ ;;
58
+ --help | --version | --license | --author)
59
+ return 0
60
+ ;;
61
+ esac
62
+
63
+ if [[ ${cur} == -* ]]; then
64
+ COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
65
+ return
66
+ fi
67
+ } &&
68
+ complete -o bashdefault -o default -F _docdiff_completions docdiff
data/docdiff.gemspec CHANGED
@@ -20,4 +20,5 @@ Gem::Specification.new do |s|
20
20
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
21
21
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
22
22
  s.require_paths = ["lib"]
23
+ s.required_ruby_version = '>= 3.0'
23
24
  end
data/lib/doc_diff.rb CHANGED
@@ -15,6 +15,12 @@ class DocDiff
15
15
  SystemConfigFileName = File.join(File::Separator, "etc", "docdiff", "docdiff.conf")
16
16
  UserConfigFileName = File.join(ENV['HOME'], "etc", "docdiff", "docdiff.conf")
17
17
  AltUserConfigFileName = File.join(ENV['HOME'], ".docdiff", "docdiff.conf")
18
+ XDGUserConfigFileName =
19
+ if xdg_config_home = ENV['XDG_CONFIG_HOME'] && !xdg_config_home.empty?
20
+ File.join(ENV['HOME'], xdg_config_home, "docdiff", "docdiff.conf")
21
+ else
22
+ File.join(ENV['HOME'], ".config", "docdiff", "docdiff.conf")
23
+ end
18
24
 
19
25
  def initialize()
20
26
  @config = {}
@@ -171,4 +177,11 @@ class DocDiff
171
177
  message
172
178
  end
173
179
 
180
+ def print_or_write_to_pager(content, pager)
181
+ if STDOUT.tty? && pager.is_a?(String) && !pager.empty?
182
+ IO.popen(pager, "w"){|f| f.print content}
183
+ else
184
+ print content
185
+ end
186
+ end
174
187
  end # class DocDiff
@@ -1,3 +1,3 @@
1
1
  module Docdiff
2
- VERSION = "0.6.2"
2
+ VERSION = "0.6.4"
3
3
  end
data/lib/docdiff/view.rb CHANGED
@@ -152,7 +152,7 @@ class View
152
152
  case display
153
153
  when 'inline'
154
154
  result << (e_head.call(pos_str) + e_cxt_pre + e_chg + e_cxt_post + e_foot)
155
- when 'multi'
155
+ when /block|multi/
156
156
  result << (e_head.call(pos_str) + e_cxt_pre + e_chgdel + e_cxt_post +
157
157
  e_cxt_pre + e_chgadd + e_cxt_post + e_foot)
158
158
  else raise "Unsupported display type: #{display}"
@@ -163,7 +163,7 @@ class View
163
163
  case display
164
164
  when 'inline'
165
165
  result << (e_head.call(pos_str) + e_cxt_pre + e_del + e_cxt_post + e_foot)
166
- when 'multi'
166
+ when /block|multi/
167
167
  result << (e_head.call(pos_str) + e_cxt_pre + e_src + e_cxt_post +
168
168
  e_cxt_pre + e_del + e_cxt_post + e_foot)
169
169
  else raise "Unsupported display type: #{display}"
@@ -174,7 +174,7 @@ class View
174
174
  case display
175
175
  when 'inline'
176
176
  result << (e_head.call(pos_str) + e_cxt_pre + e_add + e_cxt_post + e_foot)
177
- when 'multi'
177
+ when /block|multi/
178
178
  result << (e_head.call(pos_str) + e_cxt_pre + e_src + e_cxt_post +
179
179
  e_cxt_pre + e_add + e_cxt_post + e_foot)
180
180
  else raise "Unsupported display type: #{display}"
@@ -372,7 +372,7 @@ class View
372
372
  tags = manued_tags()
373
373
  # manued specific kludge: change should be [a/b] in inline, [a/][/b] in multi
374
374
  display = (overriding_opts and overriding_opts[:display]) || 'inline'
375
- if display == 'multi'
375
+ if /block|multi/.match display
376
376
  tags.update({:end_before_change => '/]', :start_after_change => '[/'})
377
377
  end
378
378
  tags.update(overriding_opts) if overriding_opts