review 3.1.0 → 5.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (225) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby-win.yml +45 -0
  3. data/.github/workflows/ruby.yml +27 -0
  4. data/.rubocop.yml +161 -34
  5. data/.travis.yml +16 -15
  6. data/Dockerfile +21 -5
  7. data/NEWS.ja.md +394 -0
  8. data/NEWS.md +395 -1
  9. data/README.md +10 -7
  10. data/appveyor.yml +1 -3
  11. data/bin/review-catalog-converter +5 -5
  12. data/bin/review-check +10 -12
  13. data/bin/review-checkdep +2 -2
  14. data/bin/review-compile +17 -23
  15. data/bin/review-epubmaker +3 -35
  16. data/bin/review-idgxmlmaker +16 -0
  17. data/bin/review-index +2 -89
  18. data/bin/review-preproc +13 -13
  19. data/bin/review-validate +4 -4
  20. data/bin/review-vol +4 -78
  21. data/doc/config.yml.sample +47 -12
  22. data/doc/config.yml.sample-simple +3 -2
  23. data/doc/format.ja.md +120 -17
  24. data/doc/format.md +119 -27
  25. data/doc/makeindex.ja.md +2 -2
  26. data/doc/pdfmaker.ja.md +43 -1
  27. data/doc/pdfmaker.md +42 -1
  28. data/doc/quickstart.ja.md +45 -25
  29. data/doc/quickstart.md +37 -16
  30. data/lib/epubmaker/content.rb +3 -2
  31. data/lib/epubmaker/epubcommon.rb +34 -27
  32. data/lib/epubmaker/epubv2.rb +5 -6
  33. data/lib/epubmaker/epubv3.rb +21 -18
  34. data/lib/epubmaker/producer.rb +2 -1
  35. data/lib/review/book.rb +2 -2
  36. data/lib/review/book/base.rb +91 -96
  37. data/lib/review/book/bib.rb +21 -0
  38. data/lib/review/book/book_unit.rb +155 -0
  39. data/lib/review/book/chapter.rb +48 -29
  40. data/lib/review/book/index.rb +46 -240
  41. data/lib/review/book/index/item.rb +46 -0
  42. data/lib/review/book/page_metric.rb +7 -7
  43. data/lib/review/book/part.rb +45 -10
  44. data/lib/review/book/volume.rb +4 -5
  45. data/lib/review/builder.rb +172 -56
  46. data/lib/review/catalog.rb +14 -17
  47. data/lib/review/compiler.rb +219 -121
  48. data/lib/review/configure.rb +39 -7
  49. data/lib/review/converter.rb +1 -1
  50. data/lib/review/epub2html.rb +43 -5
  51. data/lib/review/epubmaker.rb +69 -27
  52. data/lib/review/extentions/string.rb +0 -4
  53. data/lib/review/htmlbuilder.rb +112 -101
  54. data/lib/review/htmlutils.rb +9 -13
  55. data/lib/review/i18n.rb +3 -3
  56. data/lib/review/idgxmlbuilder.rb +202 -78
  57. data/lib/review/idgxmlmaker.rb +186 -0
  58. data/lib/review/index_builder.rb +653 -0
  59. data/lib/review/init-web/finish.html +10 -0
  60. data/lib/review/init-web/index.html +190 -0
  61. data/lib/review/init-web/review-layout-design.js +691 -0
  62. data/lib/review/init.rb +129 -46
  63. data/lib/review/latexbuilder.rb +255 -92
  64. data/lib/review/lineinput.rb +1 -1
  65. data/lib/review/location.rb +32 -0
  66. data/lib/review/logger.rb +4 -8
  67. data/lib/review/makerhelper.rb +35 -5
  68. data/lib/review/markdownbuilder.rb +50 -38
  69. data/lib/review/md2inaobuilder.rb +3 -5
  70. data/lib/review/pdfmaker.rb +60 -57
  71. data/lib/review/plaintextbuilder.rb +154 -87
  72. data/lib/review/preprocessor.rb +20 -42
  73. data/lib/review/rstbuilder.rb +57 -38
  74. data/lib/review/sec_counter.rb +13 -0
  75. data/lib/review/textmaker.rb +23 -15
  76. data/lib/review/textutils.rb +76 -2
  77. data/lib/review/tocprinter.rb +230 -102
  78. data/lib/review/topbuilder.rb +139 -60
  79. data/lib/review/update.rb +24 -24
  80. data/lib/review/version.rb +1 -1
  81. data/lib/review/volumeprinter.rb +98 -0
  82. data/lib/review/webmaker.rb +20 -24
  83. data/lib/review/webtocprinter.rb +38 -35
  84. data/lib/review/yamlloader.rb +26 -16
  85. data/review.gemspec +6 -4
  86. data/samples/sample-book/README.md +7 -2
  87. data/samples/sample-book/src/.gitignore +154 -0
  88. data/samples/sample-book/src/config-ebook.yml +4 -0
  89. data/samples/sample-book/src/config-jlreq-ebook.yml +4 -0
  90. data/samples/sample-book/src/config-jlreq.yml +6 -0
  91. data/samples/sample-book/src/config.yml +2 -2
  92. data/samples/sample-book/src/lib/tasks/review.rake +29 -14
  93. data/samples/sample-book/src/lib/tasks/z01_copy_sty.rake +14 -8
  94. data/samples/syntax-book/Gemfile +1 -1
  95. data/samples/syntax-book/ch01.re +4 -2
  96. data/samples/syntax-book/ch02.re +8 -16
  97. data/samples/syntax-book/ch03.re +3 -6
  98. data/samples/syntax-book/config-jlreq-lualatex.yml +4 -0
  99. data/samples/syntax-book/config-jlreq.yml +5 -0
  100. data/samples/syntax-book/config-print.yml +3 -0
  101. data/samples/syntax-book/config.yml +1 -1
  102. data/samples/syntax-book/lib/tasks/review.rake +30 -15
  103. data/samples/syntax-book/lib/tasks/z01_copy_sty.rake +14 -8
  104. data/templates/latex/config.erb +39 -25
  105. data/templates/latex/layout.tex.erb +1 -0
  106. data/templates/latex/review-jlreq/README.md +3 -1
  107. data/templates/latex/review-jlreq/review-base.sty +161 -50
  108. data/templates/latex/review-jlreq/review-jlreq.cls +21 -22
  109. data/templates/latex/review-jlreq/review-style.sty +4 -1
  110. data/templates/latex/review-jsbook/README.md +46 -5
  111. data/templates/latex/review-jsbook/review-base.sty +123 -35
  112. data/templates/latex/review-jsbook/review-jsbook.cls +10 -4
  113. data/templates/latex/review-jsbook/review-style.sty +5 -2
  114. data/templates/opf/epubv3.opf.erb +1 -0
  115. data/templates/web/html/layout-html5.html.erb +3 -3
  116. data/test/assets/test_template.tex +19 -7
  117. data/test/assets/test_template_backmatter.tex +19 -7
  118. data/test/book_test_helper.rb +11 -5
  119. data/test/test_book.rb +124 -79
  120. data/test/test_book_chapter.rb +97 -54
  121. data/test/test_book_part.rb +3 -3
  122. data/test/test_builder.rb +38 -13
  123. data/test/test_catalog.rb +24 -42
  124. data/test/test_catalog_converter_cmd.rb +1 -1
  125. data/test/test_converter.rb +1 -0
  126. data/test/test_epub3maker.rb +2 -2
  127. data/test/test_epubmaker.rb +8 -0
  128. data/test/test_epubmaker_cmd.rb +14 -7
  129. data/test/test_helper.rb +18 -7
  130. data/test/test_htmlbuilder.rb +1491 -205
  131. data/test/test_htmlutils.rb +0 -12
  132. data/test/test_i18n.rb +37 -37
  133. data/test/test_idgxmlbuilder.rb +744 -42
  134. data/test/test_idgxmlmaker_cmd.rb +46 -0
  135. data/test/test_image_finder.rb +52 -70
  136. data/test/test_index.rb +94 -44
  137. data/test/test_indexbuilder.rb +52 -0
  138. data/test/test_latexbuilder.rb +1784 -161
  139. data/test/test_latexbuilder_v2.rb +671 -102
  140. data/test/test_logger.rb +17 -4
  141. data/test/test_makerhelper.rb +2 -14
  142. data/test/test_markdownbuilder.rb +137 -16
  143. data/test/test_md2inaobuilder.rb +32 -9
  144. data/test/test_pdfmaker.rb +30 -12
  145. data/test/test_pdfmaker_cmd.rb +100 -6
  146. data/test/test_plaintextbuilder.rb +791 -30
  147. data/test/test_preprocessor.rb +2 -16
  148. data/test/test_review_ext.rb +2 -1
  149. data/test/test_rstbuilder.rb +274 -27
  150. data/test/test_sec_counter.rb +156 -0
  151. data/test/test_textmaker_cmd.rb +54 -0
  152. data/test/test_textutils.rb +109 -2
  153. data/test/test_topbuilder.rb +724 -34
  154. data/test/test_update.rb +20 -11
  155. data/test/test_webtocprinter.rb +75 -43
  156. data/test/test_yamlloader.rb +13 -0
  157. data/vendor/gentombow/LICENSE +1 -1
  158. data/vendor/gentombow/Makefile +0 -1
  159. data/vendor/gentombow/bounddvi-en.pdf +0 -0
  160. data/vendor/gentombow/bounddvi-en.tex +1 -0
  161. data/vendor/gentombow/bounddvi.pdf +0 -0
  162. data/vendor/gentombow/bounddvi.sty +30 -7
  163. data/vendor/gentombow/bounddvi.tex +1 -0
  164. data/vendor/gentombow/create_archive.sh +1 -0
  165. data/vendor/gentombow/gentombow-ja.pdf +0 -0
  166. data/vendor/gentombow/gentombow-ja.tex +9 -0
  167. data/vendor/gentombow/gentombow.pdf +0 -0
  168. data/vendor/gentombow/gentombow.sty +32 -10
  169. data/vendor/gentombow/gentombow.tex +8 -0
  170. data/vendor/gentombow/tests/gentombow-01-pdfx.tex +8 -0
  171. data/vendor/gentombow/tests/gentombow-02-pdfx.tex +8 -0
  172. data/vendor/jsclasses/LICENSE +1 -1
  173. data/vendor/jsclasses/Makefile +3 -2
  174. data/vendor/jsclasses/create_archive.sh +5 -5
  175. data/vendor/jsclasses/jis/Makefile +3 -2
  176. data/vendor/jsclasses/jis/jsarticle.cls +74 -31
  177. data/vendor/jsclasses/jis/jsbook.cls +74 -31
  178. data/vendor/jsclasses/jis/jsclasses.dtx +176 -36
  179. data/vendor/jsclasses/jis/jsclasses.ins +15 -5
  180. data/vendor/jsclasses/jis/jslogo.dtx +4 -4
  181. data/vendor/jsclasses/jis/jslogo.ins +9 -0
  182. data/vendor/jsclasses/jis/jslogo.sty +4 -16
  183. data/vendor/jsclasses/jis/jspf.cls +73 -30
  184. data/vendor/jsclasses/jis/jsreport.cls +74 -31
  185. data/vendor/jsclasses/jis/jsverb.ins +9 -0
  186. data/vendor/jsclasses/jis/jsverb.sty +1 -13
  187. data/vendor/jsclasses/jis/kiyou.cls +74 -31
  188. data/vendor/jsclasses/jis/minijs.sty +65 -22
  189. data/vendor/jsclasses/jis/okumacro.dtx +4 -5
  190. data/vendor/jsclasses/jis/okumacro.ins +9 -0
  191. data/vendor/jsclasses/jis/okumacro.sty +4 -17
  192. data/vendor/jsclasses/jis/okuverb.ins +9 -0
  193. data/vendor/jsclasses/jis/okuverb.sty +1 -13
  194. data/vendor/jsclasses/jis/winjis.sty +23 -19
  195. data/vendor/jsclasses/jsarticle.cls +74 -31
  196. data/vendor/jsclasses/jsbook.cls +74 -31
  197. data/vendor/jsclasses/jsclasses.dtx +176 -36
  198. data/vendor/jsclasses/jsclasses.ins +15 -5
  199. data/vendor/jsclasses/jsclasses.pdf +0 -0
  200. data/vendor/jsclasses/jslogo.dtx +4 -4
  201. data/vendor/jsclasses/jslogo.ins +9 -0
  202. data/vendor/jsclasses/jslogo.pdf +0 -0
  203. data/vendor/jsclasses/jslogo.sty +4 -16
  204. data/vendor/jsclasses/jspf.cls +73 -30
  205. data/vendor/jsclasses/jsreport.cls +74 -31
  206. data/vendor/jsclasses/jsverb.ins +9 -0
  207. data/vendor/jsclasses/jsverb.pdf +0 -0
  208. data/vendor/jsclasses/jsverb.sty +1 -13
  209. data/vendor/jsclasses/kiyou.cls +74 -31
  210. data/vendor/jsclasses/minijs.sty +68 -22
  211. data/vendor/jsclasses/okumacro.dtx +4 -5
  212. data/vendor/jsclasses/okumacro.ins +9 -0
  213. data/vendor/jsclasses/okumacro.pdf +0 -0
  214. data/vendor/jsclasses/okumacro.sty +4 -17
  215. data/vendor/jsclasses/okuverb.ins +9 -0
  216. data/vendor/jsclasses/okuverb.pdf +0 -0
  217. data/vendor/jsclasses/okuverb.sty +1 -13
  218. data/vendor/jsclasses/tests/relfont.tex +10 -0
  219. data/vendor/jsclasses/winjis.sty +23 -19
  220. metadata +65 -12
  221. data/.rubocop_todo.yml +0 -7
  222. data/lib/review/book/compilable.rb +0 -173
  223. data/lib/review/tocparser.rb +0 -271
  224. data/samples/syntax-book/review-ext.rb +0 -14
  225. data/test/test_tocparser.rb +0 -25
@@ -0,0 +1,52 @@
1
+ require 'test_helper'
2
+ require 'review/builder'
3
+
4
+ require 'review/book'
5
+
6
+ class MockCompiler
7
+ def text(s)
8
+ [:text, s]
9
+ end
10
+ end
11
+
12
+ class IndexBuidlerTest < Test::Unit::TestCase
13
+ include ReVIEW
14
+
15
+ def setup
16
+ @b = IndexBuilder.new
17
+ chap = ReVIEW::Book::Chapter.new(nil, nil, '-', nil)
18
+ @b.bind(MockCompiler.new, chap, nil)
19
+ end
20
+
21
+ def test_initialize
22
+ assert IndexBuilder.new
23
+ end
24
+
25
+ def test_check_id
26
+ io = StringIO.new
27
+ @b.instance_eval{ @logger = ReVIEW::Logger.new(io) }
28
+ @b.check_id('ABC')
29
+ assert_match('', io.string)
30
+
31
+ %w(# % \\ { } [ ] ~ / $ ' " | * ? & < > `).each do |c|
32
+ io = StringIO.new
33
+ @b.instance_eval{ @logger = ReVIEW::Logger.new(io) }
34
+ @b.check_id("id#{c}")
35
+ assert_match(/deprecated ID: `#{Regexp.escape(c)}` in `id#{Regexp.escape(c)}`/, io.string)
36
+ end
37
+ io = StringIO.new
38
+ @b.instance_eval{ @logger = ReVIEW::Logger.new(io) }
39
+ @b.check_id('A B C#')
40
+ assert_match(/deprecated ID: ` ` in `A B C#`/, io.string)
41
+
42
+ io = StringIO.new
43
+ @b.instance_eval{ @logger = ReVIEW::Logger.new(io) }
44
+ @b.check_id("A\tB")
45
+ assert_match(/deprecated ID: `\t` in `A\tB`/, io.string)
46
+
47
+ io = StringIO.new
48
+ @b.instance_eval{ @logger = ReVIEW::Logger.new(io) }
49
+ @b.check_id('.ABC')
50
+ assert_match(/deprecated ID: `.ABC` begins from `.`/, io.string)
51
+ end
52
+ end
@@ -14,10 +14,10 @@ class LATEXBuidlerTest < Test::Unit::TestCase
14
14
  'secnolevel' => 2, # for IDGXMLBuilder, EPUBBuilder
15
15
  'toclevel' => 2,
16
16
  'stylesheet' => nil, # for EPUBBuilder
17
- 'image_scale2width' => false,
18
17
  'texcommand' => 'uplatex',
19
- 'review_version' => '3'
18
+ 'review_version' => '4'
20
19
  )
