review 1.7.2 → 2.0.0.beta1

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 (101) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +1 -43
  3. data/.travis.yml +0 -9
  4. data/ChangeLog +0 -16
  5. data/Gemfile +1 -0
  6. data/README.rdoc +1 -1
  7. data/Rakefile +12 -1
  8. data/bin/review-check +21 -8
  9. data/bin/review-compile +15 -9
  10. data/bin/review-epubmaker-legacy +6 -6
  11. data/bin/review-index +13 -2
  12. data/bin/review-init +18 -12
  13. data/bin/review-preproc +14 -1
  14. data/bin/review-validate +1 -1
  15. data/bin/review-vol +13 -1
  16. data/doc/quickstart.ja.md +1 -1
  17. data/doc/quickstart.md +1 -1
  18. data/lib/epubmaker/content.rb +3 -3
  19. data/lib/epubmaker/epubcommon.rb +108 -91
  20. data/lib/epubmaker/epubv2.rb +67 -14
  21. data/lib/epubmaker/epubv3.rb +59 -25
  22. data/lib/epubmaker/producer.rb +1 -13
  23. data/lib/lineinput.rb +0 -48
  24. data/lib/review/book/base.rb +4 -12
  25. data/lib/review/book/compilable.rb +3 -1
  26. data/lib/review/book/index.rb +4 -4
  27. data/lib/review/builder.rb +54 -47
  28. data/lib/review/compiler.rb +4662 -326
  29. data/lib/review/compiler/literals_1_8.kpeg +19 -0
  30. data/lib/review/compiler/literals_1_8.rb +432 -0
  31. data/lib/review/compiler/literals_1_9.kpeg +22 -0
  32. data/lib/review/compiler/literals_1_9.rb +435 -0
  33. data/lib/review/configure.rb +8 -20
  34. data/lib/review/epubbuilder.rb +1 -1
  35. data/lib/review/epubmaker.rb +122 -52
  36. data/lib/review/ewbbuilder.rb +4 -4
  37. data/lib/review/exception.rb +1 -1
  38. data/lib/review/extentions.rb +1 -0
  39. data/lib/review/extentions/array.rb +25 -0
  40. data/lib/review/htmlbuilder.rb +286 -275
  41. data/lib/review/htmllayout.rb +0 -2
  42. data/lib/review/htmlutils.rb +4 -4
  43. data/lib/review/i18n.rb +2 -6
  44. data/lib/review/i18n.yml +1 -1
  45. data/lib/review/idgxmlbuilder.rb +239 -204
  46. data/lib/review/inaobuilder.rb +75 -73
  47. data/lib/review/latexbuilder.rb +265 -219
  48. data/lib/review/latexutils.rb +6 -6
  49. data/lib/review/layout.tex.erb +1 -1
  50. data/lib/review/location.rb +24 -0
  51. data/lib/review/markdownbuilder.rb +124 -79
  52. data/lib/review/node.rb +267 -0
  53. data/lib/review/pdfmaker.rb +92 -92
  54. data/lib/review/preprocessor.rb +51 -14
  55. data/lib/review/review.kpeg +724 -0
  56. data/lib/review/textbuilder.rb +1 -1
  57. data/lib/review/textutils.rb +24 -18
  58. data/lib/review/tocparser.rb +3 -3
  59. data/lib/review/tocprinter.rb +31 -8
  60. data/lib/review/topbuilder.rb +119 -111
  61. data/lib/review/unfold.rb +2 -2
  62. data/lib/review/version.rb +1 -1
  63. data/review.gemspec +2 -2
  64. data/rubocop-todo.yml +456 -0
  65. data/test/assets/test_template.tex +1 -1
  66. data/test/sample-book/src/config.yml +0 -1
  67. data/test/test.re +1 -1
  68. data/test/test_book.rb +4 -4
  69. data/test/test_book_chapter.rb +70 -0
  70. data/test/test_book_part.rb +1 -1
  71. data/test/test_builder.rb +6 -28
  72. data/test/test_compiler.rb +59 -14
  73. data/test/test_helper.rb +47 -4
  74. data/test/test_htmlbuilder.rb +104 -73
  75. data/test/test_i18n.rb +5 -3
  76. data/test/test_idgxmlbuilder.rb +5 -2
  77. data/test/test_inaobuilder.rb +4 -2
  78. data/test/test_latexbuilder.rb +18 -37
  79. data/test/test_lineinput.rb +25 -4
  80. data/test/test_markdownbuilder.rb +4 -22
  81. data/test/test_pdfmaker.rb +12 -11
  82. data/test/test_textutils.rb +0 -36
  83. data/test/test_topbuilder.rb +2 -0
  84. metadata +14 -28
  85. data/.rubocop_todo.yml +0 -605
  86. data/Dockerfile +0 -22
  87. data/doc/NEWS.ja.md +0 -362
  88. data/doc/NEWS.md +0 -366
  89. data/lib/review/htmltoc.rb +0 -45
  90. data/lib/review/template.rb +0 -21
  91. data/templates/html/layout-html5.html.erb +0 -17
  92. data/templates/html/layout-xhtml1.html.erb +0 -20
  93. data/templates/ncx/epubv2.ncx.erb +0 -11
  94. data/templates/opf/epubv2.opf.erb +0 -21
  95. data/templates/opf/epubv3.opf.erb +0 -18
  96. data/templates/xml/container.xml.erb +0 -6
  97. data/test/assets/test.xml.erb +0 -3
  98. data/test/sample-book/src/config-epub2.yml +0 -186
  99. data/test/test_configure.rb +0 -50
  100. data/test/test_htmltoc.rb +0 -32
  101. data/test/test_template.rb +0 -26
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5449a3e4fd04d6c45855f7858fe37e4b73ed92f8
4
- data.tar.gz: f14a9c926fd798eb05456fccec1d377573ec0e98
3
+ metadata.gz: 82a5efdce4b15d0add6f2997f5e98b19dee1f83a
4
+ data.tar.gz: f4a04d0a1808a72e489d1271351d68d3cd23f492
5
5
  SHA512:
