review 2.5.0 → 3.0.0.preview1

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 (121) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +28 -10
  3. data/.travis.yml +11 -2
  4. data/NEWS.ja.md +89 -17
  5. data/NEWS.md +92 -0
  6. data/README.md +1 -1
  7. data/Rakefile +0 -13
  8. data/bin/review-catalog-converter +83 -37
  9. data/bin/review-check +17 -5
  10. data/bin/review-compile +1 -1
  11. data/bin/review-index +6 -0
  12. data/bin/review-init +3 -155
  13. data/bin/review-preproc +0 -5
  14. data/bin/review-validate +21 -7
  15. data/bin/review-vol +13 -5
  16. data/doc/config.yml.sample +12 -7
  17. data/doc/config.yml.sample-simple +1 -1
  18. data/doc/format.ja.md +39 -3
  19. data/doc/format.md +39 -3
  20. data/doc/format_idg.ja.md +0 -4
  21. data/doc/pdfmaker.ja.md +1 -1
  22. data/doc/pdfmaker.md +1 -1
  23. data/doc/sample.css +7 -0
  24. data/lib/epubmaker/content.rb +31 -12
  25. data/lib/epubmaker/epubcommon.rb +10 -3
  26. data/lib/epubmaker/epubv2.rb +11 -3
  27. data/lib/epubmaker/epubv3.rb +11 -3
  28. data/lib/epubmaker/producer.rb +55 -20
  29. data/lib/review/book/base.rb +63 -48
  30. data/lib/review/book/chapter.rb +19 -7
  31. data/lib/review/book/compilable.rb +5 -20
  32. data/lib/review/book/image_finder.rb +10 -3
  33. data/lib/review/book/index.rb +30 -9
  34. data/lib/review/book/part.rb +9 -6
  35. data/lib/review/book.rb +0 -14
  36. data/lib/review/builder.rb +110 -18
  37. data/lib/review/catalog.rb +24 -4
  38. data/lib/review/compiler.rb +3 -1
  39. data/lib/review/configure.rb +43 -9
  40. data/lib/review/epubmaker/reviewheaderlistener.rb +57 -0
  41. data/lib/review/epubmaker.rb +129 -85
  42. data/lib/review/htmlbuilder.rb +76 -58
  43. data/lib/review/htmlutils.rb +20 -13
  44. data/lib/review/i18n.rb +6 -2
  45. data/lib/review/idgxmlbuilder.rb +52 -41
  46. data/lib/review/init.rb +194 -0
  47. data/lib/review/latexbuilder.rb +118 -34
  48. data/lib/review/latexutils.rb +5 -5
  49. data/lib/review/logger.rb +2 -1
  50. data/lib/review/makerhelper.rb +1 -1
  51. data/lib/review/markdownbuilder.rb +66 -6
  52. data/lib/review/md2inaobuilder.rb +2 -2
  53. data/lib/review/pdfmaker.rb +74 -22
  54. data/lib/review/plaintextbuilder.rb +8 -4
  55. data/lib/review/preprocessor.rb +14 -17
  56. data/lib/review/sec_counter.rb +8 -2
  57. data/lib/review/textmaker.rb +2 -2
  58. data/lib/review/textutils.rb +9 -2
  59. data/lib/review/tocparser.rb +7 -4
  60. data/lib/review/tocprinter.rb +3 -1
  61. data/lib/review/version.rb +1 -1
  62. data/lib/review/webmaker.rb +19 -7
  63. data/lib/review/webtocprinter.rb +8 -4
  64. data/review.gemspec +4 -3
  65. data/templates/latex/config.erb +84 -0
  66. data/templates/latex/layout.tex.erb +76 -361
  67. data/templates/latex/review-jlreq/README.md +22 -0
  68. data/templates/latex/review-jlreq/review-base.sty +178 -0
  69. data/templates/latex/review-jlreq/review-custom.sty +1 -0
  70. data/templates/latex/review-jlreq/review-jlreq.cls +141 -0
  71. data/templates/latex/review-jlreq/review-style.sty +149 -0
  72. data/templates/latex/review-jlreq/reviewmacro.sty +8 -0
  73. data/templates/latex/review-jsbook/jumoline.sty +310 -0
  74. data/templates/latex/review-jsbook/plistings.sty +326 -0
  75. data/templates/latex/review-jsbook/review-base.sty +405 -0
  76. data/templates/latex/review-jsbook/review-custom.sty +1 -0
  77. data/templates/latex/review-jsbook/review-style.sty +38 -0
  78. data/templates/latex/review-jsbook/reviewmacro.sty +8 -0
  79. data/templates/latex-compat2/layout.tex.erb +387 -0
  80. data/test/assets/test_template.tex +105 -235
  81. data/test/assets/test_template_backmatter.tex +133 -14
  82. data/test/book_test_helper.rb +1 -1
  83. data/test/run_test.rb +2 -0
  84. data/test/sample-book/src/Rakefile +11 -6
  85. data/test/sample-book/src/config.yml +2 -2
  86. data/test/sample-book/src/sty/reviewmacro.sty +1 -39
  87. data/test/sample-book/src/style.css +6 -0
  88. data/test/syntax-book/config.yml +1 -1
  89. data/test/test_book.rb +13 -16
  90. data/test/test_book_chapter.rb +4 -10
  91. data/test/test_book_part.rb +4 -3
  92. data/test/test_catalog.rb +15 -4
  93. data/test/test_helper.rb +2 -2
  94. data/test/test_htmlbuilder.rb +78 -10
  95. data/test/test_htmlutils.rb +12 -5
  96. data/test/test_idgxmlbuilder.rb +1 -1
  97. data/test/test_latexbuilder.rb +94 -49
  98. data/test/test_latexbuilder_v2.rb +1077 -0
  99. data/test/test_logger.rb +20 -0
  100. data/test/test_markdownbuilder.rb +10 -0
  101. data/test/test_pdfmaker.rb +6 -7
  102. data/test/test_plaintextbuilder.rb +1 -1
  103. data/test/test_review_ext.rb +0 -1
  104. data/test/test_rstbuilder.rb +1 -1
  105. data/test/test_topbuilder.rb +19 -7
  106. data/test/test_webtocprinter.rb +14 -14
  107. data/{test/sample-book/src/vendor → vendor}/jumoline/README +0 -0
  108. data/{test/sample-book/src/vendor → vendor}/jumoline/jumoline.dtx +0 -0
  109. data/{test/sample-book/src/vendor → vendor}/jumoline/jumoline.ins +0 -0
  110. data/{test/sample-book/src/vendor → vendor}/jumoline/lppl.txt +0 -0
  111. data/vendor/plistings/.gitignore +9 -0
  112. data/vendor/plistings/LICENSE +21 -0
  113. data/vendor/plistings/README.md +18 -0
  114. data/vendor/plistings/plistings.sty +326 -0
  115. data/vendor/plistings/test1.tex +174 -0
  116. data/vendor/plistings/test2.tex +54 -0
  117. metadata +48 -19
  118. data/lib/review/unfold.rb +0 -129
  119. data/test/CHAPS +0 -2
  120. data/test/bib.re +0 -13
  121. data/test/test.re +0 -43