20
+ @config['pdfmaker']['image_scale2width'] = nil
21
21
  @book = Book::Base.new
22
22
  @book.config = @config
23
23
  @compiler = ReVIEW::Compiler.new(@builder)
@@ -39,34 +39,62 @@ class LATEXBuidlerTest < Test::Unit::TestCase
39
39
 
40
40
  def test_headline_level1
41
41
  actual = compile_block("={test} this is test.\n")
42
- assert_equal %Q(\\chapter{this is test.}\n\\label{chap:chap1}\n), actual
42
+ expected = <<-EOS
43
+ \\chapter{this is test.}
44
+ \\label{chap:chap1}
45
+ EOS
46
+ assert_equal expected, actual
43
47
  end
44
48
 
45
49
  def test_headline_level1_without_secno
46
50
  @config['secnolevel'] = 0
47
51
  actual = compile_block("={test} this is test.\n")
48
- assert_equal %Q(\\chapter*{this is test.}\n\\addcontentsline{toc}{chapter}{this is test.}\n\\label{chap:chap1}\n), actual
52
+ expected = <<-EOS
53
+ \\chapter*{this is test.}
54
+ \\addcontentsline{toc}{chapter}{this is test.}
55
+ \\label{chap:chap1}
56
+ EOS
57
+ assert_equal expected, actual
49
58
  end
50
59
 
51
60
  def test_headline_level1_with_inlinetag