6
- metadata.gz: 4f02063b7744003b7d51b41894c5bc4efba4446c33d7a0990d3054724e5d194109991c4005c083f1a1c1f4bb7fdb92c797cc1a214de8d77d29e664989e434f91
7
- data.tar.gz: 0442d498dfbbab961286734b7ef544f86ad79f24a3744e6227f1e00b8d99fef12c81c0a27863b5c465f35b01e116cd4068f2f62fe6e926fad76f61eacec8ee36
6
+ metadata.gz: 827e1cd15bfc144217b36c859e31c3eecfa706415fd5a741b9e9e259a509c8e5f9b10f70a8d7cafebaac77a960473d5d2e1009e069b8910cf7b82a5d0e3213b5
7
+ data.tar.gz: a77e6829d1dd2f49c00505fd3c4f40e4c2d9ef379ed580f4a2e46d4a9358b1fa56f8a7d3227e7928cfc631bce75ad81192f041fc0bd880eb96f4721bfdbc9daa
data/.rubocop.yml CHANGED
@@ -1,43 +1 @@
1
- AllCops:
2
- Exclude:
3
- - lib/lineinput.rb
4
- - lib/uuid.rb
5
-
6
- inherit_from: .rubocop_todo.yml
7
-
8
- Lint/BlockAlignment:
9
- Enabled: true
10
-
11
- Lint/EndAlignment:
12
- Enabled: AlignWith
13
-
14
- Performance/ReverseEach:
15
- Enabled: true
16
-
17
- # Unnecessary spacing detected.
18
- Style/ExtraSpacing:
19
- Enabled: true
20
-
21
- # Use tr instead of gsub.
22
- Performance/StringReplacement:
23
- Enabled: false
24
-
25
- # Use alias_method instead of alias.
26
- Style/Alias:
27
- Enabled: true
28
-
29
- # Do not introduce global variables.
30
- Style/GlobalVars:
31
- Enabled: true
32
-
33
- # Use self-assignment shorthand +=.
34
- Style/SelfAssignment:
35
- Enabled: true
36
-
37
- # When defining the == operator, name its argument other.
38
- Style/OpMethod:
39
- Enabled: true
40
-
41
- # Use snake_case for variable names.
42
- Style/VariableName:
43
- Enabled: true
1
+ inherit_from: rubocop-todo.yml
data/.travis.yml CHANGED
@@ -1,18 +1,9 @@
1
- language: ruby
2
- sudo: false
3
-
4
1
  rvm:
5
2
  - 1.9.3
6
3
  - 2.0.0
7
4
  - 2.1.*
8
5
  - 2.2.*
9
- - ruby-head
10
6
 
11
7
  branches:
12
8
  only:
