bin/review-check in review-1.0.0 vs bin/review-check in review-1.1.0
- old
+ new
@@ -13,17 +13,20 @@
require 'pathname'
bindir = Pathname.new(__FILE__).realpath.dirname
$LOAD_PATH.unshift((bindir + '../lib').realpath)
-require 'review/book'
+require 'review'
require 'optparse'
-require 'nkf'
+include ReVIEW::TextUtils
+
def sigmain
Signal.trap(:INT) { exit 1 }
- Signal.trap(:PIPE, 'IGNORE')
+ if RUBY_PLATFORM !~ /mswin(?!ce)|mingw|cygwin|bccwin/
+ Signal.trap(:PIPE, 'IGNORE')
+ end
main
rescue Errno::EPIPE
exit 0
end
@@ -90,19 +93,11 @@
if m = re.match(s)
next if m[0] == $ReVIEW_utils_word_ok
next if neg and neg =~ s
str, offset = find_line(para, re)
out = sprintf("%s:%d: %s\n", path, lineno + offset, str)
- if @param["outencoding"] =~ /^EUC$/
- print NKF.nkf("-e", out)
- elsif @param["outencoding"] =~ /^SJIS$/
- print NKF.nkf("-s", out)
- elsif @param["outencoding"] =~ /^JIS$/
- print NKF.nkf("-j", out)
- else
- print out
- end
+ print convert_outencoding(out, @param["outencoding"])
end
end
}
end
end
@@ -140,18 +135,11 @@
end
def each_paragraph(f)
$ReVIEW_utils_word_ok = nil
while line = f.gets
- if @param["inencoding"] =~ /^EUC$/
- line = NKF.nkf("-E -w", line)
- elsif @param["inencoding"] =~ /SJIS$/
- line = NKF.nkf("-S -w", line)
- elsif @param["inencoding"] =~ /^JIS$/
- line = NKF.nkf("-J -w", line)
- else
- line = NKF.nkf("-w", line)
- end
+ line = convert_inencoding(line, @param["inencoding"])
+
case line
when /\A\#@ok\((.*)\)/
$ReVIEW_utils_word_ok = $1
when /\A\#@/
;