52
61
  actual = compile_block(%Q(={test} this @<b>{is} test.<&"_>\n))
53
- assert_equal %Q(\\chapter{this \\reviewbold{is} test.\\textless{}\\&"\\textunderscore{}\\textgreater{}}\n\\label{chap:chap1}\n), actual
62
+ expected = <<-EOS
63
+ \\chapter{this \\reviewbold{is} test.\\textless{}\\&"\\textunderscore{}\\textgreater{}}
64
+ \\label{chap:chap1}
65
+ EOS
66
+ assert_equal expected, actual
54
67
  end
55
68
 
56
69
  def test_headline_level2
57
70
  actual = compile_block("=={test} this is test.\n")
58
- assert_equal %Q(\\section{this is test.}\n\\label{sec:1-1}\n\\label{test}\n), actual
71
+ expected = <<-EOS
72
+ \\section{this is test.}
73
+ \\label{sec:1-1}
74
+ \\label{test}
75
+ EOS
76
+ assert_equal expected, actual
59
77
  end
60
78
 
61
79
  def test_headline_level3
62
80
  actual = compile_block("==={test} this is test.\n")
63
- assert_equal %Q(\\subsection*{this is test.}\n\\label{sec:1-0-1}\n\\label{test}\n), actual
81
+ expected = <<-EOS
82
+ \\subsection*{this is test.}
83
+ \\label{sec:1-0-1}
84
+ \\label{test}
85
+ EOS
86
+ assert_equal expected, actual
64
87
  end
65
88
 
66
89
  def test_headline_level3_with_secno
67
90
  @config['secnolevel'] = 3
68
91
  actual = compile_block("==={test} this is test.\n")
69
- assert_equal %Q(\\subsection{this is test.}\n\\label{sec:1-0-1}\n\\label{test}\n), actual
92
+ expected = <<-EOS
93
+ \\subsection{this is test.}
94
+ \\label{sec:1-0-1}
95
+ \\label{test}
96
+ EOS
97
+ assert_equal expected, actual
70
98
  end
71
99
 
72
100
  def test_label
@@ -169,6 +197,11 @@ class LATEXBuidlerTest < Test::Unit::TestCase
169
197
  assert_equal 'abc\\reviewunderline{def}ghi', actual
170
198
  end
171
199
 
200
+ def test_inline_bou
201
+ actual = compile_inline('傍点の@<bou>{テスト}です。')
202
+ assert_equal '傍点の\\reviewbou{テスト}です。', actual
203
+ end
204
+
172
205
  def test_inline_m
173
206
  @config['review_version'] = '3.0'
174
207
  actual = compile_inline('abc@<m>{\\alpha^n = \\inf < 2}ghi')
@@ -214,12 +247,18 @@ class LATEXBuidlerTest < Test::Unit::TestCase
214
247
 
215
248
  def test_inline_hd_chap
216
249
  def @chapter.headline_index
217
- items = [Book::HeadlineIndex::Item.new('chap1|test', [1, 1], 'te_st')]
218
- Book::HeadlineIndex.new(items, self)
250
+ item = Book::Index::Item.new('chap1|test', [1, 1], 'te_st')
251
+ idx = Book::HeadlineIndex.new(self)
252
+ idx.add_item(item)
253
+ idx
219
254
  end
220
255
 
221
256
  @config['secnolevel'] = 3
222
257
  actual = compile_inline('test @<hd>{chap1|test} test2')
258
+ assert_equal 'test \reviewsecref{「1.1.1 te\\textunderscore{}st」}{sec:1-1-1} test2', actual
259
+
260
+ @config['chapterlink'] = nil
261
+ actual = compile_inline('test @<hd>{chap1|test} test2')
223
262
  assert_equal 'test 「1.1.1 te\\textunderscore{}st」 test2', actual
224
263
  end
225
264
 
@@ -249,9 +288,9 @@ class LATEXBuidlerTest < Test::Unit::TestCase
249
288
  end
250
289
 
251
290
  def test_inline_idx_yomi
291
+ require 'nkf'
252
292
  begin
253
293
  require 'MeCab'
254
- require 'nkf'
255
294
  rescue LoadError
256
295
  $stderr.puts 'skip test_inline_idx_yomi (cannot find MeCab)'
257
296
  return true
@@ -274,47 +313,189 @@ class LATEXBuidlerTest < Test::Unit::TestCase
274
313
  end
275
314
 
276
315
  def test_dlist
277
- actual = compile_block(": foo\n foo.\n bar.\n")
278
- assert_equal %Q(\n\\begin{description}\n\\item[foo] \\mbox{} \\\\\nfoo.bar.\n\\end{description}\n), actual
316
+ actual = compile_block(" : foo\n foo.\n bar.\n")
317
+ expected = <<-EOS
318
+
319
+ \\begin{description}
320
+ \\item[foo] \\mbox{} \\\\
321
+ foo.
322
+ bar.
323
+ \\end{description}
324
+ EOS
325
+ assert_equal expected, actual
326
+
327
+ @book.config['join_lines_by_lang'] = true
328
+ actual = compile_block(" : foo\n foo.\n bar.\n")
329
+ expected = <<-EOS
330
+
331
+ \\begin{description}
332
+ \\item[foo] \\mbox{} \\\\
333
+ foo. bar.
334
+ \\end{description}
335
+ EOS
336
+ assert_equal expected, actual
279
337
  end
280
338
 
281
339
  def test_dlist_with_bracket
282
- actual = compile_block(": foo[bar]\n foo.\n bar.\n")
283
- assert_equal %Q(\n\\begin{description}\n\\item[foo\\lbrack{}bar\\rbrack{}] \\mbox{} \\\\\nfoo.bar.\n\\end{description}\n), actual
340
+ actual = compile_block(" : foo[bar]\n foo.\n bar.\n")
341
+ expected = <<-EOS
342
+
343
+ \\begin{description}
344
+ \\item[foo\\lbrack{}bar\\rbrack{}] \\mbox{} \\\\
345
+ foo.
346
+ bar.
347
+ \\end{description}
348
+ EOS
349
+ assert_equal expected, actual
350
+
351
+ @book.config['join_lines_by_lang'] = true
352
+ actual = compile_block(" : foo[bar]\n foo.\n bar.\n")
353
+ expected = <<-EOS
354
+
355
+ \\begin{description}
356
+ \\item[foo\\lbrack{}bar\\rbrack{}] \\mbox{} \\\\
357
+ foo. bar.
358
+ \\end{description}
359
+ EOS
360
+ assert_equal expected, actual
284
361
  end
285
362
 
286
363
  def test_dlist_beforeulol
287
364
  actual = compile_block(" : foo\n foo.\n\npara\n\n : foo\n foo.\n\n 1. bar\n\n : foo\n foo.\n\n * bar\n")
288
- assert_equal %Q(\n\\begin{description}\n\\item[foo] \\mbox{} \\\\\nfoo.\n\\end{description}\n\npara\n\n\\begin{description}\n\\item[foo] \\mbox{} \\\\\nfoo.\n\\end{description}\n\n\\begin{enumerate}\n\\item bar\n\\end{enumerate}\n\n\\begin{description}\n\\item[foo] \\mbox{} \\\\\nfoo.\n\\end{description}\n\n\\begin{itemize}\n\\item bar\n\\end{itemize}\n), actual
365
+ expected = <<-EOS
366
+
367
+ \\begin{description}
368
+ \\item[foo] \\mbox{} \\\\
369
+ foo.
370
+ \\end{description}
371
+
372
+ para
373
+
374
+ \\begin{description}
375
+ \\item[foo] \\mbox{} \\\\
376
+ foo.
377
+ \\end{description}
378
+
379
+ \\begin{enumerate}
380
+ \\item bar
381
+ \\end{enumerate}
382
+
383
+ \\begin{description}
384
+ \\item[foo] \\mbox{} \\\\
385
+ foo.
386
+ \\end{description}
387
+
388
+ \\begin{itemize}
389
+ \\item bar
390
+ \\end{itemize}
391
+ EOS
392
+ assert_equal expected, actual
393
+ end
394
+
395
+ def test_dt_inline
396
+ actual = compile_block("//footnote[bar][bar]\n\n : foo@<fn>{bar}[]<>&@<m>$\\alpha[]$\n")
397
+
398
+ expected = <<-EOS
399
+
400
+ \\begin{description}
401
+ \\item[foo\\protect\\footnotemark{}\\lbrack{}\\rbrack{}\\textless{}\\textgreater{}\\&$\\alpha\\lbrack{}\\rbrack{}$] \\mbox{} \\\\
402
+
403
+ \\end{description}
404
+ EOS
405
+ assert_equal expected, actual
289
406
  end
290
407
 
291
408
  def test_cmd
292
409
  actual = compile_block("//cmd{\nfoo\nbar\n\nbuz\n//}\n")
293
- assert_equal %Q(\n\\begin{reviewlistblock}\n\\begin{reviewcmd}\nfoo\nbar\n\nbuz\n\\end{reviewcmd}\n\\end{reviewlistblock}\n), actual
410
+ expected = <<-EOS
411
+
412
+ \\begin{reviewlistblock}
413
+ \\begin{reviewcmd}
414
+ foo
415
+ bar
416
+
417
+ buz
418
+ \\end{reviewcmd}
419
+ \\end{reviewlistblock}
420
+ EOS
421
+ assert_equal expected, actual
294
422
  end
295
423
 
296
424
  def test_cmd_caption
297
425
  actual = compile_block("//cmd[cap1]{\nfoo\nbar\n\nbuz\n//}\n")
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
426
+ expected = <<-EOS
427
+
428
+ \\begin{reviewlistblock}
429
+ \\reviewcmdcaption{cap1}
430
+ \\begin{reviewcmd}
431
+ foo
432
+ bar
433
+
434
+ buz
435
+ \\end{reviewcmd}
436
+ \\end{reviewlistblock}
437
+ EOS
438
+ assert_equal expected, actual
439
+
440
+ @config['caption_position']['list'] = 'bottom'
441
+ actual = compile_block("//cmd[cap1]{\nfoo\nbar\n\nbuz\n//}\n")
442
+ expected = <<-EOS
443
+
444
+ \\begin{reviewlistblock}
445
+ \\begin{reviewcmd}
446
+ foo
447
+ bar
448
+
449
+ buz
450
+ \\end{reviewcmd}
451
+ \\reviewcmdcaption{cap1}
452
+ \\end{reviewlistblock}
453
+ EOS
454
+ assert_equal expected, actual
299
455
  end
300
456
 
301
457
  def test_cmd_lst
302
458
  @book.config['highlight'] = {}
303
459
  @book.config['highlight']['latex'] = 'listings'
304
460
  actual = compile_block("//cmd{\nfoo\nbar\n\nbuz\n//}\n")
305
- assert_equal %Q(\\begin{reviewcmdlst}[language={}]\nfoo\nbar\n\nbuz\n\\end{reviewcmdlst}\n), actual
461
+ expected = <<-EOS
462
+ \\begin{reviewcmdlst}[language={}]
463
+ foo
464
+ bar
465
+
466
+ buz
467
+ \\end{reviewcmdlst}
468
+ EOS
469
+ assert_equal expected, actual
306
470
  end
307
471
 
308
472
  def test_emlist
309
473
  actual = compile_block("//emlist{\nfoo\nbar\n\nbuz\n//}\n")
310
- assert_equal %Q(\n\\begin{reviewlistblock}\n\\begin{reviewemlist}\nfoo\nbar\n\nbuz\n\\end{reviewemlist}\n\\end{reviewlistblock}\n), actual
474
+ expected = <<-EOS
475
+
476
+ \\begin{reviewlistblock}
477
+ \\begin{reviewemlist}
478
+ foo
479
+ bar
480
+
481
+ buz
482
+ \\end{reviewemlist}
483
+ \\end{reviewlistblock}
484
+ EOS
485
+ assert_equal expected, actual
311
486
  end
312
487
 
313
488
  def test_emlist_lst
314
489
  @book.config['highlight'] = {}
315
490
  @book.config['highlight']['latex'] = 'listings'
316
491
  actual = compile_block("//emlist[][sql]{\nSELECT COUNT(*) FROM tests WHERE tests.no > 10 AND test.name LIKE 'ABC%'\n//}\n")
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
492
+ expected = <<-EOS
493
+
494
+ \\begin{reviewemlistlst}[language={sql}]
495
+ SELECT COUNT(*) FROM tests WHERE tests.no > 10 AND test.name LIKE 'ABC%'
496
+ \\end{reviewemlistlst}
497
+ EOS
498
+ assert_equal expected, actual
318
499
  end
319
500
 
320
501
  def test_emlist_lst_without_lang
@@ -322,45 +503,181 @@ class LATEXBuidlerTest < Test::Unit::TestCase
322
503
  @book.config['highlight']['latex'] = 'listings'
323
504
  @book.config['highlight']['lang'] = 'sql'
324
505
  actual = compile_block("//emlist[]{\nSELECT COUNT(*) FROM tests WHERE tests.no > 10 AND test.name LIKE 'ABC%'\n//}\n")
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
506
+ expected = <<-EOS
507
+
508
+ \\begin{reviewemlistlst}[language={sql}]
509
+ SELECT COUNT(*) FROM tests WHERE tests.no > 10 AND test.name LIKE 'ABC%'
510
+ \\end{reviewemlistlst}
511
+ EOS
512
+ assert_equal expected, actual
326
513
  end
327
514
 
328
515
  def test_emlist_caption
329
516
  actual = compile_block("//emlist[cap1]{\nfoo\nbar\n\nbuz\n//}\n")
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
517
+ expected = <<-EOS
518
+
519
+ \\begin{reviewlistblock}
520
+ \\reviewemlistcaption{cap1}
521
+ \\begin{reviewemlist}
522
+ foo
523
+ bar
524
+
525
+ buz
526
+ \\end{reviewemlist}
527
+ \\end{reviewlistblock}
528
+ EOS
529
+ assert_equal expected, actual
530
+
531
+ @config['caption_position']['list'] = 'bottom'
532
+ actual = compile_block("//emlist[cap1]{\nfoo\nbar\n\nbuz\n//}\n")
533
+ expected = <<-EOS
534
+
535
+ \\begin{reviewlistblock}
536
+ \\begin{reviewemlist}
537
+ foo
538
+ bar
539
+
540
+ buz
541
+ \\end{reviewemlist}
542
+ \\reviewemlistcaption{cap1}
543
+ \\end{reviewlistblock}
544
+ EOS
545
+ assert_equal expected, actual
331
546
  end
332
547
 
333
548
  def test_emlist_empty_caption
334
549
  actual = compile_block("//emlist[]{\nfoo\nbar\n\nbuz\n//}\n")
335
- assert_equal %Q(\n\\begin{reviewlistblock}\n\\begin{reviewemlist}\nfoo\nbar\n\nbuz\n\\end{reviewemlist}\n\\end{reviewlistblock}\n), actual
550
+ expected = <<-EOS
551
+
552
+ \\begin{reviewlistblock}
553
+ \\begin{reviewemlist}
554
+ foo
555
+ bar
556
+
557
+ buz
558
+ \\end{reviewemlist}
559
+ \\end{reviewlistblock}
560
+ EOS
561
+ assert_equal expected, actual
336
562
  end
337
563
 
338
564
  def test_emlist_with_tab
339
565
  actual = compile_block("//emlist{\n\tfoo\n\t\tbar\n\n\tbuz\n//}\n")
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
566
+ expected = <<-EOS
567
+
568
+ \\begin{reviewlistblock}
569
+ \\begin{reviewemlist}
570
+ foo
571
+ bar
572
+
573
+ buz
574
+ \\end{reviewemlist}
575
+ \\end{reviewlistblock}
576
+ EOS
577
+ assert_equal expected, actual
341
578
  end
342
579
 
343
580
  def test_emlist_with_tab4
344
581
  @config['tabwidth'] = 4
345
582
  actual = compile_block("//emlist{\n\tfoo\n\t\tbar\n\n\tbuz\n//}\n")
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
583
+ expected = <<-EOS
584
+
585
+ \\begin{reviewlistblock}
586
+ \\begin{reviewemlist}
587
+ foo
588
+ bar
589
+
590
+ buz
591
+ \\end{reviewemlist}
592
+ \\end{reviewlistblock}
593
+ EOS
594
+ assert_equal expected, actual
347
595
  end
348
596
 
349
597
  def test_emlistnum_caption
350
598
  actual = compile_block("//emlistnum[cap1]{\nfoo\nbar\n\nbuz\n//}\n")
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
599
+ expected = <<-EOS
600
+
601
+ \\begin{reviewlistblock}
602
+ \\reviewemlistcaption{cap1}
603
+ \\begin{reviewemlist}
604
+ 1: foo
605
+ 2: bar
606
+ 3:
607
+ 4: buz
608
+ \\end{reviewemlist}
609
+ \\end{reviewlistblock}
610
+ EOS
611
+ assert_equal expected, actual
612
+
613
+ @config['caption_position']['list'] = 'bottom'
614
+ actual = compile_block("//emlistnum[cap1]{\nfoo\nbar\n\nbuz\n//}\n")
615
+ expected = <<-EOS
616
+
617
+ \\begin{reviewlistblock}
618
+ \\begin{reviewemlist}
619
+ 1: foo
620
+ 2: bar
621
+ 3:
622
+ 4: buz
623
+ \\end{reviewemlist}
624
+ \\reviewemlistcaption{cap1}
625
+ \\end{reviewlistblock}
626
+ EOS
627
+ assert_equal expected, actual
352
628
  end
353
629
 
354
630
  def test_list
355
631
  actual = compile_block("//list[id1][cap1]{\nfoo\nbar\n\nbuz\n//}\n")
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
632
+ expected = <<-EOS
633
+ \\begin{reviewlistblock}
634
+ \\reviewlistcaption{リスト1.1: cap1}
635
+ \\begin{reviewlist}
636
+ foo
637
+ bar
638
+
639
+ buz
640
+ \\end{reviewlist}
641
+ \\end{reviewlistblock}
642
+ EOS
643
+ assert_equal expected, actual
644
+
645
+ @config['caption_position']['list'] = 'bottom'
646
+ actual = compile_block("//list[id1][cap1]{\nfoo\nbar\n\nbuz\n//}\n")
647
+ expected = <<-EOS
648
+ \\begin{reviewlistblock}
649
+ \\begin{reviewlist}
650
+ foo
651
+ bar
652
+
653
+ buz
654
+ \\end{reviewlist}
655
+ \\reviewlistcaption{リスト1.1: cap1}
656
+ \\end{reviewlistblock}
657
+ EOS
658
+ assert_equal expected, actual
357
659
  end
358
660
 
359
661
  def test_list_lst
360
662
  @book.config['highlight'] = {}
361
663
  @book.config['highlight']['latex'] = 'listings'
362
664
  actual = compile_block("//list[id1][cap1][sql]{\nSELECT COUNT(*) FROM tests WHERE tests.no > 10 AND test.name LIKE 'ABC%'\n//}\n")
363
- assert_equal %Q(\\begin{reviewlistlst}[caption={cap1},language={sql}]\nSELECT COUNT(*) FROM tests WHERE tests.no > 10 AND test.name LIKE 'ABC%'\n\\end{reviewlistlst}\n), actual
665
+ expected = <<-EOS
666
+ \\begin{reviewlistlst}[caption={cap1},language={sql}]
667
+ SELECT COUNT(*) FROM tests WHERE tests.no > 10 AND test.name LIKE 'ABC%'
668
+ \\end{reviewlistlst}
669
+ EOS
670
+ assert_equal expected, actual
671
+
672
+ @config['caption_position']['list'] = 'bottom'
673
+ # XXX: caption_position won't work with highlight
674
+ actual = compile_block("//list[id1][cap1][sql]{\nSELECT COUNT(*) FROM tests WHERE tests.no > 10 AND test.name LIKE 'ABC%'\n//}\n")
675
+ expected = <<-EOS
676
+ \\begin{reviewlistlst}[caption={cap1},language={sql}]
677
+ SELECT COUNT(*) FROM tests WHERE tests.no > 10 AND test.name LIKE 'ABC%'
678
+ \\end{reviewlistlst}
679
+ EOS
680
+ assert_equal expected, actual
364
681
  end
365
682
 
366
683
  def test_list_lst_with_lang
@@ -368,227 +685,714 @@ class LATEXBuidlerTest < Test::Unit::TestCase
368
685
  @book.config['highlight']['latex'] = 'listings'
369
686
  @book.config['highlight']['lang'] = 'sql'
370
687
  actual = compile_block("//list[id1][cap1]{\nSELECT COUNT(*) FROM tests WHERE tests.no > 10 AND test.name LIKE 'ABC%'\n//}\n")
371
- assert_equal %Q(\\begin{reviewlistlst}[caption={cap1},language={sql}]\nSELECT COUNT(*) FROM tests WHERE tests.no > 10 AND test.name LIKE 'ABC%'\n\\end{reviewlistlst}\n), actual
688
+ expected = <<-EOS
689
+ \\begin{reviewlistlst}[caption={cap1},language={sql}]
690
+ SELECT COUNT(*) FROM tests WHERE tests.no > 10 AND test.name LIKE 'ABC%'
691
+ \\end{reviewlistlst}
692
+ EOS
693
+ assert_equal expected, actual
372
694
  end
373
695
 
374
696
  def test_listnum
375
697
  actual = compile_block("//listnum[test1][ruby]{\nclass Foo\n def foo\n bar\n\n buz\n end\nend\n//}\n")
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
698
+ expected = <<-EOS
699
+ \\begin{reviewlistblock}
700
+ \\reviewlistcaption{リスト1.1: ruby}
701
+ \\begin{reviewlist}
702
+ 1: class Foo
703
+ 2: def foo
704
+ 3: bar
705
+ 4:
706
+ 5: buz
707
+ 6: end
708
+ 7: end
709
+ \\end{reviewlist}
710
+ \\end{reviewlistblock}
711
+ EOS
712
+ assert_equal expected, actual
713
+
714
+ @config['caption_position']['list'] = 'bottom'
715
+ actual = compile_block("//listnum[test1][ruby]{\nclass Foo\n def foo\n bar\n\n buz\n end\nend\n//}\n")
716
+ expected = <<-EOS
717
+ \\begin{reviewlistblock}
718
+ \\begin{reviewlist}
719
+ 1: class Foo
720
+ 2: def foo
721
+ 3: bar
722
+ 4:
723
+ 5: buz
724
+ 6: end
725
+ 7: end
726
+ \\end{reviewlist}
727
+ \\reviewlistcaption{リスト1.1: ruby}
728
+ \\end{reviewlistblock}
729
+ EOS
730
+ assert_equal expected, actual
377
731
  end
378
732
 
379
733
  def test_listnum_linenum
380
734
  actual = compile_block("//firstlinenum[100]\n//listnum[test1][ruby]{\nclass Foo\n def foo\n bar\n\n buz\n end\nend\n//}\n")
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
735
+ expected = <<-EOS
736
+ \\begin{reviewlistblock}
737
+ \\reviewlistcaption{リスト1.1: ruby}
738
+ \\begin{reviewlist}
739
+ 100: class Foo
740
+ 101: def foo
741
+ 102: bar
742
+ 103:
743
+ 104: buz
744
+ 105: end
745
+ 106: end
746
+ \\end{reviewlist}
747
+ \\end{reviewlistblock}
748
+ EOS
749
+ assert_equal expected, actual
382
750
  end
383
751
 
384
752
  def test_listnum_lst
385
753
  @book.config['highlight'] = {}
386
754
  @book.config['highlight']['latex'] = 'listings'
387
755
  actual = compile_block("//listnum[test1][ruby]{\nclass Foo\n def foo\n bar\n\n buz\n end\nend\n//}\n")
388
- assert_equal %Q(\\begin{reviewlistnumlst}[caption={ruby},language={}]\nclass Foo\n def foo\n bar\n\n buz\n end\nend\n\\end{reviewlistnumlst}\n), actual
756
+ expected = <<-EOS
757
+ \\begin{reviewlistnumlst}[caption={ruby},language={}]
758
+ class Foo
759
+ def foo
760
+ bar
761
+
762
+ buz
763
+ end
764
+ end
765
+ \\end{reviewlistnumlst}
766
+ EOS
767
+ assert_equal expected, actual
768
+
769
+ @config['caption_position']['list'] = 'bottom'
770
+ # XXX: caption_position won't work with highlight
771
+ actual = compile_block("//listnum[test1][ruby]{\nclass Foo\n def foo\n bar\n\n buz\n end\nend\n//}\n")
772
+ expected = <<-EOS
773
+ \\begin{reviewlistnumlst}[caption={ruby},language={}]
774
+ class Foo
775
+ def foo
776
+ bar
777
+
778
+ buz
779
+ end
780
+ end
781
+ \\end{reviewlistnumlst}
782
+ EOS
783
+ assert_equal expected, actual
389
784
  end
390
785
 
391
786
  def test_listnum_lst_linenum
392
787
  @book.config['highlight'] = {}
393
788
  @book.config['highlight']['latex'] = 'listings'
394
789
  actual = compile_block("//firstlinenum[100]\n//listnum[test1][ruby]{\nclass Foo\n def foo\n bar\n\n buz\n end\nend\n//}\n")
395
- assert_equal %Q(\\begin{reviewlistnumlst}[caption={ruby},language={},firstnumber=100]\nclass Foo\n def foo\n bar\n\n buz\n end\nend\n\\end{reviewlistnumlst}\n), actual
790
+ expected = <<-EOS
791
+ \\begin{reviewlistnumlst}[caption={ruby},language={},firstnumber=100]
792
+ class Foo
793
+ def foo
794
+ bar
795
+
796
+ buz
797
+ end
798
+ end
799
+ \\end{reviewlistnumlst}
800
+ EOS
801
+ assert_equal expected, actual
396
802
  end
397
803
 
398
804
  def test_source
399
805
  actual = compile_block("//source[foo/bar/test.rb]{\nfoo\nbar\n\nbuz\n//}\n")
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
806
+ expected = <<-EOS
807
+ \\begin{reviewlistblock}
808
+ \\reviewsourcecaption{foo/bar/test.rb}
809
+ \\begin{reviewsource}
810
+ foo
811
+ bar
812
+
813
+ buz
814
+ \\end{reviewsource}
815
+ \\end{reviewlistblock}
816
+ EOS
817
+ assert_equal expected, actual
818
+
819
+ @config['caption_position']['list'] = 'bottom'
820
+ actual = compile_block("//source[foo/bar/test.rb]{\nfoo\nbar\n\nbuz\n//}\n")
821
+ expected = <<-EOS
822
+ \\begin{reviewlistblock}
823
+ \\begin{reviewsource}
824
+ foo
825
+ bar
826
+
827
+ buz
828
+ \\end{reviewsource}
829
+ \\reviewsourcecaption{foo/bar/test.rb}
830
+ \\end{reviewlistblock}
831
+ EOS
832
+ assert_equal expected, actual
401
833
  end
402
834
 
403
835
  def test_source_empty_caption
404
836
  actual = compile_block("//source[]{\nfoo\nbar\n\nbuz\n//}\n")
405
- assert_equal %Q(\\begin{reviewlistblock}\n\\begin{reviewsource}\nfoo\nbar\n\nbuz\n\\end{reviewsource}\n\\end{reviewlistblock}\n), actual
837
+ expected = <<-EOS
838
+ \\begin{reviewlistblock}
839
+ \\begin{reviewsource}
840
+ foo
841
+ bar
842
+
843
+ buz
844
+ \\end{reviewsource}
845
+ \\end{reviewlistblock}
846
+ EOS
847
+ assert_equal expected, actual
406
848
  end
407
849
 
408
850
  def test_source_lst
409
851
  @book.config['highlight'] = {}
410
852
  @book.config['highlight']['latex'] = 'listings'
411
853
  actual = compile_block("//source[foo/bar/test.rb]{\nfoo\nbar\n\nbuz\n//}\n")
412
- assert_equal %Q(\\begin{reviewsourcelst}[title={foo/bar/test.rb},language={}]\nfoo\nbar\n\nbuz\n\\end{reviewsourcelst}\n), actual
413
- end
854
+ expected = <<-EOS
855
+ \\begin{reviewsourcelst}[title={foo/bar/test.rb},language={}]
856
+ foo
857
+ bar
414
858
 
415
- def test_quote
416
- actual = compile_block("//quote{\nfoo\nbar\n\nbuz\n//}\n")
417
- assert_equal %Q(\n\\begin{quote}\nfoobar\n\nbuz\n\\end{quote}\n), actual
418
- end
859
+ buz
860
+ \\end{reviewsourcelst}
861
+ EOS
862
+ assert_equal expected, actual
419
863
 
420
- def test_memo
864
+ @config['caption_position']['list'] = 'bottom'
865
+ # XXX: caption_position won't work with highlight
866
+ actual = compile_block("//source[foo/bar/test.rb]{\nfoo\nbar\n\nbuz\n//}\n")
867
+ expected = <<-EOS
868
+ \\begin{reviewsourcelst}[title={foo/bar/test.rb},language={}]
869
+ foo
870
+ bar
871
+
872
+ buz
873
+ \\end{reviewsourcelst}
874
+ EOS
875
+ assert_equal expected, actual
876
+ end
877
+
878
+ def test_quote
879
+ actual = compile_block("//quote{\nfoo\nbar\n\nbuz\n//}\n")
880
+ expected = <<-EOS
881
+
882
+ \\begin{quote}
883
+ foobar
884
+
885
+ buz
886
+ \\end{quote}
887
+ EOS
888
+ assert_equal expected, actual
889
+
890
+ @book.config['join_lines_by_lang'] = true
891
+ actual = compile_block("//quote{\nfoo\nbar\n\nbuz\n//}\n")
892
+ expected = <<-EOS
893
+
894
+ \\begin{quote}
895
+ foo bar
896
+
897
+ buz
898
+ \\end{quote}
899
+ EOS
900
+ assert_equal expected, actual
901
+ end
902
+
903
+ def test_memo
421
904
  actual = compile_block("//memo[this is @<b>{test}<&>_]{\ntest1\n\ntest@<i>{2}\n//}\n")
422
- assert_equal %Q(\\begin{reviewmemo}[this is \\reviewbold{test}\\textless{}\\&\\textgreater{}\\textunderscore{}]\ntest1\n\ntest\\reviewit{2}\n\\end{reviewmemo}\n), actual
905
+ expected = <<-EOS
906
+ \\begin{reviewmemo}[this is \\reviewbold{test}\\textless{}\\&\\textgreater{}\\textunderscore{}]
907
+
908
+ test1
909
+
910
+ test\\reviewit{2}
911
+
912
+ \\end{reviewmemo}
913
+ EOS
914
+ assert_equal expected, actual
423
915
  end
424
916
 
425
917
  def test_flushright
426
918
  actual = compile_block("//flushright{\nfoo\nbar\n\nbuz\n//}\n")
427
- assert_equal %Q(\n\\begin{flushright}\nfoobar\n\nbuz\n\\end{flushright}\n), actual
919
+ expected = <<-EOS
920
+
921
+ \\begin{flushright}
922
+ foobar
923
+
924
+ buz
925
+ \\end{flushright}
926
+ EOS
927
+ assert_equal expected, actual
928
+
929
+ @book.config['join_lines_by_lang'] = true
930
+ actual = compile_block("//flushright{\nfoo\nbar\n\nbuz\n//}\n")
931
+ expected = <<-EOS
932
+
933
+ \\begin{flushright}
934
+ foo bar
935
+
936
+ buz
937
+ \\end{flushright}
938
+ EOS
939
+ assert_equal expected, actual
428
940
  end
429
941
 
430
942
  def test_centering
431
943
  actual = compile_block("//centering{\nfoo\nbar\n\nbuz\n//}\n")
432
- assert_equal %Q(\n\\begin{center}\nfoobar\n\nbuz\n\\end{center}\n), actual
944
+ expected = <<-EOS
945
+
946
+ \\begin{center}
947
+ foobar
948
+
949
+ buz
950
+ \\end{center}
951
+ EOS
952
+ assert_equal expected, actual
953
+
954
+ @book.config['join_lines_by_lang'] = true
955
+ actual = compile_block("//centering{\nfoo\nbar\n\nbuz\n//}\n")
956
+ expected = <<-EOS
957
+
958
+ \\begin{center}
959
+ foo bar
960
+
961
+ buz
962
+ \\end{center}
963
+ EOS
964
+ assert_equal expected, actual
433
965
  end
434
966
 
435
967
  def test_blankline
436
968
  actual = compile_block("//blankline\nfoo\n")
437
- assert_equal %Q(\\vspace*{\\baselineskip}\n\nfoo\n), actual
969
+ expected = <<-EOS
970
+ \\vspace*{\\baselineskip}
971
+
972
+ foo
973
+ EOS
974
+ assert_equal expected, actual
438
975
  end
439
976
 
440
977
  def test_noindent
441
978
  actual = compile_block("//noindent\nfoo\nbar\n\nfoo2\nbar2\n")
442
- assert_equal %Q(\\noindent\nfoo\nbar\n\nfoo2\nbar2\n), actual
979
+ expected = <<-EOS
980
+ \\noindent
981
+ foo
982
+ bar
983
+
984
+ foo2
985
+ bar2
986
+ EOS
987
+ assert_equal expected, actual
988
+
989
+ @book.config['join_lines_by_lang'] = true
990
+ actual = compile_block("//noindent\nfoo\nbar\n\nfoo2\nbar2\n")
991
+ expected = <<-EOS
992
+ \\noindent
993
+ foo bar
994
+
995
+ foo2 bar2
996
+ EOS
997
+ assert_equal expected, actual
443
998
  end
444
999
 
445
1000
  def test_image
446
1001
  def @chapter.image(_id)
447
- item = Book::ImageIndex::Item.new('sampleimg', 1)
1002
+ item = Book::Index::Item.new('sampleimg', 1)
448
1003
  item.instance_eval { @path = './images/chap1-sampleimg.png' }
449
1004
  item
450
1005
  end
451
1006
 
452
1007
  actual = compile_block("//image[sampleimg][sample photo]{\n//}\n")
453
- assert_equal %Q(\\begin{reviewimage}%%sampleimg\n\\includegraphics[width=\\maxwidth]{./images/chap1-sampleimg.png}\n\\reviewimagecaption{sample photo}\n\\label{image:chap1:sampleimg}\n\\end{reviewimage}\n), actual
1008
+ expected = <<-EOS
1009
+ \\begin{reviewimage}%%sampleimg
1010
+ \\reviewincludegraphics[width=\\maxwidth]{./images/chap1-sampleimg.png}
1011
+ \\reviewimagecaption{sample photo}
1012
+ \\label{image:chap1:sampleimg}
1013
+ \\end{reviewimage}
1014
+ EOS
1015
+ assert_equal expected, actual
1016
+
1017
+ @book.config['pdfmaker']['use_original_image_size'] = true
1018
+ actual = compile_block("//image[sampleimg][sample photo]{\n//}\n")
1019
+ expected = <<-EOS
1020
+ \\begin{reviewimage}%%sampleimg
1021
+ \\reviewincludegraphics[ ]{./images/chap1-sampleimg.png}
1022
+ \\reviewimagecaption{sample photo}
1023
+ \\label{image:chap1:sampleimg}
1024
+ \\end{reviewimage}
1025
+ EOS
1026
+ assert_equal expected, actual
1027
+
1028
+ actual = compile_block("//image[sampleimg][sample photo][]{\n//}\n")
1029
+ assert_equal expected, actual
1030
+
1031
+ @book.config['pdfmaker']['use_original_image_size'] = nil
1032
+ @config['caption_position']['image'] = 'top'
1033
+ actual = compile_block("//image[sampleimg][sample photo]{\n//}\n")
1034
+ expected = <<-EOS
1035
+ \\begin{reviewimage}%%sampleimg
1036
+ \\reviewimagecaption{sample photo}
1037
+ \\label{image:chap1:sampleimg}
1038
+ \\reviewincludegraphics[width=\\maxwidth]{./images/chap1-sampleimg.png}
1039
+ \\end{reviewimage}
1040
+ EOS
1041
+ assert_equal expected, actual
454
1042
  end
455
1043
 
456
1044
  def test_image_with_metric
457
1045
  def @chapter.image(_id)
458
- item = Book::ImageIndex::Item.new('sampleimg', 1)
1046
+ item = Book::Index::Item.new('sampleimg', 1)
459
1047
  item.instance_eval { @path = './images/chap1-sampleimg.png' }
460
1048
  item
461
1049
  end
462
1050
 
463
1051
  actual = compile_block("//image[sampleimg][sample photo][scale=1.2]{\n//}\n")
464
- assert_equal %Q(\\begin{reviewimage}%%sampleimg\n\\includegraphics[scale=1.2]{./images/chap1-sampleimg.png}\n\\reviewimagecaption{sample photo}\n\\label{image:chap1:sampleimg}\n\\end{reviewimage}\n), actual
1052
+ expected = <<-EOS
1053
+ \\begin{reviewimage}%%sampleimg
1054
+ \\reviewincludegraphics[scale=1.2]{./images/chap1-sampleimg.png}
1055
+ \\reviewimagecaption{sample photo}
1056
+ \\label{image:chap1:sampleimg}
1057
+ \\end{reviewimage}
1058
+ EOS
1059
+ assert_equal expected, actual
1060
+
1061
+ @book.config['pdfmaker']['use_original_image_size'] = true
1062
+ actual = compile_block("//image[sampleimg][sample photo][scale=1.2]{\n//}\n")
1063
+ assert_equal expected, actual
465
1064
  end
466
1065
 
467
1066
  def test_image_with_metric_width
468
1067
  def @chapter.image(_id)
469
- item = Book::ImageIndex::Item.new('sampleimg', 1)
1068
+ item = Book::Index::Item.new('sampleimg', 1)
470
1069
  item.instance_eval { @path = './images/chap1-sampleimg.png' }
471
1070
  item
472
1071
  end
473
1072
 
474
- @config['image_scale2width'] = true
1073
+ @config['pdfmaker']['image_scale2width'] = true
1074
+ actual = compile_block("//image[sampleimg][sample photo][scale=1.2]{\n//}\n")
1075
+ expected = <<-EOS
1076
+ \\begin{reviewimage}%%sampleimg
1077
+ \\reviewincludegraphics[width=1.2\\maxwidth]{./images/chap1-sampleimg.png}
1078
+ \\reviewimagecaption{sample photo}
1079
+ \\label{image:chap1:sampleimg}
1080
+ \\end{reviewimage}
1081
+ EOS
1082
+ assert_equal expected, actual
1083
+
1084
+ @book.config['pdfmaker']['use_original_image_size'] = true
475
1085
  actual = compile_block("//image[sampleimg][sample photo][scale=1.2]{\n//}\n")
476
- assert_equal %Q(\\begin{reviewimage}%%sampleimg\n\\includegraphics[width=1.2\\maxwidth]{./images/chap1-sampleimg.png}\n\\reviewimagecaption{sample photo}\n\\label{image:chap1:sampleimg}\n\\end{reviewimage}\n), actual
1086
+ assert_equal expected, actual
477
1087
  end
478
1088
 
479
1089
  def test_image_with_metric2
480
1090
  def @chapter.image(_id)
481
- item = Book::ImageIndex::Item.new('sampleimg', 1)
1091
+ item = Book::Index::Item.new('sampleimg', 1)
482
1092
  item.instance_eval { @path = './images/chap1-sampleimg.png' }
483
1093
  item
484
1094
  end
485
1095
 
486
1096
  actual = compile_block("//image[sampleimg][sample photo][scale=1.2,html::class=sample,latex::ignore=params]{\n//}\n")
487
- assert_equal %Q(\\begin{reviewimage}%%sampleimg\n\\includegraphics[scale=1.2,ignore=params]{./images/chap1-sampleimg.png}\n\\reviewimagecaption{sample photo}\n\\label{image:chap1:sampleimg}\n\\end{reviewimage}\n), actual
1097
+ expected = <<-EOS
1098
+ \\begin{reviewimage}%%sampleimg
1099
+ \\reviewincludegraphics[scale=1.2,ignore=params]{./images/chap1-sampleimg.png}
1100
+ \\reviewimagecaption{sample photo}
1101
+ \\label{image:chap1:sampleimg}
1102
+ \\end{reviewimage}
1103
+ EOS
1104
+ assert_equal expected, actual
1105
+
1106
+ @book.config['pdfmaker']['use_original_image_size'] = true
1107
+ actual = compile_block("//image[sampleimg][sample photo][scale=1.2,html::class=sample,latex::ignore=params]{\n//}\n")
1108
+ assert_equal expected, actual
488
1109
  end
489
1110
 
490
1111
  def test_image_with_metric2_width
491
1112
  def @chapter.image(_id)
492
- item = Book::ImageIndex::Item.new('sampleimg', 1)
1113
+ item = Book::Index::Item.new('sampleimg', 1)
493
1114
  item.instance_eval { @path = './images/chap1-sampleimg.png' }
494
1115
  item
495
1116
  end
496
1117
 
497
- @config['image_scale2width'] = true
1118
+ @config['pdfmaker']['image_scale2width'] = true
1119
+ actual = compile_block("//image[sampleimg][sample photo][scale=1.2,html::class=sample,latex::ignore=params]{\n//}\n")
1120
+ expected = <<-EOS
1121
+ \\begin{reviewimage}%%sampleimg
1122
+ \\reviewincludegraphics[width=1.2\\maxwidth,ignore=params]{./images/chap1-sampleimg.png}
1123
+ \\reviewimagecaption{sample photo}
1124
+ \\label{image:chap1:sampleimg}
1125
+ \\end{reviewimage}
1126
+ EOS
1127
+ assert_equal expected, actual
1128
+
1129
+ @book.config['pdfmaker']['use_original_image_size'] = true
498
1130
  actual = compile_block("//image[sampleimg][sample photo][scale=1.2,html::class=sample,latex::ignore=params]{\n//}\n")
499
- assert_equal %Q(\\begin{reviewimage}%%sampleimg\n\\includegraphics[width=1.2\\maxwidth,ignore=params]{./images/chap1-sampleimg.png}\n\\reviewimagecaption{sample photo}\n\\label{image:chap1:sampleimg}\n\\end{reviewimage}\n), actual
1131
+ assert_equal expected, actual
500
1132
  end
501
1133
 
502
1134
  def test_indepimage
503
1135
  def @chapter.image(_id)
504
- item = Book::ImageIndex::Item.new('sampleimg', 1)
1136
+ item = Book::Index::Item.new('sampleimg', 1)
505
1137
  item.instance_eval { @path = './images/chap1-sampleimg.png' }
506
1138
  item
507
1139
  end
508
1140
 
509
1141
  actual = compile_block("//indepimage[sampleimg][sample photo]\n")
510
- assert_equal %Q(\\begin{reviewimage}%%sampleimg\n\\includegraphics[width=\\maxwidth]{./images/chap1-sampleimg.png}\n\\reviewindepimagecaption{図: sample photo}\n\\end{reviewimage}\n), actual
1142
+ expected = <<-EOS
1143
+ \\begin{reviewimage}%%sampleimg
1144
+ \\reviewincludegraphics[width=\\maxwidth]{./images/chap1-sampleimg.png}
1145
+ \\reviewindepimagecaption{図: sample photo}
1146
+ \\end{reviewimage}
1147
+ EOS
1148
+ assert_equal expected, actual
1149
+
1150
+ @book.config['pdfmaker']['use_original_image_size'] = true
1151
+ actual = compile_block("//indepimage[sampleimg][sample photo]\n")
1152
+ expected = <<-EOS
1153
+ \\begin{reviewimage}%%sampleimg
1154
+ \\reviewincludegraphics[ ]{./images/chap1-sampleimg.png}
1155
+ \\reviewindepimagecaption{図: sample photo}
1156
+ \\end{reviewimage}
1157
+ EOS
1158
+ assert_equal expected, actual
1159
+
1160
+ actual = compile_block("//indepimage[sampleimg][sample photo][]\n")
1161
+ assert_equal expected, actual
1162
+
1163
+ @book.config['pdfmaker']['use_original_image_size'] = nil
1164
+ @config['caption_position']['image'] = 'top'
1165
+ actual = compile_block("//indepimage[sampleimg][sample photo]\n")
1166
+ expected = <<-EOS
1167
+ \\begin{reviewimage}%%sampleimg
1168
+ \\reviewindepimagecaption{図: sample photo}
1169
+ \\reviewincludegraphics[width=\\maxwidth]{./images/chap1-sampleimg.png}
1170
+ \\end{reviewimage}
1171
+ EOS
1172
+ assert_equal expected, actual
511
1173
  end
512
1174
 
513
1175
  def test_indepimage_without_caption
514
1176
  def @chapter.image(_id)
515
- item = Book::ImageIndex::Item.new('sampleimg', 1)
1177
+ item = Book::Index::Item.new('sampleimg', 1)
516
1178
  item.instance_eval { @path = './images/chap1-sampleimg.png' }
517
1179
  item
518
1180
  end
519
1181
 
520
1182
  # FIXME: indepimage's caption should not be with a counter.
521
1183
  actual = compile_block("//indepimage[sampleimg]\n")
522
- assert_equal %Q(\\begin{reviewimage}%%sampleimg\n\\includegraphics[width=\\maxwidth]{./images/chap1-sampleimg.png}\n\\end{reviewimage}\n), actual
1184
+ expected = <<-EOS
1185
+ \\begin{reviewimage}%%sampleimg
1186
+ \\reviewincludegraphics[width=\\maxwidth]{./images/chap1-sampleimg.png}
1187
+ \\end{reviewimage}
1188
+ EOS
1189
+ assert_equal expected, actual
523
1190
  end
524
1191
 
525
1192
  def test_indepimage_with_metric
526
1193
  def @chapter.image(_id)
527
- item = Book::ImageIndex::Item.new('sampleimg', 1)
1194
+ item = Book::Index::Item.new('sampleimg', 1)
528
1195
  item.instance_eval { @path = './images/chap1-sampleimg.png' }
529
1196
  item
530
1197
  end
531
1198
 
532
1199
  actual = compile_block("//indepimage[sampleimg][sample photo][scale=1.2]\n")
533
- assert_equal %Q(\\begin{reviewimage}%%sampleimg\n\\includegraphics[scale=1.2]{./images/chap1-sampleimg.png}\n\\reviewindepimagecaption{図: sample photo}\n\\end{reviewimage}\n), actual
1200
+ expected = <<-EOS
1201
+ \\begin{reviewimage}%%sampleimg
1202
+ \\reviewincludegraphics[scale=1.2]{./images/chap1-sampleimg.png}
1203
+ \\reviewindepimagecaption{図: sample photo}
1204
+ \\end{reviewimage}
1205
+ EOS
1206
+ assert_equal expected, actual
1207
+
1208
+ @book.config['pdfmaker']['use_original_image_size'] = true
1209
+ actual = compile_block("//indepimage[sampleimg][sample photo][scale=1.2]\n")
1210
+ assert_equal expected, actual
534
1211
  end
535
1212
 
536
1213
  def test_indepimage_with_metric_width
537
1214
  def @chapter.image(_id)
538
- item = Book::ImageIndex::Item.new('sampleimg', 1)
1215
+ item = Book::Index::Item.new('sampleimg', 1)
539
1216
  item.instance_eval { @path = './images/chap1-sampleimg.png' }
540
1217
  item
541
1218
  end
542
1219
 
543
- @config['image_scale2width'] = true
1220
+ @config['pdfmaker']['image_scale2width'] = true
1221
+ actual = compile_block("//indepimage[sampleimg][sample photo][scale=1.2]\n")
1222
+ expected = <<-EOS
1223
+ \\begin{reviewimage}%%sampleimg
1224
+ \\reviewincludegraphics[width=1.2\\maxwidth]{./images/chap1-sampleimg.png}
1225
+ \\reviewindepimagecaption{図: sample photo}
1226
+ \\end{reviewimage}
1227
+ EOS
1228
+ assert_equal expected, actual
1229
+
1230
+ @book.config['pdfmaker']['use_original_image_size'] = true
544
1231
  actual = compile_block("//indepimage[sampleimg][sample photo][scale=1.2]\n")
545
- assert_equal %Q(\\begin{reviewimage}%%sampleimg\n\\includegraphics[width=1.2\\maxwidth]{./images/chap1-sampleimg.png}\n\\reviewindepimagecaption{図: sample photo}\n\\end{reviewimage}\n), actual
1232
+ assert_equal expected, actual
546
1233
  end
547
1234
 
548
1235
  def test_indepimage_with_metric2
549
1236
  def @chapter.image(_id)
550
- item = Book::ImageIndex::Item.new('sampleimg', 1)
1237
+ item = Book::Index::Item.new('sampleimg', 1)
551
1238
  item.instance_eval { @path = './images/chap1-sampleimg.png' }
552
1239
  item
553
1240
  end
554
1241
 
555
1242
  actual = compile_block(%Q(//indepimage[sampleimg][sample photo][scale=1.2, html::class="sample",latex::ignore=params]\n))
556
- assert_equal %Q(\\begin{reviewimage}%%sampleimg\n\\includegraphics[scale=1.2,ignore=params]{./images/chap1-sampleimg.png}\n\\reviewindepimagecaption{図: sample photo}\n\\end{reviewimage}\n), actual
1243
+ expected = <<-EOS
1244
+ \\begin{reviewimage}%%sampleimg
1245
+ \\reviewincludegraphics[scale=1.2,ignore=params]{./images/chap1-sampleimg.png}
1246
+ \\reviewindepimagecaption{図: sample photo}
1247
+ \\end{reviewimage}
1248
+ EOS
1249
+ assert_equal expected, actual
1250
+
1251
+ @book.config['pdfmaker']['use_original_image_size'] = true
1252
+ actual = compile_block(%Q(//indepimage[sampleimg][sample photo][scale=1.2, html::class="sample",latex::ignore=params]\n))
1253
+ assert_equal expected, actual
557
1254
  end
558
1255
 
559
1256
  def test_indepimage_without_caption_but_with_metric
560
1257
  def @chapter.image(_id)
561
- item = Book::ImageIndex::Item.new('sampleimg', 1)
1258
+ item = Book::Index::Item.new('sampleimg', 1)
562
1259
  item.instance_eval { @path = './images/chap1-sampleimg.png' }
563
1260
  item
564
1261
  end
565
1262
 
566
1263
  # FIXME: indepimage's caption should not be with a counter.
567
1264
  actual = compile_block("//indepimage[sampleimg][][scale=1.2]\n")
568
- assert_equal %Q(\\begin{reviewimage}%%sampleimg\n\\includegraphics[scale=1.2]{./images/chap1-sampleimg.png}\n\\end{reviewimage}\n), actual
1265
+ expected = <<-EOS
1266
+ \\begin{reviewimage}%%sampleimg
1267
+ \\reviewincludegraphics[scale=1.2]{./images/chap1-sampleimg.png}
1268
+ \\end{reviewimage}
1269
+ EOS
1270
+ assert_equal expected, actual
1271
+
1272
+ @book.config['pdfmaker']['use_original_image_size'] = true
1273
+ actual = compile_block("//indepimage[sampleimg][][scale=1.2]\n")
1274
+ assert_equal expected, actual
1275
+ end
1276
+
1277
+ def test_indepimage_nofile
1278
+ def @chapter.image(_id)
1279
+ item = Book::Index::Item.new('sample_img_nofile_', 1)
1280
+ item.instance_eval do
1281
+ def path
1282
+ nil
1283
+ end
1284
+ end
1285
+ item
1286
+ end
1287
+
1288
+ io = StringIO.new
1289
+ @builder.instance_eval{ @logger = ReVIEW::Logger.new(io) }
1290
+
1291
+ actual = compile_block("//indepimage[sample_img_nofile_][sample photo]\n")
1292
+ expected = <<-EOS
1293
+ \\begin{reviewdummyimage}
1294
+ --[[path = sample\\textunderscore{}img\\textunderscore{}nofile\\textunderscore{} (not exist)]]--
1295
+ \\reviewindepimagecaption{図: sample photo}
1296
+ \\end{reviewdummyimage}
1297
+ EOS
1298
+ assert_equal expected, actual
1299
+ assert_match(/WARN --: :1: image not bound: sample_img_nofile_/, io.string)
569
1300
  end
570
1301
 
571
1302
  def test_table
572
1303
  actual = compile_block("//table{\naaa\tbbb\n------------\nccc\tddd<>&\n//}\n")
573
- assert_equal "\\begin{reviewtable}{|l|l|}\n\\hline\n\\reviewth{aaa} & \\reviewth{bbb} \\\\ \\hline\nccc & ddd\\textless{}\\textgreater{}\\& \\\\ \\hline\n\\end{reviewtable}\n",
574
- actual
1304
+ expected = <<-EOS
1305
+ \\begin{reviewtable}{|l|l|}
1306
+ \\hline
1307
+ \\reviewth{aaa} & \\reviewth{bbb} \\\\ \\hline
1308
+ ccc & ddd\\textless{}\\textgreater{}\\& \\\\ \\hline
1309
+ \\end{reviewtable}
1310
+ EOS
1311
+ assert_equal expected, actual
1312
+
1313
+ actual = compile_block("//table[foo][FOO]{\naaa\tbbb\n------------\nccc\tddd<>&\n//}\n")
1314
+ expected = <<-EOS
1315
+ \\begin{table}%%foo
1316
+ \\reviewtablecaption{FOO}
1317
+ \\label{table:chap1:foo}
1318
+ \\begin{reviewtable}{|l|l|}
1319
+ \\hline
1320
+ \\reviewth{aaa} & \\reviewth{bbb} \\\\ \\hline
1321
+ ccc & ddd\\textless{}\\textgreater{}\\& \\\\ \\hline
1322
+ \\end{reviewtable}
1323
+ \\end{table}
1324
+ EOS
1325
+ assert_equal expected, actual
1326
+
1327
+ @config['caption_position']['table'] = 'bottom'
1328
+ actual = compile_block("//table[foo][FOO]{\naaa\tbbb\n------------\nccc\tddd<>&\n//}\n")
1329
+ expected = <<-EOS
1330
+ \\begin{table}%%foo
1331
+ \\begin{reviewtable}{|l|l|}
1332
+ \\hline
1333
+ \\reviewth{aaa} & \\reviewth{bbb} \\\\ \\hline
1334
+ ccc & ddd\\textless{}\\textgreater{}\\& \\\\ \\hline
1335
+ \\end{reviewtable}
1336
+ \\reviewtablecaption{FOO}
1337
+ \\label{table:chap1:foo}
1338
+ \\end{table}
1339
+ EOS
1340
+ assert_equal expected, actual
1341
+ end
1342
+
1343
+ def test_empty_table
1344
+ e = assert_raises(ReVIEW::ApplicationError) { compile_block("//table{\n//}\n") }
1345
+ assert_equal ':2: error: no rows in the table', e.message
1346
+
1347
+ e = assert_raises(ReVIEW::ApplicationError) { compile_block("//table{\n------------\n//}\n") }
1348
+ assert_equal ':3: error: no rows in the table', e.message
575
1349
  end
576
1350
 
577
1351
  def test_customize_cellwidth
578
1352
  actual = compile_block("//tsize[2,3,5]\n//table{\nA\tB\tC\n//}\n")
579
- assert_equal %Q(\\begin{reviewtable}{|p{2mm}|p{3mm}|p{5mm}|}\n\\hline\n\\reviewth{A} & B & C \\\\ \\hline\n\\end{reviewtable}\n), actual
1353
+ expected = <<-EOS
1354
+ \\begin{reviewtable}{|p{2mm}|p{3mm}|p{5mm}|}
1355
+ \\hline
1356
+ \\reviewth{A} & B & C \\\\ \\hline
1357
+ \\end{reviewtable}
1358
+ EOS
1359
+ assert_equal expected, actual
580
1360
 
581
1361
  actual = compile_block("//tsize[|latex,html|2,3,5]\n//table{\nA\tB\tC\n//}\n")
582
- assert_equal %Q(\\begin{reviewtable}{|p{2mm}|p{3mm}|p{5mm}|}\n\\hline\n\\reviewth{A} & B & C \\\\ \\hline\n\\end{reviewtable}\n), actual
1362
+ expected = <<-EOS
1363
+ \\begin{reviewtable}{|p{2mm}|p{3mm}|p{5mm}|}
1364
+ \\hline
1365
+ \\reviewth{A} & B & C \\\\ \\hline
1366
+ \\end{reviewtable}
1367
+ EOS
1368
+ assert_equal expected, actual
583
1369
 
584
1370
  actual = compile_block("//tsize[|html|2,3,5]\n//table{\nA\tB\tC\n//}\n")
585
- assert_equal %Q(\\begin{reviewtable}{|l|l|l|}\n\\hline\n\\reviewth{A} & B & C \\\\ \\hline\n\\end{reviewtable}\n), actual
1371
+ expected = <<-EOS
1372
+ \\begin{reviewtable}{|l|l|l|}
1373
+ \\hline
1374
+ \\reviewth{A} & B & C \\\\ \\hline
1375
+ \\end{reviewtable}
1376
+ EOS
1377
+ assert_equal expected, actual
586
1378
 
587
1379
  actual = compile_block("//tsize[|latex|2,3,5]\n//table{\nA\tB\tC\n//}\n")
588
- assert_equal %Q(\\begin{reviewtable}{|p{2mm}|p{3mm}|p{5mm}|}\n\\hline\n\\reviewth{A} & B & C \\\\ \\hline\n\\end{reviewtable}\n), actual
1380
+ expected = <<-EOS
1381
+ \\begin{reviewtable}{|p{2mm}|p{3mm}|p{5mm}|}
1382
+ \\hline
1383
+ \\reviewth{A} & B & C \\\\ \\hline
1384
+ \\end{reviewtable}
1385
+ EOS
1386
+ assert_equal expected, actual
589
1387
 
590
1388
  actual = compile_block("//tsize[|latex||p{5mm}|cr|]\n//table{\nA\tB\tC\n//}\n")
591
- assert_equal %Q(\\begin{reviewtable}{|p{5mm}|cr|}\n\\hline\n\\reviewth{A} & B & C \\\\ \\hline\n\\end{reviewtable}\n), actual
1389
+ expected = <<-EOS
1390
+ \\begin{reviewtable}{|p{5mm}|cr|}
1391
+ \\hline
1392
+ \\reviewth{A} & B & C \\\\ \\hline
1393
+ \\end{reviewtable}
1394
+ EOS
1395
+ assert_equal expected, actual
592
1396
  end
593
1397
 
594
1398
  def test_separate_tsize
@@ -602,44 +1406,197 @@ class LATEXBuidlerTest < Test::Unit::TestCase
602
1406
  assert_equal '{p},p{', actual
603
1407
  end
604
1408
 
605
- def test_break_tablecell
606
- actual = compile_block("//tsize[|latex||p{10mm}|cp{10mm}|]\n//table{\nA@<br>{}A\tB@<br>{}B\tC@<br>{}C\n//}\n")
607
- assert_equal %Q(\\begin{reviewtable}{|p{10mm}|cp{10mm}|}\n\\hline\n\\reviewth{A\\newline{}A} & \\shortstack[l]{B\\\\\nB} & C\\newline{}C \\\\ \\hline\n\\end{reviewtable}\n), actual
1409
+ def test_break_tablecell
1410
+ actual = compile_block("//tsize[|latex||p{10mm}|cp{10mm}|]\n//table{\nA@<br>{}A\tB@<br>{}B\tC@<br>{}C\n//}\n")
1411
+ expected = <<-EOS
1412
+ \\begin{reviewtable}{|p{10mm}|cp{10mm}|}
1413
+ \\hline
1414
+ \\reviewth{A\\newline{}A} & \\shortstack[l]{B\\\\
1415
+ B} & C\\newline{}C \\\\ \\hline
1416
+ \\end{reviewtable}
1417
+ EOS
1418
+ assert_equal expected, actual
1419
+
1420
+ actual = compile_block("//tsize[|latex||p{10mm}|cp{10mm}|]\n//table{\n1@<br>{}1\t2@<br>{}2\t3\n------------\nA@<br>{}A\tB@<br>{}B\tC@<br>{}C\n//}\n")
1421
+ expected = <<-EOS
1422
+ \\begin{reviewtable}{|p{10mm}|cp{10mm}|}
1423
+ \\hline
1424
+ \\reviewth{1\\newline{}1} & \\reviewth{\\shortstack[l]{2\\\\
1425
+ 2}} & \\reviewth{3} \\\\ \\hline
1426
+ A\\newline{}A & \\shortstack[l]{B\\\\
1427
+ B} & C\\newline{}C \\\\ \\hline
1428
+ \\end{reviewtable}
1429
+ EOS
1430
+ assert_equal expected, actual
1431
+ end
1432
+
1433
+ def test_emtable
1434
+ actual = compile_block("//emtable[foo]{\naaa\tbbb\n------------\nccc\tddd<>&\n//}\n//emtable{\naaa\tbbb\n------------\nccc\tddd<>&\n//}\n")
1435
+ expected = <<-EOS
1436
+ \\begin{table}%%
1437
+ \\reviewtablecaption*{foo}
1438
+ \\begin{reviewtable}{|l|l|}
1439
+ \\hline
1440
+ \\reviewth{aaa} & \\reviewth{bbb} \\\\ \\hline
1441
+ ccc & ddd\\textless{}\\textgreater{}\\& \\\\ \\hline
1442
+ \\end{reviewtable}
1443
+ \\end{table}
1444
+
1445
+ \\begin{reviewtable}{|l|l|}
1446
+ \\hline
1447
+ \\reviewth{aaa} & \\reviewth{bbb} \\\\ \\hline
1448
+ ccc & ddd\\textless{}\\textgreater{}\\& \\\\ \\hline
1449
+ \\end{reviewtable}
1450
+ EOS
1451
+ assert_equal expected, actual
1452
+
1453
+ @config['caption_position']['table'] = 'bottom'
1454
+ actual = compile_block("//emtable[foo]{\naaa\tbbb\n------------\nccc\tddd<>&\n//}\n//emtable{\naaa\tbbb\n------------\nccc\tddd<>&\n//}\n")
1455
+ expected = <<-EOS
1456
+ \\begin{table}%%
1457
+ \\begin{reviewtable}{|l|l|}
1458
+ \\hline
1459
+ \\reviewth{aaa} & \\reviewth{bbb} \\\\ \\hline
1460
+ ccc & ddd\\textless{}\\textgreater{}\\& \\\\ \\hline
1461
+ \\end{reviewtable}
1462
+ \\reviewtablecaption*{foo}
1463
+ \\end{table}
1464
+
1465
+ \\begin{reviewtable}{|l|l|}
1466
+ \\hline
1467
+ \\reviewth{aaa} & \\reviewth{bbb} \\\\ \\hline
1468
+ ccc & ddd\\textless{}\\textgreater{}\\& \\\\ \\hline
1469
+ \\end{reviewtable}
1470
+ EOS
1471
+ assert_equal expected, actual
1472
+ end
1473
+
1474
+ def test_imgtable
1475
+ def @chapter.image(_id)
1476
+ item = Book::Index::Item.new('sampleimg', 1, 'sample img')
1477
+ item.instance_eval { @path = './images/chap1-sampleimg.png' }
1478
+ item
1479
+ end
1480
+
1481
+ actual = compile_block("//imgtable[sampleimg][test for imgtable]{\n//}\n")
1482
+
1483
+ expected = <<-EOS
1484
+ \\begin{table}[h]%%sampleimg
1485
+ \\reviewimgtablecaption{test for imgtable}
1486
+ \\label{table:chap1:sampleimg}
1487
+ \\begin{reviewimage}%%sampleimg
1488
+ \\reviewincludegraphics[width=\\maxwidth]{./images/chap1-sampleimg.png}
1489
+ \\end{reviewimage}
1490
+ \\end{table}
1491
+ EOS
1492
+ assert_equal expected, actual
1493
+
1494
+ @book.config['pdfmaker']['use_original_image_size'] = true
1495
+ actual = compile_block("//imgtable[sampleimg][test for imgtable]{\n//}\n")
1496
+
1497
+ expected = <<-EOS
1498
+ \\begin{table}[h]%%sampleimg
1499
+ \\reviewimgtablecaption{test for imgtable}
1500
+ \\label{table:chap1:sampleimg}
1501
+ \\begin{reviewimage}%%sampleimg
1502
+ \\reviewincludegraphics[ ]{./images/chap1-sampleimg.png}
1503
+ \\end{reviewimage}
1504
+ \\end{table}
1505
+ EOS
1506
+ assert_equal expected, actual
1507
+
1508
+ actual = compile_block("//imgtable[sampleimg][test for imgtable][]{\n//}\n")
1509
+ assert_equal expected, actual
608
1510
 
609
- actual = compile_block("//tsize[|latex||p{10mm}|cp{10mm}|]\n//table{\n1@<br>{}1\t2@<br>{}2\t3\n------------\nA@<br>{}A\tB@<br>{}B\tC@<br>{}C\n//}\n")
610
- assert_equal %Q(\\begin{reviewtable}{|p{10mm}|cp{10mm}|}\n\\hline\n\\reviewth{1\\newline{}1} & \\reviewth{\\shortstack[l]{2\\\\\n2}} & \\reviewth{3} \\\\ \\hline\nA\\newline{}A & \\shortstack[l]{B\\\\\nB} & C\\newline{}C \\\\ \\hline\n\\end{reviewtable}\n), actual
611
- end
1511
+ @book.config['pdfmaker']['use_original_image_size'] = nil
1512
+ @config['caption_position']['table'] = 'bottom'
1513
+ actual = compile_block("//imgtable[sampleimg][test for imgtable]{\n//}\n")
612
1514
 
613
- def test_emtable
614
- actual = compile_block("//emtable[foo]{\naaa\tbbb\n------------\nccc\tddd<>&\n//}\n//emtable{\naaa\tbbb\n------------\nccc\tddd<>&\n//}\n")
615
- assert_equal "\\begin{table}%%\n\\reviewtablecaption*{foo}\n\\begin{reviewtable}{|l|l|}\n\\hline\n\\reviewth{aaa} & \\reviewth{bbb} \\\\ \\hline\nccc & ddd\\textless{}\\textgreater{}\\& \\\\ \\hline\n\\end{reviewtable}\n\\end{table}\n\n\\begin{reviewtable}{|l|l|}\n\\hline\n\\reviewth{aaa} & \\reviewth{bbb} \\\\ \\hline\nccc & ddd\\textless{}\\textgreater{}\\& \\\\ \\hline\n\\end{reviewtable}\n",
616
- actual
1515
+ expected = <<-EOS
1516
+ \\begin{table}[h]%%sampleimg
1517
+ \\label{table:chap1:sampleimg}
1518
+ \\begin{reviewimage}%%sampleimg
1519
+ \\reviewincludegraphics[width=\\maxwidth]{./images/chap1-sampleimg.png}
1520
+ \\end{reviewimage}
1521
+ \\reviewimgtablecaption{test for imgtable}
1522
+ \\end{table}
1523
+ EOS
1524
+ assert_equal expected, actual
617
1525
  end
618
1526
 
619
- def test_imgtable
1527
+ def test_imgtable_with_metrics
620
1528
  def @chapter.image(_id)
621
- item = Book::ImageIndex::Item.new('sampleimg', 1, 'sample img')
1529
+ item = Book::Index::Item.new('sampleimg', 1, 'sample img')
622
1530
  item.instance_eval { @path = './images/chap1-sampleimg.png' }
623
1531
  item
624
1532
  end
625
1533
 
626
- actual = compile_block("//imgtable[sampleimg][test for imgtable]{\n//}\n")
627
-
1534
+ actual = compile_block("//imgtable[sampleimg][test for imgtable][scale=1.2]{\n//}\n")
628
1535
  expected = <<-EOS
629
1536
  \\begin{table}[h]%%sampleimg
630
1537
  \\reviewimgtablecaption{test for imgtable}
631
1538
  \\label{table:chap1:sampleimg}
632
1539
  \\begin{reviewimage}%%sampleimg
633
- \\includegraphics[width=\\maxwidth]{./images/chap1-sampleimg.png}
1540
+ \\reviewincludegraphics[scale=1.2]{./images/chap1-sampleimg.png}
634
1541
  \\end{reviewimage}
635
1542
  \\end{table}
1543
+ EOS
1544
+ assert_equal expected, actual
1545
+
1546
+ @book.config['pdfmaker']['use_original_image_size'] = true
1547
+ actual = compile_block("//imgtable[sampleimg][test for imgtable][scale=1.2]{\n//}\n")
1548
+ assert_equal expected, actual
1549
+ end
1550
+
1551
+ def test_table_row_separator
1552
+ src = "//table{\n1\t2\t\t3 4| 5\n------------\na b\tc d |e\n//}\n"
1553
+ expected = <<-EOS
1554
+ \\begin{reviewtable}{|l|l|l|}
1555
+ \\hline
1556
+ \\reviewth{1} & \\reviewth{2} & \\reviewth{3 4\\textbar{} 5} \\\\ \\hline
1557
+ a b & c d \\textbar{}e & \\\\ \\hline
1558
+ \\end{reviewtable}
1559
+ EOS
1560
+ actual = compile_block(src)
1561
+ assert_equal expected, actual
1562
+
1563
+ @config['table_row_separator'] = 'singletab'
1564
+ actual = compile_block(src)
1565
+ expected = <<-EOS
1566
+ \\begin{reviewtable}{|l|l|l|l|}
1567
+ \\hline
1568
+ \\reviewth{1} & \\reviewth{2} & \\reviewth{} & \\reviewth{3 4\\textbar{} 5} \\\\ \\hline
1569
+ a b & c d \\textbar{}e & & \\\\ \\hline
1570
+ \\end{reviewtable}
1571
+ EOS
1572
+ assert_equal expected, actual
1573
+
1574
+ @config['table_row_separator'] = 'spaces'
1575
+ actual = compile_block(src)
1576
+ expected = <<-EOS
1577
+ \\begin{reviewtable}{|l|l|l|l|l|}
1578
+ \\hline
1579
+ \\reviewth{1} & \\reviewth{2} & \\reviewth{3} & \\reviewth{4\\textbar{}} & \\reviewth{5} \\\\ \\hline
1580
+ a & b & c & d & \\textbar{}e \\\\ \\hline
1581
+ \\end{reviewtable}
1582
+ EOS
1583
+ assert_equal expected, actual
1584
+
1585
+ @config['table_row_separator'] = 'verticalbar'
1586
+ actual = compile_block(src)
1587
+ expected = <<-EOS
1588
+ \\begin{reviewtable}{|l|l|}
1589
+ \\hline
1590
+ \\reviewth{1 2 3 4} & \\reviewth{5} \\\\ \\hline
1591
+ a b c d & e \\\\ \\hline
1592
+ \\end{reviewtable}
636
1593
  EOS
637
1594
  assert_equal expected, actual
638
1595
  end
639
1596
 
640
1597
  def test_bib
641
1598
  def @chapter.bibpaper(_id)
642
- Book::BibpaperIndex::Item.new('samplebib', 1, 'sample bib')
1599
+ Book::Index::Item.new('samplebib', 1, 'sample bib')
643
1600
  end
644
1601
 
645
1602
  assert_equal '\\reviewbibref{[1]}{bib:samplebib}', compile_inline('@<bib>{samplebib}')
@@ -647,20 +1604,43 @@ EOS
647
1604
 
648
1605
  def test_bibpaper
649
1606
  def @chapter.bibpaper(_id)
650
- Book::BibpaperIndex::Item.new('samplebib', 1, 'sample bib')
1607
+ Book::Index::Item.new('samplebib', 1, 'sample bib')
651
1608
  end
652
1609
 
653
1610
  actual = compile_block("//bibpaper[samplebib][sample bib @<b>{bold}]{\na\nb\n//}\n")
654
- assert_equal %Q([1] sample bib \\reviewbold{bold}\n\\label{bib:samplebib}\n\nab\n\n), actual
1611
+ expected = <<-EOS
1612
+ [1] sample bib \\reviewbold{bold}
1613
+ \\label{bib:samplebib}
1614
+
1615
+ ab
1616
+
1617
+ EOS
1618
+ assert_equal expected, actual
1619
+
1620
+ @book.config['join_lines_by_lang'] = true
1621
+ actual = compile_block("//bibpaper[samplebib][sample bib @<b>{bold}]{\na\nb\n//}\n")
1622
+ expected = <<-EOS
1623
+ [1] sample bib \\reviewbold{bold}
1624
+ \\label{bib:samplebib}
1625
+
1626
+ a b
1627
+
1628
+ EOS
1629
+ assert_equal expected, actual
655
1630
  end
656
1631
 
657
1632
  def test_bibpaper_without_body
658
1633
  def @chapter.bibpaper(_id)
659
- Book::BibpaperIndex::Item.new('samplebib', 1, 'sample bib')
1634
+ Book::Index::Item.new('samplebib', 1, 'sample bib')
660
1635
  end
661
1636
 
662
1637
  actual = compile_block("//bibpaper[samplebib][sample bib]\n")
663
- assert_equal %Q([1] sample bib\n\\label{bib:samplebib}\n\n), actual
1638
+ expected = <<-EOS
1639
+ [1] sample bib
1640
+ \\label{bib:samplebib}
1641
+
1642
+ EOS
1643
+ assert_equal expected, actual
664
1644
  end
665
1645
 
666
1646
  def column_helper(review)
@@ -778,8 +1758,56 @@ EOS
778
1758
  expected = <<-EOS
779
1759
 
780
1760
  \\begin{itemize}
781
- \\item AAA{-}AA
782
- \\item BBB{-}BB
1761
+ \\item AAA
1762
+ {-}AA
1763
+ \\item BBB
1764
+ {-}BB
1765
+ \\end{itemize}
1766
+ EOS
1767
+ actual = compile_block(src)
1768
+ assert_equal expected, actual
1769
+
1770
+ @book.config['join_lines_by_lang'] = true
1771
+ expected = <<-EOS
1772
+
1773
+ \\begin{itemize}
1774
+ \\item AAA {-}AA
1775
+ \\item BBB {-}BB
1776
+ \\end{itemize}
1777
+ EOS
1778
+ actual = compile_block(src)
1779
+ assert_equal expected, actual
1780
+ end
1781
+
1782
+ def test_cont_with_br
1783
+ src = <<-EOS
1784
+ * AAA@<br>{}
1785
+ -AA
1786
+ * BBB@<br>{}1@<br>{}
1787
+ -BB
1788
+ EOS
1789
+ expected = <<-EOS
1790
+
1791
+ \\begin{itemize}
1792
+ \\item AAA\\\\
1793
+ {-}AA
1794
+ \\item BBB\\\\
1795
+ 1\\\\
1796
+ {-}BB
1797
+ \\end{itemize}
1798
+ EOS
1799
+ actual = compile_block(src)
1800
+ assert_equal expected, actual
1801
+
1802
+ @book.config['join_lines_by_lang'] = true
1803
+ expected = <<-EOS
1804
+
1805
+ \\begin{itemize}
1806
+ \\item AAA\\\\
1807
+ {-}AA
1808
+ \\item BBB\\\\
1809
+ 1\\\\
1810
+ {-}BB
783
1811
  \\end{itemize}
784
1812
  EOS
785
1813
  actual = compile_block(src)
@@ -836,71 +1864,327 @@ EOS
836
1864
  assert_equal expected, actual
837
1865
  end
838
1866
 
839
- def test_ol
840
- src = <<-EOS
841
- 3. AAA
842
- 3. BBB
1867
+ def test_ol
1868
+ src = <<-EOS
1869
+ 3. AAA
1870
+ 3. BBB
1871
+ EOS
1872
+
1873
+ expected = <<-EOS
1874
+
1875
+ \\begin{enumerate}
1876
+ \\item AAA
1877
+ \\item BBB
1878
+ \\end{enumerate}
1879
+ EOS
1880
+ actual = compile_block(src)
1881
+ assert_equal expected, actual
1882
+ end
1883
+
1884
+ def test_ol_with_bracket
1885
+ src = <<-EOS
1886
+ 1. AAA
1887
+ 2. []BBB
1888
+ EOS
1889
+ expected = <<-EOS
1890
+
1891
+ \\begin{enumerate}
1892
+ \\item AAA
1893
+ \\item \\lbrack{}]BBB
1894
+ \\end{enumerate}
1895
+ EOS
1896
+ actual = compile_block(src)
1897
+ assert_equal expected, actual
1898
+ end
1899
+
1900
+ def test_major_blocks
1901
+ actual = compile_block("//note{\nA\n\nB\n//}\n//note[caption]{\nA\n//}")
1902
+ expected = <<-EOS
1903
+ \\begin{reviewnote}
1904
+
1905
+ A
1906
+
1907
+ B
1908
+
1909
+ \\end{reviewnote}
1910
+ \\begin{reviewnote}[caption]
1911
+
1912
+ A
1913
+
1914
+ \\end{reviewnote}
1915
+ EOS
1916
+ assert_equal expected, actual
1917
+
1918
+ actual = compile_block("//memo{\nA\n\nB\n//}\n//memo[caption]{\nA\n//}")
1919
+ expected = <<-EOS
1920
+ \\begin{reviewmemo}
1921
+
1922
+ A
1923
+
1924
+ B
1925
+
1926
+ \\end{reviewmemo}
1927
+ \\begin{reviewmemo}[caption]
1928
+
1929
+ A
1930
+
1931
+ \\end{reviewmemo}
1932
+ EOS
1933
+ assert_equal expected, actual
1934
+
1935
+ actual = compile_block("//info{\nA\n\nB\n//}\n//info[caption]{\nA\n//}")
1936
+ expected = <<-EOS
1937
+ \\begin{reviewinfo}
1938
+
1939
+ A
1940
+
1941
+ B
1942
+
1943
+ \\end{reviewinfo}
1944
+ \\begin{reviewinfo}[caption]
1945
+
1946
+ A
1947
+
1948
+ \\end{reviewinfo}
1949
+ EOS
1950
+ assert_equal expected, actual
1951
+
1952
+ actual = compile_block("//important{\nA\n\nB\n//}\n//important[caption]{\nA\n//}")
1953
+ expected = <<-EOS
1954
+ \\begin{reviewimportant}
1955
+
1956
+ A
1957
+
1958
+ B
1959
+
1960
+ \\end{reviewimportant}
1961
+ \\begin{reviewimportant}[caption]
1962
+
1963
+ A
1964
+
1965
+ \\end{reviewimportant}
1966
+ EOS
1967
+ assert_equal expected, actual
1968
+
1969
+ actual = compile_block("//caution{\nA\n\nB\n//}\n//caution[caption]{\nA\n//}")
1970
+ expected = <<-EOS
1971
+ \\begin{reviewcaution}
1972
+
1973
+ A
1974
+
1975
+ B
1976
+
1977
+ \\end{reviewcaution}
1978
+ \\begin{reviewcaution}[caption]
1979
+
1980
+ A
1981
+
1982
+ \\end{reviewcaution}
1983
+ EOS
1984
+ assert_equal expected, actual
1985
+
1986
+ actual = compile_block("//notice{\nA\n\nB\n//}\n//notice[caption]{\nA\n//}")
1987
+ expected = <<-EOS
1988
+ \\begin{reviewnotice}
1989
+
1990
+ A
1991
+
1992
+ B
1993
+
1994
+ \\end{reviewnotice}
1995
+ \\begin{reviewnotice}[caption]
1996
+
1997
+ A
1998
+
1999
+ \\end{reviewnotice}
2000
+ EOS
2001
+ assert_equal expected, actual
2002
+
2003
+ actual = compile_block("//warning{\nA\n\nB\n//}\n//warning[caption]{\nA\n//}")
2004
+ expected = <<-EOS
2005
+ \\begin{reviewwarning}
2006
+
2007
+ A
2008
+
2009
+ B
2010
+
2011
+ \\end{reviewwarning}
2012
+ \\begin{reviewwarning}[caption]
2013
+
2014
+ A
2015
+
2016
+ \\end{reviewwarning}
2017
+ EOS
2018
+ assert_equal expected, actual
2019
+
2020
+ actual = compile_block("//tip{\nA\n\nB\n//}\n//tip[caption]{\nA\n//}")
2021
+ expected = <<-EOS
2022
+ \\begin{reviewtip}
2023
+
2024
+ A
2025
+
2026
+ B
2027
+
2028
+ \\end{reviewtip}
2029
+ \\begin{reviewtip}[caption]
2030
+
2031
+ A
2032
+
2033
+ \\end{reviewtip}
2034
+ EOS
2035
+ assert_equal expected, actual
2036
+ end
2037
+
2038
+ def test_minicolumn_blocks
2039
+ %w[note memo tip info warning important caution notice].each do |type|
2040
+ src = <<-EOS
2041
+ //#{type}[#{type}1]{
2042
+
2043
+ //}
2044
+
2045
+ //#{type}[#{type}2]{
2046
+ //}
2047
+ EOS
2048
+
2049
+ expected = <<-EOS
2050
+ \\begin{review#{type}}[#{type}1]
2051
+ \\end{review#{type}}
2052
+ \\begin{review#{type}}[#{type}2]
2053
+ \\end{review#{type}}
2054
+ EOS
2055
+ assert_equal expected, compile_block(src)
2056
+
2057
+ src = <<-EOS
2058
+ //#{type}[#{type}2]{
2059
+
2060
+ //}
2061
+
2062
+ //#{type}[#{type}3]{
2063
+
2064
+ //}
2065
+
2066
+ //#{type}[#{type}4]{
2067
+
2068
+ //}
2069
+
2070
+ //#{type}[#{type}5]{
2071
+
2072
+ //}
2073
+
2074
+ //#{type}[#{type}6]{
2075
+
2076
+ //}
2077
+ EOS
2078
+
2079
+ expected = <<-EOS
2080
+ \\begin{review#{type}}[#{type}2]
2081
+ \\end{review#{type}}
2082
+ \\begin{review#{type}}[#{type}3]
2083
+ \\end{review#{type}}
2084
+ \\begin{review#{type}}[#{type}4]
2085
+ \\end{review#{type}}
2086
+ \\begin{review#{type}}[#{type}5]
2087
+ \\end{review#{type}}
2088
+ \\begin{review#{type}}[#{type}6]
2089
+ \\end{review#{type}}
2090
+ EOS
2091
+ assert_equal expected, compile_block(src)
2092
+
2093
+ src = <<-EOS
2094
+ //#{type}{
2095
+
2096
+ * A
2097
+
2098
+ 1. B
2099
+
2100
+ //}
2101
+
2102
+ //#{type}[OMITEND1]{
2103
+
2104
+ //emlist{
2105
+ LIST
2106
+ //}
2107
+
2108
+ //}
2109
+ //#{type}[OMITEND2]{
2110
+ //}
843
2111
  EOS
844
2112
 
845
- expected = <<-EOS
2113
+ expected = <<-EOS
2114
+ \\begin{review#{type}}
2115
+
2116
+ \\begin{itemize}
2117
+ \\item A
2118
+ \\end{itemize}
846
2119
 
847
2120
  \\begin{enumerate}
848
- \\item AAA
849
- \\item BBB
2121
+ \\item B
850
2122
  \\end{enumerate}
2123
+
2124
+ \\end{review#{type}}
2125
+ \\begin{review#{type}}[OMITEND1]
2126
+
2127
+ \\begin{reviewlistblock}
2128
+ \\begin{reviewemlist}
2129
+ LIST
2130
+ \\end{reviewemlist}
2131
+ \\end{reviewlistblock}
2132
+
2133
+ \\end{review#{type}}
2134
+ \\begin{review#{type}}[OMITEND2]
2135
+ \\end{review#{type}}
851
2136
  EOS
852
- actual = compile_block(src)
853
- assert_equal expected, actual
2137
+ assert_equal expected, compile_block(src)
2138
+ end
854
2139
  end
855
2140
 
856
- def test_ol_with_bracket
857
- src = <<-EOS
858
- 1. AAA
859
- 2. []BBB
860
- EOS
861
- expected = <<-EOS
2141
+ def test_minicolumn_blocks_nest_error1
2142
+ %w[note memo tip info warning important caution notice].each do |type|
2143
+ @builder.doc_status.clear
2144
+ src = <<-EOS
2145
+ //#{type}{
862
2146
 
863
- \\begin{enumerate}
864
- \\item AAA
865
- \\item \\lbrack{}]BBB
866
- \\end{enumerate}
2147
+ //#{type}{
2148
+ //}
2149
+
2150
+ //}
867
2151
  EOS
868
- actual = compile_block(src)
869
- assert_equal expected, actual
2152
+ e = assert_raises(ReVIEW::ApplicationError) { compile_block(src) }
2153
+ assert_match(/minicolumn cannot be nested:/, e.message)
2154
+ end
870
2155
  end
871
2156
 
872
- def test_major_blocks
873
- actual = compile_block("//note{\nA\n\nB\n//}\n//note[caption]{\nA\n//}")
874
- expected = %Q(\\begin{reviewnote}\nA\n\nB\n\\end{reviewnote}\n\\begin{reviewnote}[caption]\nA\n\\end{reviewnote}\n)
875
- assert_equal expected, actual
876
-
877
- actual = compile_block("//memo{\nA\n\nB\n//}\n//memo[caption]{\nA\n//}")
878
- expected = %Q(\\begin{reviewmemo}\nA\n\nB\n\\end{reviewmemo}\n\\begin{reviewmemo}[caption]\nA\n\\end{reviewmemo}\n)
879
- assert_equal expected, actual
2157
+ def test_minicolumn_blocks_nest_error2
2158
+ %w[note memo tip info warning important caution notice].each do |type|
2159
+ @builder.doc_status.clear
2160
+ src = <<-EOS
2161
+ //#{type}{
880
2162
 
881
- actual = compile_block("//info{\nA\n\nB\n//}\n//info[caption]{\nA\n//}")
882
- expected = %Q(\\begin{reviewinfo}\nA\n\nB\n\\end{reviewinfo}\n\\begin{reviewinfo}[caption]\nA\n\\end{reviewinfo}\n)
883
- assert_equal expected, actual
2163
+ //#{type}{
884
2164
 
885
- actual = compile_block("//important{\nA\n\nB\n//}\n//important[caption]{\nA\n//}")
886
- expected = %Q(\\begin{reviewimportant}\nA\n\nB\n\\end{reviewimportant}\n\\begin{reviewimportant}[caption]\nA\n\\end{reviewimportant}\n)
887
- assert_equal expected, actual
2165
+ //}
888
2166
 
889
- actual = compile_block("//caution{\nA\n\nB\n//}\n//caution[caption]{\nA\n//}")
890
- expected = %Q(\\begin{reviewcaution}\nA\n\nB\n\\end{reviewcaution}\n\\begin{reviewcaution}[caption]\nA\n\\end{reviewcaution}\n)
891
- assert_equal expected, actual
2167
+ //}
2168
+ EOS
2169
+ e = assert_raises(ReVIEW::ApplicationError) { compile_block(src) }
2170
+ assert_match(/minicolumn cannot be nested:/, e.message)
2171
+ end
2172
+ end
892
2173
 
893
- actual = compile_block("//notice{\nA\n\nB\n//}\n//notice[caption]{\nA\n//}")
894
- expected = %Q(\\begin{reviewnotice}\nA\n\nB\n\\end{reviewnotice}\n\\begin{reviewnotice}[caption]\nA\n\\end{reviewnotice}\n)
895
- assert_equal expected, actual
2174
+ def test_minicolumn_blocks_nest_error3
2175
+ %w[memo tip info warning important caution notice].each do |type|
2176
+ @builder.doc_status.clear
2177
+ src = <<-EOS
2178
+ //#{type}{
896
2179
 
897
- actual = compile_block("//warning{\nA\n\nB\n//}\n//warning[caption]{\nA\n//}")
898
- expected = %Q(\\begin{reviewwarning}\nA\n\nB\n\\end{reviewwarning}\n\\begin{reviewwarning}[caption]\nA\n\\end{reviewwarning}\n)
899
- assert_equal expected, actual
2180
+ //note{
2181
+ //}
900
2182
 
901
- actual = compile_block("//tip{\nA\n\nB\n//}\n//tip[caption]{\nA\n//}")
902
- expected = %Q(\\begin{reviewtip}\nA\n\nB\n\\end{reviewtip}\n\\begin{reviewtip}[caption]\nA\n\\end{reviewtip}\n)
903
- assert_equal expected, actual
2183
+ //}
2184
+ EOS
2185
+ e = assert_raises(ReVIEW::ApplicationError) { compile_block(src) }
2186
+ assert_match(/minicolumn cannot be nested:/, e.message)
2187
+ end
904
2188
  end
905
2189
 
906
2190
  def test_inline_raw0
@@ -934,24 +2218,24 @@ EOS
934
2218
 
935
2219
  def test_inline_imgref
936
2220
  def @chapter.image(_id)
937
- item = Book::ImageIndex::Item.new('sampleimg', 1, 'sample photo')
2221
+ item = Book::Index::Item.new('sampleimg', 1, 'sample photo')
938
2222
  item.instance_eval { @path = './images/chap1-sampleimg.png' }
939
2223
  item
940
2224
  end
941
2225
 
942
- actual = compile_block "@<imgref>{sampleimg}\n"
2226
+ actual = compile_block("@<imgref>{sampleimg}\n")
943
2227
  expected = "\n\\reviewimageref{1.1}{image:chap1:sampleimg}「sample photo」\n"
944
2228
  assert_equal expected, actual
945
2229
  end
946
2230
 
947
2231
  def test_inline_imgref2
948
2232
  def @chapter.image(_id)
949
- item = Book::NumberlessImageIndex::Item.new('sampleimg', 1)
2233
+ item = Book::Index::Item.new('sampleimg', 1)
950
2234
  item.instance_eval { @path = './images/chap1-sampleimg.png' }
951
2235
  item
952
2236
  end
953
2237
 
954
- actual = compile_block "@<imgref>{sampleimg}\n"
2238
+ actual = compile_block("@<imgref>{sampleimg}\n")
955
2239
  expected = "\n\\reviewimageref{1.1}{image:chap1:sampleimg}\n"
956
2240
  assert_equal expected, actual
957
2241
  end
@@ -1035,23 +2319,23 @@ EOB
1035
2319
  foo bar"\\reviewbackslash{}\\textless{}\\textgreater{}\\textunderscore{}@\\textless{}b\\textgreater{}\\{BAZ\\} \\reviewbold{bar"\\reviewbackslash{}\\textless{}\\textgreater{}\\textunderscore{}@\\textless{}b\\textgreater{}\\{BAZ\\}} [missing word: N]
1036
2320
  EOS
1037
2321
  assert_equal expected, actual
1038
- assert_match(/WARN -- : :1: word not bound: N/, io.string)
2322
+ assert_match(/WARN --: :1: word not bound: N/, io.string)
1039
2323
  end
1040
2324
  end
1041
2325
 
1042
2326
  def test_inline_unknown
1043
- e = assert_raises(ReVIEW::ApplicationError) { compile_block "@<img>{n}\n" }
2327
+ e = assert_raises(ReVIEW::ApplicationError) { compile_block("@<img>{n}\n") }
1044
2328
  assert_equal ':1: error: unknown image: n', e.message
1045
- e = assert_raises(ReVIEW::ApplicationError) { compile_block "@<fn>{n}\n" }
2329
+ e = assert_raises(ReVIEW::ApplicationError) { compile_block("@<fn>{n}\n") }
1046
2330
  assert_equal ':1: error: unknown footnote: n', e.message
1047
- e = assert_raises(ReVIEW::ApplicationError) { compile_block "@<hd>{n}\n" }
2331
+ e = assert_raises(ReVIEW::ApplicationError) { compile_block("@<hd>{n}\n") }
1048
2332
  assert_equal ':1: error: unknown headline: n', e.message
1049
2333
  %w[list table column].each do |name|
1050
- e = assert_raises(ReVIEW::ApplicationError) { compile_block "@<#{name}>{n}\n" }
2334
+ e = assert_raises(ReVIEW::ApplicationError) { compile_block("@<#{name}>{n}\n") }
1051
2335
  assert_equal ":1: error: unknown #{name}: n", e.message
1052
2336
  end
1053
2337
  %w[chap chapref title].each do |name|
1054
- e = assert_raises(ReVIEW::ApplicationError) { compile_block "@<#{name}>{n}\n" }
2338
+ e = assert_raises(ReVIEW::ApplicationError) { compile_block("@<#{name}>{n}\n") }
1055
2339
  assert_equal ':1: error: key not found: "n"', e.message
1056
2340
  end
1057
2341
  end
@@ -1118,7 +2402,7 @@ EOS
1118
2402
  end
1119
2403
 
1120
2404
  def @chapter.image(_id)
1121
- item = Book::NumberlessImageIndex::Item.new('sampleimg', 1)
2405
+ item = Book::Index::Item.new('sampleimg', 1)
1122
2406
  item.instance_eval { @path = './images/chap1-sampleimg.png' }
1123
2407
  item
1124
2408
  end
@@ -1133,7 +2417,7 @@ EOS
1133
2417
  \\reviewimageref{A.1}{image:chap1:sampleimg}
1134
2418
 
1135
2419
  \\begin{reviewimage}%%sampleimg
1136
- \\includegraphics[width=\\maxwidth]{./images/chap1-sampleimg.png}
2420
+ \\reviewincludegraphics[width=\\maxwidth]{./images/chap1-sampleimg.png}
1137
2421
  \\reviewimagecaption{FOO}
1138
2422
  \\label{image:chap1:sampleimg}
1139
2423
  \\end{reviewimage}
@@ -1179,5 +2463,344 @@ e=mc^2
1179
2463
  EOS
1180
2464
  actual = compile_block(src)
1181
2465
  assert_equal expected, actual
2466
+
2467
+ @config['caption_position']['equation'] = 'bottom'
2468
+ expected = <<-EOS
2469
+
2470
+ \\reviewequationref{1.1}
2471
+
2472
+ \\begin{reviewequationblock}
2473
+ \\begin{equation*}
2474
+ e=mc^2
2475
+ \\end{equation*}
2476
+ \\reviewequationcaption{式1.1: The Equivalence of Mass \\reviewit{and} Energy}
2477
+ \\end{reviewequationblock}
2478
+ EOS
2479
+ actual = compile_block(src)
2480
+ assert_equal expected, actual
2481
+ end
2482
+
2483
+ def test_nest_error_close1
2484
+ src = <<-EOS
2485
+ //beginchild
2486
+ EOS
2487
+ e = assert_raises(ReVIEW::ApplicationError) { compile_block(src) }
2488
+ assert_equal ":1: error: //beginchild is shown, but previous element isn't ul, ol, or dl", e.message
2489
+ end
2490
+
2491
+ def test_nest_error_close2
2492
+ src = <<-EOS
2493
+ * foo
2494
+
2495
+ //beginchild
2496
+
2497
+ 1. foo
2498
+
2499
+ //beginchild
2500
+
2501
+ : foo
2502
+
2503
+ //beginchild
2504
+ EOS
2505
+ e = assert_raises(ReVIEW::ApplicationError) { compile_block(src) }
2506
+ assert_equal ':12: error: //beginchild of dl,ol,ul misses //endchild', e.message
2507
+ end
2508
+
2509
+ def test_nest_error_close3
2510
+ src = <<-EOS
2511
+ * foo
2512
+
2513
+ //beginchild
2514
+
2515
+ 1. foo
2516
+
2517
+ //beginchild
2518
+
2519
+ : foo
2520
+
2521
+ //beginchild
2522
+
2523
+ //endchild
2524
+ EOS
2525
+ e = assert_raises(ReVIEW::ApplicationError) { compile_block(src) }
2526
+ assert_equal ':14: error: //beginchild of ol,ul misses //endchild', e.message
2527
+ end
2528
+
2529
+ def test_nest_ul
2530
+ src = <<-EOS
2531
+ * UL1
2532
+
2533
+ //beginchild
2534
+
2535
+ 1. UL1-OL1
2536
+ 2. UL1-OL2
2537
+
2538
+ * UL1-UL1
2539
+ * UL1-UL2
2540
+
2541
+ : UL1-DL1
2542
+ UL1-DD1
2543
+ : UL1-DL2
2544
+ UL1-DD2
2545
+
2546
+ //endchild
2547
+
2548
+ * UL2
2549
+
2550
+ //beginchild
2551
+
2552
+ UL2-PARA
2553
+
2554
+ //endchild
2555
+ EOS
2556
+
2557
+ expected = <<-EOS
2558
+
2559
+ \\begin{itemize}
2560
+ \\item UL1
2561
+
2562
+
2563
+ \\begin{enumerate}
2564
+ \\item UL1{-}OL1
2565
+ \\item UL1{-}OL2
2566
+ \\end{enumerate}
2567
+
2568
+ \\begin{itemize}
2569
+ \\item UL1{-}UL1
2570
+ \\item UL1{-}UL2
2571
+ \\end{itemize}
2572
+
2573
+ \\begin{description}
2574
+ \\item[UL1{-}DL1] \\mbox{} \\\\
2575
+ UL1{-}DD1
2576
+ \\item[UL1{-}DL2] \\mbox{} \\\\
2577
+ UL1{-}DD2
2578
+ \\end{description}
2579
+
2580
+
2581
+ \\item UL2
2582
+
2583
+
2584
+ UL2{-}PARA
2585
+
2586
+ \\end{itemize}
2587
+ EOS
2588
+
2589
+ actual = compile_block(src)
2590
+ assert_equal expected, actual
2591
+ end
2592
+
2593
+ def test_nest_ol
2594
+ src = <<-EOS
2595
+ 1. OL1
2596
+
2597
+ //beginchild
2598
+
2599
+ 1. OL1-OL1
2600
+ 2. OL1-OL2
2601
+
2602
+ * OL1-UL1
2603
+ * OL1-UL2
2604
+
2605
+ : OL1-DL1
2606
+ OL1-DD1
2607
+ : OL1-DL2
2608
+ OL1-DD2
2609
+
2610
+ //endchild
2611
+
2612
+ 2. OL2
2613
+
2614
+ //beginchild
2615
+
2616
+ OL2-PARA
2617
+
2618
+ //endchild
2619
+ EOS
2620
+
2621
+ expected = <<-EOS
2622
+
2623
+ \\begin{enumerate}
2624
+ \\item OL1
2625
+
2626
+
2627
+ \\begin{enumerate}
2628
+ \\item OL1{-}OL1
2629
+ \\item OL1{-}OL2
2630
+ \\end{enumerate}
2631
+
2632
+ \\begin{itemize}
2633
+ \\item OL1{-}UL1
2634
+ \\item OL1{-}UL2
2635
+ \\end{itemize}
2636
+
2637
+ \\begin{description}
2638
+ \\item[OL1{-}DL1] \\mbox{} \\\\
2639
+ OL1{-}DD1
2640
+ \\item[OL1{-}DL2] \\mbox{} \\\\
2641
+ OL1{-}DD2
2642
+ \\end{description}
2643
+
2644
+
2645
+ \\item OL2
2646
+
2647
+
2648
+ OL2{-}PARA
2649
+
2650
+ \\end{enumerate}
2651
+ EOS
2652
+
2653
+ actual = compile_block(src)
2654
+ assert_equal expected, actual
2655
+ end
2656
+
2657
+ def test_nest_dl
2658
+ src = <<-EOS
2659
+ : DL1
2660
+
2661
+ //beginchild
2662
+
2663
+ 1. DL1-OL1
2664
+ 2. DL1-OL2
2665
+
2666
+ * DL1-UL1
2667
+ * DL1-UL2
2668
+
2669
+ : DL1-DL1
2670
+ DL1-DD1
2671
+ : DL1-DL2
2672
+ DL1-DD2
2673
+
2674
+ //endchild
2675
+
2676
+ : DL2
2677
+ DD2
2678
+
2679
+ //beginchild
2680
+
2681
+ * DD2-UL1
2682
+ * DD2-UL2
2683
+
2684
+ DD2-PARA
2685
+
2686
+ //endchild
2687
+ EOS
2688
+
2689
+ expected = <<-EOS
2690
+
2691
+ \\begin{description}
2692
+ \\item[DL1] \\mbox{} \\\\
2693
+
2694
+
2695
+
2696
+ \\begin{enumerate}
2697
+ \\item DL1{-}OL1
2698
+ \\item DL1{-}OL2
2699
+ \\end{enumerate}
2700
+
2701
+ \\begin{itemize}
2702
+ \\item DL1{-}UL1
2703
+ \\item DL1{-}UL2
2704
+ \\end{itemize}
2705
+
2706
+ \\begin{description}
2707
+ \\item[DL1{-}DL1] \\mbox{} \\\\
2708
+ DL1{-}DD1
2709
+ \\item[DL1{-}DL2] \\mbox{} \\\\
2710
+ DL1{-}DD2
2711
+ \\end{description}
2712
+
2713
+
2714
+ \\item[DL2] \\mbox{} \\\\
2715
+ DD2
2716
+
2717
+
2718
+ \\begin{itemize}
2719
+ \\item DD2{-}UL1
2720
+ \\item DD2{-}UL2
2721
+ \\end{itemize}
2722
+
2723
+ DD2{-}PARA
2724
+
2725
+ \\end{description}
2726
+ EOS
2727
+
2728
+ actual = compile_block(src)
2729
+ assert_equal expected, actual
2730
+ end
2731
+
2732
+ def test_nest_multi
2733
+ src = <<-EOS
2734
+ 1. OL1
2735
+
2736
+ //beginchild
2737
+
2738
+ 1. OL1-OL1
2739
+
2740
+ //beginchild
2741
+
2742
+ * OL1-OL1-UL1
2743
+
2744
+ OL1-OL1-PARA
2745
+
2746
+ //endchild
2747
+
2748
+ 2. OL1-OL2
2749
+
2750
+ * OL1-UL1
2751
+
2752
+ //beginchild
2753
+
2754
+ : OL1-UL1-DL1
2755
+ OL1-UL1-DD1
2756
+
2757
+ OL1-UL1-PARA
2758
+
2759
+ //endchild
2760
+
2761
+ * OL1-UL2
2762
+
2763
+ //endchild
2764
+ EOS
2765
+ expected = <<-EOS
2766
+
2767
+ \\begin{enumerate}
2768
+ \\item OL1
2769
+
2770
+
2771
+ \\begin{enumerate}
2772
+ \\item OL1{-}OL1
2773
+
2774
+
2775
+ \\begin{itemize}
2776
+ \\item OL1{-}OL1{-}UL1
2777
+ \\end{itemize}
2778
+
2779
+ OL1{-}OL1{-}PARA
2780
+
2781
+
2782
+ \\item OL1{-}OL2
2783
+ \\end{enumerate}
2784
+
2785
+ \\begin{itemize}
2786
+ \\item OL1{-}UL1
2787
+
2788
+
2789
+ \\begin{description}
2790
+ \\item[OL1{-}UL1{-}DL1] \\mbox{} \\\\
2791
+ OL1{-}UL1{-}DD1
2792
+ \\end{description}
2793
+
2794
+ OL1{-}UL1{-}PARA
2795
+
2796
+
2797
+ \\item OL1{-}UL2
2798
+ \\end{itemize}
2799
+
2800
+ \\end{enumerate}
2801
+ EOS
2802
+
2803
+ actual = compile_block(src)
2804
+ assert_equal expected, actual
1182
2805
  end
1183
2806
  end