13
9
  - master
14
-
15
- script:
16
- - bundle exec rake test
17
- - bundle exec rubocop
18
-
data/ChangeLog CHANGED
@@ -1,19 +1,3 @@
1
- Sun Dec 27 16:25:45 2015 Masayoshi Takahashi <takahashimm@gmail.com>
2
-
3
- * Release 1.7.2
4
-
5
- Sun Nov 29 23:12:29 2015 Masayoshi Takahashi <takahashimm@gmail.com>
6
-
7
- * Release 1.7.1
8
-
9
- Thu Oct 29 13:58:22 2015 KADO Masanori <kdmsnr@gmail.com>
10
-
11
- * Release 1.7.0
12
-
13
- Mon Jun 29 18:16:06 2015 KADO Masanori <kdmsnr@gmail.com>
14
-
15
- * Release 1.6.0
16
-
17
1
  Sat Feb 28 19:51:29 2015 KADO Masanori <kdmsnr@gmail.com>
18
2
 
19
3
  * Release 1.5.0.
data/Gemfile CHANGED
@@ -3,3 +3,4 @@ source 'https://rubygems.org'
3
3
  # Specify your gem's dependencies in review.gemspec
4
4
  gemspec
5
5
 
6
+ gem "json"
data/README.rdoc CHANGED
@@ -78,4 +78,4 @@ LGPL. See COPYING file.
78
78
 
79
79
  == Copyright
80
80
 
81
- Copyright (c) 2006-2015 Minero Aoki, Kenshi Muto, Masayoshi Takahashi, Masanori Kado.
81
+ Copyright (c) 2006-2014 Minero Aoki, Kenshi Muto, Masayoshi Takahashi, Masanori Kado.
data/Rakefile CHANGED
@@ -1,3 +1,5 @@
1
+ require 'fileutils'
2
+
1
3
  begin
2
4
  require 'bundler'
3
5
  Bundler::GemHelper.install_tasks
@@ -11,8 +13,17 @@ require 'rake/clean'
11
13
 
12
14
  task :default => [:test]
13
15
 
16
+ task :kpeg do
17
+ FileUtils.rm_f "lib/review/compiler.rb"
18
+ FileUtils.rm_f "lib/review/compiler/literals_1_8.rb"
19
+ FileUtils.rm_f "lib/review/compiler/literals_1_9.rb"
20
+ sh "kpeg -s lib/review/compiler/literals_1_8.kpeg -o lib/review/compiler/literals_1_8.rb"
21
+ sh "kpeg -s lib/review/compiler/literals_1_9.kpeg -o lib/review/compiler/literals_1_9.rb"
22
+ sh "kpeg -s lib/review/review.kpeg -o lib/review/compiler.rb"
23
+ end
24
+
14
25
  Rake::TestTask.new("test") do |t|
15
- t.libs << "test"
26
+ t.libs << "test"
16
27
  t.test_files = Dir.glob("test/**/test_*.rb")
17
28
  t.verbose = true
18
29
  end
data/bin/review-check CHANGED
@@ -31,7 +31,12 @@ rescue Errno::EPIPE
31
31
  end
32
32
 
33
33
  def main
34
+ $KCODE = 'UTF-8' unless defined?(Encoding)
34
35
  @config = ReVIEW::Configure.values
36
+ @config.merge!({
37
+ "inencoding" => "UTF-8",
38
+ "outencoding" => "UTF-8"
39
+ })
35
40
  @book = ReVIEW::Book::Base.load
36
41
  @book.config = @config
37
42
 
@@ -39,6 +44,12 @@ def main
39
44
  files = ARGV unless ARGV.empty?
40
45
  opts = OptionParser.new
41
46
  opts.version = ReVIEW::VERSION
47
+ opts.on('--inencoding=ENCODING', 'Set input encoding. (UTF-8, EUC, JIS, and SJIS)') {|enc|
48
+ @config["inencoding"] = enc
49
+ }
50
+ opts.on('--outencoding=ENCODING', 'Set output encoding. (UTF-8[default], EUC, JIS, and SJIS)') {|enc|
51
+ @config["outencoding"] = enc
52
+ }
42
53
  opts.on('-a', '--all-chapters', 'Check all chapters.') {
43
54
  files = @book.chapters.map {|ent| ent.path }
44
55
  }
@@ -84,11 +95,11 @@ def check_text(files)
84
95
  each_paragraph(f) do |para, lineno|