@@ -15,9 +15,10 @@ class LATEXBuidlerTest < Test::Unit::TestCase
15
15
  'toclevel' => 2,
16
16
  'stylesheet' => nil, # for EPUBBuilder
17
17
  'image_scale2width' => false,
18
- 'texcommand' => 'uplatex'
18
+ 'texcommand' => 'uplatex',
19
+ 'review_version' => '3'
19
20
  )
20
- @book = Book::Base.new(nil)
21
+ @book = Book::Base.new
21
22
  @book.config = @config
22
23
  @compiler = ReVIEW::Compiler.new(@builder)
23
24
  @chapter = Book::Chapter.new(@book, 1, 'chap1', nil, StringIO.new)
@@ -26,6 +27,16 @@ class LATEXBuidlerTest < Test::Unit::TestCase
26
27
  I18n.setup('ja')
27
28
  end
28
29
 
30
+ def test_escape
31
+ actual = @builder.escape('<>&_')
32
+ assert_equal %Q(\\textless{}\\textgreater{}\\&\\textunderscore{}), actual
33
+ end
34
+
35
+ def test_unescape
36
+ actual = @builder.unescape(%Q(\\textless{}\\textgreater{}\\&\\textunderscore{}))
37
+ assert_equal '<>&_', actual
38
+ end
39
+
29
40
  def test_headline_level1
30
41
  actual = compile_block("={test} this is test.\n")
31
42
  assert_equal %Q(\\chapter{this is test.}\n\\label{chap:chap1}\n), actual
@@ -39,7 +50,7 @@ class LATEXBuidlerTest < Test::Unit::TestCase
39
50
 
40
51
  def test_headline_level1_with_inlinetag