85
96
  s = para.join('')
86
97
  if m = re.match(s)
87
- next if m[0] == @review_utils_word_ok
98
+ next if m[0] == $ReVIEW_utils_word_ok
88
99
  next if neg and neg =~ s
89
100
  str, offset = find_line(para, re)
90
101
  out = sprintf("%s:%d: %s\n", path, lineno + offset, str)
91
- print out
102
+ print convert_outencoding(out, @config["outencoding"])
92
103
  end
93
104
  end
94
105
  }
@@ -98,14 +109,14 @@ end
98
109
  def find_line(lines, re)
99
110
  # single line?
100
111
  lines.each_with_index do |line, idx|
101
- return line.gsub(re, '<<<\&>>>'), idx if re =~ line
112
+ return line.gsub(re, '<<<\&>>>'), idx if re =~ line
102
113
  end
103
114
 
104
115
  # multiple lines?
105
116
  i = 0
106
117
  while i < lines.size - 1
107
118
  str = lines[i] + lines[i+1]
108
- return str.gsub(re, '<<<\&>>>'), i if re =~ str
119
+ return str.gsub(re, '<<<\&>>>'), i if re =~ str
109
120
  i += 1
110
121
  end
111
122
 
@@ -116,7 +127,7 @@ def words_re(rc)
116
127
  words = []
117
128
  nega = []
118
129
  File.foreach(rc) do |line|
119
- next if line[0,1] == '#'
130
+ next if line[0,1] == '#'
120
131
  if / !/ =~ line
121
132
  line, n = *line.split(/!/, 2)
122
133
  nega.push n.strip
@@ -128,11 +139,13 @@ def words_re(rc)
128
139
  end
129
140
 
130
141
  def each_paragraph(f)
131
- @review_utils_word_ok = nil
142
+ $ReVIEW_utils_word_ok = nil
132
143
  while line = f.gets
144
+ line = convert_inencoding(line, @config["inencoding"])
145
+
133
146
  case line
134
147
  when /\A\#@ok\((.*)\)/
135
- @review_utils_word_ok = $1
148
+ $ReVIEW_utils_word_ok = $1
136
149
  when /\A\#@/
137
150
  ;