41
52
  actual = compile_block(%Q(={test} this @<b>{is} test.<&"_>\n))
42
- assert_equal %Q(\\chapter{this \\textbf{is} test.\\textless{}\\&"\\textunderscore{}\\textgreater{}}\n\\label{chap:chap1}\n), actual
53
+ assert_equal %Q(\\chapter{this \\reviewbold{is} test.\\textless{}\\&"\\textunderscore{}\\textgreater{}}\n\\label{chap:chap1}\n), actual
43
54
  end
44
55
 
45
56
  def test_headline_level2
@@ -100,12 +111,12 @@ class LATEXBuidlerTest < Test::Unit::TestCase
100
111
 
101
112
  def test_inline_i
102
113
  actual = compile_inline('abc@<i>{def}ghi')
103
- assert_equal 'abc\\textit{def}ghi', actual
114
+ assert_equal 'abc\\reviewit{def}ghi', actual
104
115
  end
105
116
 
106
117
  def test_inline_i_and_escape
107
118
  actual = compile_inline('test @<i>{inline<&;\\ test} test2')
108
- assert_equal 'test \\textit{inline\\textless{}\\&;\\reviewbackslash{} test} test2', actual
119
+ assert_equal 'test \\reviewit{inline\\textless{}\\&;\\reviewbackslash{} test} test2', actual
109
120
  end
110
121
 
111
122
  def test_inline_dtp
@@ -115,7 +126,7 @@ class LATEXBuidlerTest < Test::Unit::TestCase
115
126
 
116
127
  def test_inline_code
117
128
  actual = compile_inline('abc@<code>{def}ghi')
118
- assert_equal 'abc\\texttt{def}ghi', actual
129
+ assert_equal 'abc\\reviewcode{def}ghi', actual
119
130
  end
120
131
 
121
132
  def test_inline_raw
@@ -135,12 +146,12 @@ class LATEXBuidlerTest < Test::Unit::TestCase
135
146
 
136
147
  def test_inline_b
137
148
  actual = compile_inline('abc@<b>{def}')
138
- assert_equal 'abc\\textbf{def}', actual
149
+ assert_equal 'abc\\reviewbold{def}', actual
139
150
  end
140
151
 
141
152
  def test_inline_b_and_escape
142
153
  actual = compile_inline('test @<b>{inline<&;\\ test} test2')
143
- assert_equal 'test \\textbf{inline\\textless{}\\&;\\reviewbackslash{} test} test2', actual
154
+ assert_equal 'test \\reviewbold{inline\\textless{}\\&;\\reviewbackslash{} test} test2', actual
144
155
  end
145
156
 
146
157
  def test_inline_em
@@ -159,35 +170,46 @@ class LATEXBuidlerTest < Test::Unit::TestCase
159
170
  end
160
171
 
161
172
  def test_inline_m
173
+ @config['review_version'] = '3.0'
174
+ actual = compile_inline('abc@<m>{\\alpha^n = \\inf < 2}ghi')
175
+ assert_equal 'abc$\\alpha^n = \\inf < 2$ghi', actual
176
+
177
+ @config['review_version'] = '2.0'
162
178
  actual = compile_inline('abc@<m>{\\alpha^n = \\inf < 2}ghi')
163
179
  assert_equal 'abc $\\alpha^n = \\inf < 2$ ghi', actual
164
180
  end
165
181
 
166
182
  def test_inline_m2
183
+ @config['review_version'] = '3.0'
167
184
  ## target text: @<m>{X = \{ {x_1\},{x_2\}, \cdots ,{x_n\} \\\}}
168
185
  actual = compile_inline('@<m>{X = \\{ {x_1\\},{x_2\\}, \\cdots ,{x_n\\} \\\\\\}}')
169
186
  ## expected text: $X = \{ {x_1},{x_2}, \cdots ,{x_n} \}$
187
+ assert_equal '$X = \\{ {x_1},{x_2}, \\cdots ,{x_n} \\}$', actual
188
+
189
+ @config['review_version'] = '2.0'
190
+ actual = compile_inline('@<m>{X = \\{ {x_1\\},{x_2\\}, \\cdots ,{x_n\\} \\\\\\}}')
191
+ ## expected text: $X = \{ {x_1},{x_2}, \cdots ,{x_n} \}$
170
192
  assert_equal ' $X = \\{ {x_1},{x_2}, \\cdots ,{x_n} \\}$ ', actual
171
193
  end
172
194
 
173
195
  def test_inline_tt
174
196
  actual = compile_inline('test @<tt>{inline test} test2')
175
- assert_equal 'test \\texttt{inline test} test2', actual
197
+ assert_equal 'test \\reviewtt{inline test} test2', actual
176
198
  end
177
199
 
178
200
  def test_inline_tt_endash
179
201
  actual = compile_inline('test @<tt>{in-line --test ---foo ----bar -----buz} --test2')
180
- assert_equal 'test \\texttt{in{-}line {-}{-}test {-}{-}{-}foo {-}{-}{-}{-}bar {-}{-}{-}{-}{-}buz} {-}{-}test2', actual
202
+ assert_equal 'test \\reviewtt{in{-}line {-}{-}test {-}{-}{-}foo {-}{-}{-}{-}bar {-}{-}{-}{-}{-}buz} {-}{-}test2', actual
181
203
  end
182
204
 
183
205
  def test_inline_tti
184
206
  actual = compile_inline('test @<tti>{inline test} test2')
185
- assert_equal 'test \\texttt{\\textit{inline test}} test2', actual
207
+ assert_equal 'test \\reviewtti{inline test} test2', actual
186
208
  end
187
209
 
188
210
  def test_inline_ttb
189
211
  actual = compile_inline('test @<ttb>{inline test} test2')
190
- assert_equal 'test \\texttt{\\textbf{inline test}} test2', actual
212
+ assert_equal 'test \\reviewttb{inline test} test2', actual
191
213
  end
192
214
 
193
215
  def test_inline_hd_chap
@@ -213,7 +235,12 @@ class LATEXBuidlerTest < Test::Unit::TestCase
213
235
 
214
236
  def test_inline_uchar
215
237
  actual = compile_inline('test @<uchar>{2460} test2')
216
- assert_equal 'test \\UTF{2460} test2', actual
238
+ assert_equal 'test test2', actual
239
+ end
240
+
241
+ def test_inline_balloon
242
+ actual = compile_inline('test @<balloon>{①}')
243
+ assert_equal 'test \\reviewballoon{①}', actual
217
244
  end
218
245
 
219
246
  def test_inline_idx
@@ -263,31 +290,31 @@ class LATEXBuidlerTest < Test::Unit::TestCase
263
290
 
264
291
  def test_cmd
265
292
  actual = compile_block("//cmd{\nfoo\nbar\n\nbuz\n//}\n")
266
- assert_equal %Q(\n\\begin{reviewcmd}\nfoo\nbar\n\nbuz\n\\end{reviewcmd}\n), actual
293
+ assert_equal %Q(\n\\begin{reviewlistblock}\n\\begin{reviewcmd}\nfoo\nbar\n\nbuz\n\\end{reviewcmd}\n\\end{reviewlistblock}\n), actual
267
294
  end
268
295
 
269
296
  def test_cmd_caption
270
297
  actual = compile_block("//cmd[cap1]{\nfoo\nbar\n\nbuz\n//}\n")
271
- assert_equal %Q(\n\\reviewcmdcaption{cap1}\n\\begin{reviewcmd}\nfoo\nbar\n\nbuz\n\\end{reviewcmd}\n), actual
298
+ assert_equal %Q(\n\\begin{reviewlistblock}\n\\reviewcmdcaption{cap1}\n\\begin{reviewcmd}\nfoo\nbar\n\nbuz\n\\end{reviewcmd}\n\\end{reviewlistblock}\n), actual
272
299
  end
273
300
 
274
301
  def test_cmd_lst
275
302
  @book.config['highlight'] = {}
276
303
  @book.config['highlight']['latex'] = 'listings'
277
304
  actual = compile_block("//cmd{\nfoo\nbar\n\nbuz\n//}\n")
278
- assert_equal %Q(\\vspace{-1.5em}\\begin{reviewcmdlst}[title={\\relax},language={}]\nfoo\nbar\n\nbuz\n\\end{reviewcmdlst}\n), actual
305
+ assert_equal %Q(\\begin{reviewcmdlst}[language={}]\nfoo\nbar\n\nbuz\n\\end{reviewcmdlst}\n), actual
279
306
  end
280
307
 
281
308
  def test_emlist
282
309
  actual = compile_block("//emlist{\nfoo\nbar\n\nbuz\n//}\n")
283
- assert_equal %Q(\n\\begin{reviewemlist}\nfoo\nbar\n\nbuz\n\\end{reviewemlist}\n), actual
310
+ assert_equal %Q(\n\\begin{reviewlistblock}\n\\begin{reviewemlist}\nfoo\nbar\n\nbuz\n\\end{reviewemlist}\n\\end{reviewlistblock}\n), actual
284
311
  end
285
312
 
286
313
  def test_emlist_lst
287
314
  @book.config['highlight'] = {}
288
315
  @book.config['highlight']['latex'] = 'listings'
289
316
  actual = compile_block("//emlist[][sql]{\nSELECT COUNT(*) FROM tests WHERE tests.no > 10 AND test.name LIKE 'ABC%'\n//}\n")
290
- assert_equal %Q(\n\\vspace{-1.5em}\\begin{reviewemlistlst}[title={\\relax},language={sql}]\nSELECT COUNT(*) FROM tests WHERE tests.no > 10 AND test.name LIKE 'ABC%'\n\\end{reviewemlistlst}\n), actual
317
+ assert_equal %Q(\n\\begin{reviewemlistlst}[language={sql}]\nSELECT COUNT(*) FROM tests WHERE tests.no > 10 AND test.name LIKE 'ABC%'\n\\end{reviewemlistlst}\n), actual
291
318
  end
292
319
 
293
320
  def test_emlist_lst_without_lang
@@ -295,38 +322,38 @@ class LATEXBuidlerTest < Test::Unit::TestCase
295
322
  @book.config['highlight']['latex'] = 'listings'
296
323
  @book.config['highlight']['lang'] = 'sql'
297
324
  actual = compile_block("//emlist[]{\nSELECT COUNT(*) FROM tests WHERE tests.no > 10 AND test.name LIKE 'ABC%'\n//}\n")
298
- assert_equal %Q(\n\\vspace{-1.5em}\\begin{reviewemlistlst}[title={\\relax},language={sql}]\nSELECT COUNT(*) FROM tests WHERE tests.no > 10 AND test.name LIKE 'ABC%'\n\\end{reviewemlistlst}\n), actual
325
+ assert_equal %Q(\n\\begin{reviewemlistlst}[language={sql}]\nSELECT COUNT(*) FROM tests WHERE tests.no > 10 AND test.name LIKE 'ABC%'\n\\end{reviewemlistlst}\n), actual
299
326
  end
300
327
 
301
328
  def test_emlist_caption
302
329
  actual = compile_block("//emlist[cap1]{\nfoo\nbar\n\nbuz\n//}\n")
303
- assert_equal %Q(\n\\reviewemlistcaption{cap1}\n\\begin{reviewemlist}\nfoo\nbar\n\nbuz\n\\end{reviewemlist}\n), actual
330
+ assert_equal %Q(\n\\begin{reviewlistblock}\n\\reviewemlistcaption{cap1}\n\\begin{reviewemlist}\nfoo\nbar\n\nbuz\n\\end{reviewemlist}\n\\end{reviewlistblock}\n), actual
304
331
  end
305
332
 
306
333
  def test_emlist_empty_caption
307
334
  actual = compile_block("//emlist[]{\nfoo\nbar\n\nbuz\n//}\n")
308
- assert_equal %Q(\n\\begin{reviewemlist}\nfoo\nbar\n\nbuz\n\\end{reviewemlist}\n), actual
335
+ assert_equal %Q(\n\\begin{reviewlistblock}\n\\begin{reviewemlist}\nfoo\nbar\n\nbuz\n\\end{reviewemlist}\n\\end{reviewlistblock}\n), actual
309
336
  end
310
337
 
311
338
  def test_emlist_with_tab
312
339
  actual = compile_block("//emlist{\n\tfoo\n\t\tbar\n\n\tbuz\n//}\n")
313
- assert_equal %Q(\n\\begin{reviewemlist}\n foo\n bar\n\n buz\n\\end{reviewemlist}\n), actual
340
+ assert_equal %Q(\n\\begin{reviewlistblock}\n\\begin{reviewemlist}\n foo\n bar\n\n buz\n\\end{reviewemlist}\n\\end{reviewlistblock}\n), actual
314
341
  end
315
342
 
316
343
  def test_emlist_with_tab4
317
344
  @config['tabwidth'] = 4
318
345
  actual = compile_block("//emlist{\n\tfoo\n\t\tbar\n\n\tbuz\n//}\n")
319
- assert_equal %Q(\n\\begin{reviewemlist}\n foo\n bar\n\n buz\n\\end{reviewemlist}\n), actual
346
+ assert_equal %Q(\n\\begin{reviewlistblock}\n\\begin{reviewemlist}\n foo\n bar\n\n buz\n\\end{reviewemlist}\n\\end{reviewlistblock}\n), actual
320
347
  end
321
348
 
322
349
  def test_emlistnum_caption
323
350
  actual = compile_block("//emlistnum[cap1]{\nfoo\nbar\n\nbuz\n//}\n")
324
- assert_equal %Q(\n\\reviewemlistcaption{cap1}\n\\begin{reviewemlist}\n 1: foo\n 2: bar\n 3: \n 4: buz\n\\end{reviewemlist}\n), actual
351
+ assert_equal %Q(\n\\begin{reviewlistblock}\n\\reviewemlistcaption{cap1}\n\\begin{reviewemlist}\n 1: foo\n 2: bar\n 3: \n 4: buz\n\\end{reviewemlist}\n\\end{reviewlistblock}\n), actual
325
352
  end
326
353
 
327
354
  def test_list
328
355
  actual = compile_block("//list[id1][cap1]{\nfoo\nbar\n\nbuz\n//}\n")
329
- assert_equal %Q(\\reviewlistcaption{リスト1.1: cap1}\n\\begin{reviewlist}\nfoo\nbar\n\nbuz\n\\end{reviewlist}\n), actual
356
+ assert_equal %Q(\\begin{reviewlistblock}\n\\reviewlistcaption{リスト1.1: cap1}\n\\begin{reviewlist}\nfoo\nbar\n\nbuz\n\\end{reviewlist}\n\\end{reviewlistblock}\n), actual
330
357
  end
331
358
 
332
359
  def test_list_lst
@@ -346,12 +373,12 @@ class LATEXBuidlerTest < Test::Unit::TestCase
346
373
 
347
374
  def test_listnum
348
375
  actual = compile_block("//listnum[test1][ruby]{\nclass Foo\n def foo\n bar\n\n buz\n end\nend\n//}\n")
349
- assert_equal %Q(\\reviewlistcaption{リスト1.1: ruby}\n\\begin{reviewlist}\n 1: class Foo\n 2: def foo\n 3: bar\n 4: \n 5: buz\n 6: end\n 7: end\n\\end{reviewlist}\n), actual
376
+ assert_equal %Q(\\begin{reviewlistblock}\n\\reviewlistcaption{リスト1.1: ruby}\n\\begin{reviewlist}\n 1: class Foo\n 2: def foo\n 3: bar\n 4: \n 5: buz\n 6: end\n 7: end\n\\end{reviewlist}\n\\end{reviewlistblock}\n), actual
350
377
  end
351
378
 
352
379
  def test_listnum_linenum
353
380
  actual = compile_block("//firstlinenum[100]\n//listnum[test1][ruby]{\nclass Foo\n def foo\n bar\n\n buz\n end\nend\n//}\n")
354
- assert_equal %Q(\\reviewlistcaption{リスト1.1: ruby}\n\\begin{reviewlist}\n100: class Foo\n101: def foo\n102: bar\n103: \n104: buz\n105: end\n106: end\n\\end{reviewlist}\n), actual
381
+ assert_equal %Q(\\begin{reviewlistblock}\n\\reviewlistcaption{リスト1.1: ruby}\n\\begin{reviewlist}\n100: class Foo\n101: def foo\n102: bar\n103: \n104: buz\n105: end\n106: end\n\\end{reviewlist}\n\\end{reviewlistblock}\n), actual
355
382
  end
356
383
 
357
384
  def test_listnum_lst
@@ -370,12 +397,12 @@ class LATEXBuidlerTest < Test::Unit::TestCase
370
397
 
371
398
  def test_source
372
399
  actual = compile_block("//source[foo/bar/test.rb]{\nfoo\nbar\n\nbuz\n//}\n")
373
- assert_equal %Q(\\reviewsourcecaption{foo/bar/test.rb}\n\\begin{reviewsource}\nfoo\nbar\n\nbuz\n\\end{reviewsource}\n), actual
400
+ assert_equal %Q(\\begin{reviewlistblock}\n\\reviewsourcecaption{foo/bar/test.rb}\n\\begin{reviewsource}\nfoo\nbar\n\nbuz\n\\end{reviewsource}\n\\end{reviewlistblock}\n), actual
374
401
  end
375
402
 
376
403
  def test_source_empty_caption
377
404
  actual = compile_block("//source[]{\nfoo\nbar\n\nbuz\n//}\n")
378
- assert_equal %Q(\\begin{reviewsource}\nfoo\nbar\n\nbuz\n\\end{reviewsource}\n), actual
405
+ assert_equal %Q(\\begin{reviewlistblock}\n\\begin{reviewsource}\nfoo\nbar\n\nbuz\n\\end{reviewsource}\n\\end{reviewlistblock}\n), actual
379
406
  end
380
407
 
381
408
  def test_source_lst
@@ -392,7 +419,7 @@ class LATEXBuidlerTest < Test::Unit::TestCase
392
419
 
393
420
  def test_memo
394
421
  actual = compile_block("//memo[this is @<b>{test}<&>_]{\ntest1\n\ntest@<i>{2}\n//}\n")
395
- assert_equal %Q(\\begin{reviewminicolumn}\n\\reviewminicolumntitle{this is \\textbf{test}\\textless{}\\&\\textgreater{}\\textunderscore{}}\ntest1\n\ntest\\textit{2}\n\\end{reviewminicolumn}\n), actual
422
+ assert_equal %Q(\\begin{reviewmemo}[this is \\reviewbold{test}\\textless{}\\&\\textgreater{}\\textunderscore{}]\ntest1\n\ntest\\reviewit{2}\n\\end{reviewmemo}\n), actual
396
423
  end
397
424
 
398
425
  def test_flushright
@@ -605,7 +632,7 @@ EOS
605
632
  end
606
633
 
607
634
  actual = compile_block("//bibpaper[samplebib][sample bib @<b>{bold}]{\na\nb\n//}\n")
608
- assert_equal %Q([1] sample bib \\textbf{bold}\n\\label{bib:samplebib}\n\nab\n\n), actual
635
+ assert_equal %Q([1] sample bib \\reviewbold{bold}\n\\label{bib:samplebib}\n\nab\n\n), actual
609
636
  end
610
637
 
611
638
  def test_bibpaper_without_body
@@ -635,18 +662,14 @@ inside column
635
662
  EOS
636
663
  expected = <<-EOS
637
664
 
638
- \\begin{reviewcolumn}
639
- \\hypertarget{column:chap1:1}{}
640
- \\reviewcolumnhead{}{prev column}
665
+ \\begin{reviewcolumn}[prev column\\hypertarget{column:chap1:1}{}]
641
666
  \\addcontentsline{toc}{subsection}{prev column}
642
667
 
643
668
  inside prev column
644
669
 
645
670
  \\end{reviewcolumn}
646
671
 
647
- \\begin{reviewcolumn}
648
- \\hypertarget{column:chap1:2}{}
649
- \\reviewcolumnhead{}{test}
672
+ \\begin{reviewcolumn}[test\\hypertarget{column:chap1:2}{}]
650
673
  \\addcontentsline{toc}{subsection}{test}
651
674
 
652
675
  inside column
@@ -667,9 +690,7 @@ inside column
667
690
  EOS
668
691
  expected = <<-EOS
669
692
 
670
- \\begin{reviewcolumn}
671
- \\hypertarget{column:chap1:1}{}
672
- \\reviewcolumnhead{}{test}
693
+ \\begin{reviewcolumn}[test\\hypertarget{column:chap1:1}{}]
673
694
 
674
695
  inside column
675
696
 
@@ -831,35 +852,35 @@ EOS
831
852
 
832
853
  def test_major_blocks
833
854
  actual = compile_block("//note{\nA\n\nB\n//}\n//note[caption]{\nA\n//}")
834
- expected = %Q(\\begin{reviewminicolumn}\nA\n\nB\n\\end{reviewminicolumn}\n\\begin{reviewminicolumn}\n\\reviewminicolumntitle{caption}\nA\n\\end{reviewminicolumn}\n)
855
+ expected = %Q(\\begin{reviewnote}\nA\n\nB\n\\end{reviewnote}\n\\begin{reviewnote}[caption]\nA\n\\end{reviewnote}\n)
835
856
  assert_equal expected, actual
836
857
 
837
858
  actual = compile_block("//memo{\nA\n\nB\n//}\n//memo[caption]{\nA\n//}")
838
- expected = %Q(\\begin{reviewminicolumn}\nA\n\nB\n\\end{reviewminicolumn}\n\\begin{reviewminicolumn}\n\\reviewminicolumntitle{caption}\nA\n\\end{reviewminicolumn}\n)
859
+ expected = %Q(\\begin{reviewmemo}\nA\n\nB\n\\end{reviewmemo}\n\\begin{reviewmemo}[caption]\nA\n\\end{reviewmemo}\n)
839
860
  assert_equal expected, actual
840
861
 
841
862
  actual = compile_block("//info{\nA\n\nB\n//}\n//info[caption]{\nA\n//}")
842
- expected = %Q(\\begin{reviewminicolumn}\nA\n\nB\n\\end{reviewminicolumn}\n\\begin{reviewminicolumn}\n\\reviewminicolumntitle{caption}\nA\n\\end{reviewminicolumn}\n)
863
+ expected = %Q(\\begin{reviewinfo}\nA\n\nB\n\\end{reviewinfo}\n\\begin{reviewinfo}[caption]\nA\n\\end{reviewinfo}\n)
843
864
  assert_equal expected, actual
844
865
 
845
866
  actual = compile_block("//important{\nA\n\nB\n//}\n//important[caption]{\nA\n//}")
846
- expected = %Q(\\begin{reviewminicolumn}\nA\n\nB\n\\end{reviewminicolumn}\n\\begin{reviewminicolumn}\n\\reviewminicolumntitle{caption}\nA\n\\end{reviewminicolumn}\n)
867
+ expected = %Q(\\begin{reviewimportant}\nA\n\nB\n\\end{reviewimportant}\n\\begin{reviewimportant}[caption]\nA\n\\end{reviewimportant}\n)
847
868
  assert_equal expected, actual
848
869
 
849
870
  actual = compile_block("//caution{\nA\n\nB\n//}\n//caution[caption]{\nA\n//}")
850
- expected = %Q(\\begin{reviewminicolumn}\nA\n\nB\n\\end{reviewminicolumn}\n\\begin{reviewminicolumn}\n\\reviewminicolumntitle{caption}\nA\n\\end{reviewminicolumn}\n)
871
+ expected = %Q(\\begin{reviewcaution}\nA\n\nB\n\\end{reviewcaution}\n\\begin{reviewcaution}[caption]\nA\n\\end{reviewcaution}\n)
851
872
  assert_equal expected, actual
852
873
 
853
874
  actual = compile_block("//notice{\nA\n\nB\n//}\n//notice[caption]{\nA\n//}")
854
- expected = %Q(\\begin{reviewminicolumn}\nA\n\nB\n\\end{reviewminicolumn}\n\\begin{reviewminicolumn}\n\\reviewminicolumntitle{caption}\nA\n\\end{reviewminicolumn}\n)
875
+ expected = %Q(\\begin{reviewnotice}\nA\n\nB\n\\end{reviewnotice}\n\\begin{reviewnotice}[caption]\nA\n\\end{reviewnotice}\n)
855
876
  assert_equal expected, actual
856
877
 
857
878
  actual = compile_block("//warning{\nA\n\nB\n//}\n//warning[caption]{\nA\n//}")
858
- expected = %Q(\\begin{reviewminicolumn}\nA\n\nB\n\\end{reviewminicolumn}\n\\begin{reviewminicolumn}\n\\reviewminicolumntitle{caption}\nA\n\\end{reviewminicolumn}\n)
879
+ expected = %Q(\\begin{reviewwarning}\nA\n\nB\n\\end{reviewwarning}\n\\begin{reviewwarning}[caption]\nA\n\\end{reviewwarning}\n)
859
880
  assert_equal expected, actual
860
881
 
861
882
  actual = compile_block("//tip{\nA\n\nB\n//}\n//tip[caption]{\nA\n//}")
862
- expected = %Q(\\begin{reviewminicolumn}\nA\n\nB\n\\end{reviewminicolumn}\n\\begin{reviewminicolumn}\n\\reviewminicolumntitle{caption}\nA\n\\end{reviewminicolumn}\n)
883
+ expected = %Q(\\begin{reviewtip}\nA\n\nB\n\\end{reviewtip}\n\\begin{reviewtip}[caption]\nA\n\\end{reviewtip}\n)
863
884
  assert_equal expected, actual
864
885
  end
865
886
 
@@ -970,7 +991,29 @@ EOS
970
991
 
971
992
  def test_inline_fence
972
993
  actual = compile_inline('test @<code>|@<code>{$サンプル$}|')
973
- assert_equal 'test \\texttt{@\\textless{}code\\textgreater{}\\{\\textdollar{}サンプル\\textdollar{}\\}}', actual
994
+ assert_equal 'test \\reviewcode{@\\textless{}code\\textgreater{}\\{\\textdollar{}サンプル\\textdollar{}\\}}', actual
995
+ end
996
+
997
+ def test_inline_w
998
+ Dir.mktmpdir do |dir|
999
+ File.open(File.join(dir, 'words.csv'), 'w') do |f|
1000
+ f.write <<EOB
1001
+ "F","foo"
1002
+ "B","bar""\\<>_@<b>{BAZ}"
1003
+ EOB
1004
+ end
1005
+ @book.config['words_file'] = File.join(dir, 'words.csv')
1006
+
1007
+ io = StringIO.new
1008
+ @builder.instance_eval{ @logger = ReVIEW::Logger.new(io) }
1009
+ actual = compile_block('@<w>{F} @<w>{B} @<wb>{B} @<w>{N}')
1010
+ expected = <<-EOS
1011
+
1012
+ foo bar"\\reviewbackslash{}\\textless{}\\textgreater{}\\textunderscore{}@\\textless{}b\\textgreater{}\\{BAZ\\} \\reviewbold{bar"\\reviewbackslash{}\\textless{}\\textgreater{}\\textunderscore{}@\\textless{}b\\textgreater{}\\{BAZ\\}} [missing word: N]
1013
+ EOS
1014
+ assert_equal expected, actual
1015
+ assert_match(/WARN -- : :1: word not bound: N/, io.string)
1016
+ end
974
1017
  end
975
1018
 
976
1019
  def test_inline_unknown
@@ -1005,9 +1048,11 @@ EOS
1005
1048
 
1006
1049
  \\reviewlistref{A.1}
1007
1050
 
1051
+ \\begin{reviewlistblock}
1008
1052
  \\reviewlistcaption{リストA.1: FOO}
1009
1053
  \\begin{reviewlist}
1010
1054
  \\end{reviewlist}
1055
+ \\end{reviewlistblock}
1011
1056
  EOS
1012
1057
  actual = compile_block(src)
1013
1058
  assert_equal expected, actual