138
151
  when %r[\A//caption\{(.*?)//\}]
@@ -155,7 +168,7 @@ def each_paragraph(f)
155
168
  buf.push line.strip
156
169
  end
157
170
  yield buf, lineno
158
- @review_utils_word_ok = nil
171
+ $ReVIEW_utils_word_ok = nil
159
172
  end
160
173
  end
161
174
  end
data/bin/review-compile CHANGED
@@ -34,6 +34,8 @@ rescue Errno::EPIPE
34
34
  end
35
35
 
36
36
  def _main
37
+ $KCODE = 'UTF-8' unless defined?(Encoding)
38
+
37
39
  mode = :files
38
40
  basedir = nil
39
41
  if /\Areview2/ =~ File.basename($0)
@@ -46,14 +48,16 @@ def _main
46
48
 
47
49
  config = ReVIEW::Configure.values
48
50
  config.merge!({
49
- "secnolevel" => 2, # for IDGXML and HTML
50
- "tableopt" => nil, # for IDGXML
51
- "nolf" => nil, # for IDGXML
52
- "chapref" => nil, # for IDGXML
51
+ "secnolevel" => 2, # for IDGXML and HTML
52
+ "tableopt" => nil, # for IDGXML
53
+ "nolf" => nil, # for IDGXML
54
+ "chapref" => nil, # for IDGXML
53
55
  "structuredxml" => nil, # for IDGXML
54
- "stylesheet" => [], # for HTML
55
- "mathml" => nil, # for HTML
56
- "language" => "ja", # for HTML
56
+ "inencoding" => "UTF-8",
57
+ "outencoding" => "UTF-8",
58
+ "stylesheet" => [], # for HTML
59
+ "mathml" => nil, # for HTML
60
+ "language" => "ja", # for HTML
57
61
  "deprecated-blocklines" => nil,
58
62
  "footnotetext" => false,
59
63
  "htmlext" => "html",
@@ -67,6 +71,8 @@ def _main
67
71
  require 'yaml'
68
72
  config = config.merge(YAML.load_file(yaml))
69
73
  end
74
+ opts.on('--inencoding=ENCODING', 'Set input encoding. (UTF-8, EUC, JIS, and SJIS)') {|enc| config["inencoding"] = enc }
75
+ opts.on('--outencoding=ENCODING', 'Set output encoding. (UTF-8[default], EUC, JIS, and SJIS)') {|enc| config["outencoding"] = enc }
70
76
  opts.on('-c', '--check', 'Check manuscript') { check_only = true }
71
77
  opts.on('--level=LVL', 'Section level to append number.') {|lvl| config["secnolevel"] = lvl.to_i }
72
78
  opts.on('--toclevel=LVL', 'Section level to append number.') {|lvl| config["toclevel"] = lvl.to_i }
@@ -167,12 +173,12 @@ def _main
167
173
  compiler = ReVIEW::Compiler.new(load_strategy_class(target, check_only))
168
174
  book.chapters.each do |chap|
169
175
  str = compiler.compile(chap)
170
- write "#{chap.name}#{compiler.strategy.extname}", str unless check_only
176
+ write "#{chap.name}#{compiler.strategy.extname}", str unless check_only
171
177
  end
172
178
  # PART
173
179
  book.parts_in_file.each do |part|
174
180
  str = compiler.compile(part)
175
- write "#{part.name}#{compiler.strategy.extname}", str unless check_only
181
+ write "#{part.name}#{compiler.strategy.extname}", str unless check_only
176
182
  end
177
183
  else
178
184
  raise "must not happen: #{mode}"
@@ -28,7 +28,7 @@ require 'review/i18n'
28
28
  require 'review/htmlutils'
29
29
  include ReVIEW::HTMLUtils
30
30
 
31
- @essential_files = ['top', 'toc', 'colophon']
31
+ $essential_files = ['top', 'toc', 'colophon']
32
32
  def main
33
33
  opts = OptionParser.new
34
34
  opts.version = ReVIEW::VERSION
@@ -57,7 +57,7 @@ def main
57
57
  yamlfile = ARGV[0]
58
58
  values = ReVIEW::Configure.values.merge(YAML.load_file(yamlfile))
59
59
  bookname = values["bookname"]
60
- @essential_files <<= bookname
60
+ $essential_files <<= bookname
61
61
  tmp = values["debug"].nil? ? Dir.mktmpdir : "."
62
62
  @bookdir = "#{tmp}/#{bookname}-epub"
63
63
  @epubversion = values["epubversion"] || 2
@@ -774,8 +774,8 @@ end
774
774
 
775
775
  def output_chaps_by_file(l, values)
776
776
  file_id = File.basename(l.chomp.strip,".*")
777
- if (idx = @essential_files.index(file_id))
778
- if idx == @essential_files.size - 1
777
+ if (idx = $essential_files.index(file_id))
778
+ if idx == $essential_files.size - 1
779
779
  STDERR.puts "#{file_id} is book name. Please rename #{l.chomp.strip}."
780
780
  else
781
781
  STDERR.puts "#{file_id} is special name. Please rename #{l.chomp.strip}."
@@ -800,8 +800,8 @@ def include_mathml?(filename)
800
800
  }
801
801
  return false
802
802
  }
803
- rescue
804
- false
803
+ rescue
804
+ false
805
805
  end
806
806
 
807
807
  def getFigId(filename)
data/bin/review-index CHANGED
@@ -32,14 +32,25 @@ rescue Errno::EPIPE
32
32
  end
33
33
 
34
34
  def _main
35
+ $KCODE = 'UTF-8' unless defined?(Encoding)
36
+
35
37
  printer_class = ReVIEW::TextTOCPrinter
36
38
  source = nil
37
39
  upper = ReVIEW::TOCPrinter.default_upper_level
38
- param = {}
40
+ param = {
41
+ "inencoding" => "UTF-8",
42
+ "outencoding" => "UTF-8"
43
+ }
39
44
  book = ReVIEW::Book::Base.load
40
45
 
41
46
  opts = OptionParser.new
42
47
  opts.version = ReVIEW::VERSION
48
+ opts.on('--inencoding=ENCODING', 'Set input encoding. (UTF-8, EUC, JIS, and SJIS)') {|enc|
49
+ param["inencoding"] = enc
50
+ }
51
+ opts.on('--outencoding=ENCODING', 'Set output encoding. (UTF-8[default], EUC, JIS, and SJIS)') {|enc|
52
+ param["outencoding"] = enc
53
+ }
43
54
  opts.on('-a', '--all', 'print all chapters.') {
44
55
  begin
45
56
  source = book
@@ -60,7 +71,7 @@ def _main
60
71
  }
61
72
  opts.on('-l', '--level N', 'list upto N level (1..4, default=4)') {|n|
62
73
  upper = Integer(n)
63
- unless (0..4).include?(upper) # 0 is hidden option
74
+ unless (0..4).include?(upper) # 0 is hidden option
64
75
  $stderr.puts "-l/--level option accepts only 1..4"
65
76
  exit 1
66
77
  end
data/bin/review-init CHANGED
@@ -31,9 +31,6 @@ def main
31
31
  opts.on('-l', '--locale', 'generate locale.yml file.') {
32
32
  @locale = true
33
33
  }
34
- opts.on('', '--epub-version VERSION', 'define EPUB version') { |version|
35
- @epub_version = version
36
- }
37
34
  begin
38
35
  opts.parse!
39
36
  rescue OptionParser::ParseError => err
@@ -83,10 +80,23 @@ end
83
80
 
84
81
  def generate_layout(dir)
85
82
  FileUtils.mkdir_p dir + '/layouts'
86
- if @epub_version.to_i == 2
87
- FileUtils.cp @review_dir + "/templates/html/layout-xhtml1.html.erb", dir + '/layouts/layout.html.erb'
88
- else
89
- FileUtils.cp @review_dir + "/templates/html/layout-html5.html.erb", dir + '/layouts/layout.html.erb'
83
+ File.open("#{dir}/layouts/layout.html.erb", "w") do |file|
84
+ file.write <<-EOS
85
+ <?xml version="1.0" encoding="UTF-8"?>
86
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
87
+ <html xmlns="http://www.w3.org/1999/xhtml" xmlns:ops="http://www.idpf.org/2007/ops" xml:lang="ja">
88
+ <head>
89
+ <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
90
+ <meta http-equiv="Content-Style-Type" content="text/css" />
91
+ <link rel="stylesheet" type="text/css" href="style.css" />
92
+ <meta name="generator" content="Re:VIEW" />
93
+ <title><%= title %></title>
94
+ </head>
95
+ <body>
96
+ <%= body %>
97
+ </body>
98
+ </html>
99
+ EOS
90
100
  end
91
101
  end
92
102
 
@@ -115,11 +125,7 @@ def generate_cover_image(dir)
115
125
  end
116
126
 
117
127
  def generate_config(dir)
118
- if @epub_version.to_i == 2
119
- FileUtils.cp @review_dir + "/test/sample-book/src/config-epub2.yml", File.join(dir, "config.yml")
120
- else
121
- FileUtils.cp @review_dir + "/test/sample-book/src/config.yml", dir
122
- end
128
+ FileUtils.cp @review_dir + "/test/sample-book/src/config.yml", dir
123
129
  end
124
130
 
125
131
  def generate_style(dir)
data/bin/review-preproc CHANGED
@@ -35,12 +35,25 @@ rescue Errno::EPIPE
35
35
  end
36
36
 
37
37
  def main
38
- param = {}
38
+ $KCODE = 'UTF-8' unless defined?(Encoding)
39
+
40
+ param = {
41
+ "inencoding" => "UTF-8",
42
+ "outencoding" => "UTF-8",
43
+ }
39
44
 
40
45
  mode = :output
41
46
  opts = OptionParser.new
42
47
  opts.version = ReVIEW::VERSION
43
48
  opts.banner = "Usage: #{File.basename($0)} [-c|-d|-s|--replace] [<file>...]"
49
+ opts.on('--inencoding=ENCODING', 'Set input encoding. (UTF-8, EUC, JIS, and
50
+ SJIS)') {|enc|
51
+ param["inencoding"] = enc
52
+ }
53
+ opts.on('--outencoding=ENCODING', 'Set output encoding. (UTF-8[default], EUC
54
+ , JIS, and SJIS)') {|enc|
55
+ param["outencoding"] = enc
56
+ }
44
57
  opts.on('-c', '--check', 'Check if preprocess is needed.') {
45
58
  mode = :check
46
59
  }
data/bin/review-validate CHANGED
@@ -15,7 +15,7 @@ colcount = 0
15
15
  ln = 0
16
16
 
17
17
  ARGF.each {|line|
18
- ln += 1
18
+ ln = ln + 1
19
19
  if line =~ /\A\/\/([a-z]+).+\{/
20
20
  # block
21
21
  _block = $1