review 2.3.0 → 2.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (160) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +90 -66
  3. data/.travis.yml +1 -1
  4. data/Gemfile +0 -1
  5. data/NEWS.ja.md +82 -0
  6. data/NEWS.md +83 -0
  7. data/README.md +5 -3
  8. data/Rakefile +8 -8
  9. data/bin/review +1 -5
  10. data/bin/review-catalog-converter +22 -27
  11. data/bin/review-check +36 -43
  12. data/bin/review-checkdep +10 -15
  13. data/bin/review-compile +37 -55
  14. data/bin/review-epubmaker +4 -5
  15. data/bin/review-index +21 -29
  16. data/bin/review-init +26 -37
  17. data/bin/review-pdfmaker +0 -2
  18. data/bin/review-preproc +25 -45
  19. data/bin/review-validate +19 -18
  20. data/bin/review-vol +15 -27
  21. data/doc/config.yml.sample +5 -2
  22. data/doc/format.ja.md +20 -1
  23. data/doc/format.md +21 -5
  24. data/doc/images/review-generate.png +0 -0
  25. data/lib/epubmaker.rb +1 -3
  26. data/lib/epubmaker/content.rb +24 -27
  27. data/lib/epubmaker/epubcommon.rb +135 -148
  28. data/lib/epubmaker/epubv2.rb +39 -46
  29. data/lib/epubmaker/epubv3.rb +93 -103
  30. data/lib/epubmaker/producer.rb +138 -151
  31. data/lib/epubmaker/zip_exporter.rb +21 -26
  32. data/lib/review/book.rb +3 -6
  33. data/lib/review/book/base.rb +78 -103
  34. data/lib/review/book/chapter.rb +36 -40
  35. data/lib/review/book/compilable.rb +28 -31
  36. data/lib/review/book/image_finder.rb +6 -13
  37. data/lib/review/book/index.rb +100 -121
  38. data/lib/review/book/page_metric.rb +2 -7
  39. data/lib/review/book/part.rb +18 -20
  40. data/lib/review/book/volume.rb +9 -13
  41. data/lib/review/builder.rb +81 -116
  42. data/lib/review/catalog.rb +15 -19
  43. data/lib/review/compiler.rb +64 -83
  44. data/lib/review/configure.rb +87 -97
  45. data/lib/review/converter.rb +2 -7
  46. data/lib/review/epubbuilder.rb +1 -3
  47. data/lib/review/epubmaker.rb +213 -205
  48. data/lib/review/exception.rb +2 -4
  49. data/lib/review/extentions.rb +0 -1
  50. data/lib/review/extentions/hash.rb +2 -2
  51. data/lib/review/extentions/string.rb +5 -30
  52. data/lib/review/htmlbuilder.rb +320 -375
  53. data/lib/review/htmltoc.rb +4 -7
  54. data/lib/review/htmlutils.rb +29 -32
  55. data/lib/review/i18n.rb +33 -44
  56. data/lib/review/i18n.yml +3 -3
  57. data/lib/review/idgxmlbuilder.rb +309 -345
  58. data/lib/review/latexbuilder.rb +175 -212
  59. data/lib/review/latexindex.rb +2 -8
  60. data/lib/review/latexutils.rb +33 -43
  61. data/lib/review/lineinput.rb +1 -1
  62. data/lib/review/logger.rb +21 -0
  63. data/lib/review/makerhelper.rb +1 -4
  64. data/lib/review/markdownbuilder.rb +44 -53
  65. data/lib/review/md2inaobuilder.rb +6 -12
  66. data/lib/review/pdfmaker.rb +143 -173
  67. data/lib/review/preprocessor.rb +64 -101
  68. data/lib/review/rstbuilder.rb +126 -158
  69. data/lib/review/sec_counter.rb +18 -34
  70. data/lib/review/template.rb +4 -5
  71. data/lib/review/textbuilder.rb +2 -3
  72. data/lib/review/textutils.rb +7 -13
  73. data/lib/review/tocparser.rb +31 -56
  74. data/lib/review/tocprinter.rb +26 -52
  75. data/lib/review/topbuilder.rb +219 -247
  76. data/lib/review/unfold.rb +15 -24
  77. data/lib/review/version.rb +1 -1
  78. data/lib/review/webmaker.rb +75 -99
  79. data/lib/review/webtocprinter.rb +15 -20
  80. data/lib/review/yamlloader.rb +13 -15
  81. data/review.gemspec +20 -22
  82. data/templates/latex/layout.tex.erb +2 -2
  83. data/templates/opf/epubv2.opf.erb +7 -7
  84. data/templates/opf/epubv3.opf.erb +7 -7
  85. data/templates/web/html/layout-html5.html.erb +2 -2
  86. data/test/assets/black.eps +280 -0
  87. data/test/assets/fit.png +0 -0
  88. data/test/assets/large.gif +0 -0
  89. data/test/assets/large.jpg +0 -0
  90. data/test/assets/large.png +0 -0
  91. data/test/assets/large.svg +65 -0
  92. data/test/assets/test_template.tex +1 -1
  93. data/test/book_test_helper.rb +2 -2
  94. data/test/run_test.rb +4 -4
  95. data/test/sample-book/src/Rakefile +21 -22
  96. data/test/syntax-book/Gemfile +4 -0
  97. data/test/syntax-book/Rakefile +72 -0
  98. data/test/syntax-book/appA.re +22 -0
  99. data/test/syntax-book/bib.re +6 -0
  100. data/test/syntax-book/catalog.yml +15 -0
  101. data/test/syntax-book/ch01.re +136 -0
  102. data/test/syntax-book/ch02.re +351 -0
  103. data/test/syntax-book/ch03.re +82 -0
  104. data/test/syntax-book/config.yml +35 -0
  105. data/test/syntax-book/images/ball.png +0 -0
  106. data/test/syntax-book/images/cover.jpg +0 -0
  107. data/test/syntax-book/images/fractal.png +0 -0
  108. data/test/syntax-book/images/img3-1.png +0 -0
  109. data/test/syntax-book/images/inlineicon.jpg +0 -0
  110. data/test/syntax-book/images/logic.png +0 -0
  111. data/test/syntax-book/images/logic2.png +0 -0
  112. data/test/syntax-book/images/puzzle.jpg +0 -0
  113. data/test/syntax-book/images/table.jpg +0 -0
  114. data/test/syntax-book/part2.re +6 -0
  115. data/test/syntax-book/pre01.re +26 -0
  116. data/test/syntax-book/review-ext.rb +14 -0
  117. data/test/syntax-book/sty/jumoline.sty +310 -0
  118. data/test/syntax-book/sty/reviewmacro.sty +39 -0
  119. data/test/syntax-book/style.css +494 -0
  120. data/test/syntax-book/syntax.dic +2 -0
  121. data/test/test_book.rb +106 -111
  122. data/test/test_book_chapter.rb +21 -22
  123. data/test/test_book_part.rb +3 -5
  124. data/test/test_builder.rb +11 -22
  125. data/test/test_catalog.rb +17 -18
  126. data/test/test_catalog_converter_cmd.rb +5 -5
  127. data/test/test_compiler.rb +18 -16
  128. data/test/test_configure.rb +35 -38
  129. data/test/test_converter.rb +3 -4
  130. data/test/test_epub3maker.rb +136 -117
  131. data/test/test_epubmaker.rb +107 -114
  132. data/test/test_epubmaker_cmd.rb +2 -4
  133. data/test/test_extentions_hash.rb +32 -33
  134. data/test/test_helper.rb +9 -11
  135. data/test/test_htmlbuilder.rb +454 -420
  136. data/test/test_htmltoc.rb +8 -12
  137. data/test/test_htmlutils.rb +0 -2
  138. data/test/test_i18n.rb +159 -150
  139. data/test/test_idgxmlbuilder.rb +190 -197
  140. data/test/test_image_finder.rb +21 -22
  141. data/test/test_index.rb +24 -29
  142. data/test/test_latexbuilder.rb +274 -264
  143. data/test/test_lineinput.rb +7 -10
  144. data/test/test_location.rb +7 -7
  145. data/test/test_makerhelper.rb +13 -25
  146. data/test/test_markdownbuilder.rb +23 -26
  147. data/test/test_md2inaobuilder.rb +8 -11
  148. data/test/test_pdfmaker.rb +114 -123
  149. data/test/test_pdfmaker_cmd.rb +1 -3
  150. data/test/test_review_ext.rb +3 -5
  151. data/test/test_rstbuilder.rb +92 -97
  152. data/test/test_template.rb +3 -7
  153. data/test/test_textutils.rb +27 -27
  154. data/test/test_tocparser.rb +2 -2
  155. data/test/test_topbuilder.rb +98 -103
  156. data/test/test_webtocprinter.rb +5 -6
  157. data/test/test_yamlloader.rb +42 -42
  158. data/test/test_zip_exporter.rb +12 -18
  159. metadata +86 -9
  160. data/lib/review/ewbbuilder.rb +0 -382
@@ -1,4 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
1
  require 'test_helper'
3
2
  require 'review'
4
3
  require 'review/book/image_finder'
@@ -13,12 +12,12 @@ class ImageFinderTest < Test::Unit::TestCase
13
12
  def test_find_path_pattern1
14
13
  dir = Dir.mktmpdir
15
14
  begin
16
- path = dir+"/builder/ch01/foo.jpg"
15
+ path = dir + '/builder/ch01/foo.jpg'
17
16
  FileUtils.mkdir_p(File.dirname(path))
18
17
  FileUtils.touch(path)
19
18
 
20
- finder = ReVIEW::Book::ImageFinder.new(dir, "ch01", "builder", [".jpg"])
21
- assert_equal(path, finder.find_path("foo"))
19
+ finder = ReVIEW::Book::ImageFinder.new(dir, 'ch01', 'builder', ['.jpg'])
20
+ assert_equal(path, finder.find_path('foo'))
22
21
  ensure
23
22
  FileUtils.remove_entry_secure dir
24
23
  end
@@ -27,12 +26,12 @@ class ImageFinderTest < Test::Unit::TestCase
27
26
  def test_find_path_pattern2
28
27
  dir = Dir.mktmpdir
29
28
  begin
30
- path = dir+"/builder/ch01-foo.jpg"
29
+ path = dir + '/builder/ch01-foo.jpg'
31
30
  FileUtils.mkdir_p(File.dirname(path))
32
31
  FileUtils.touch(path)
33
32
 
34
- finder = ReVIEW::Book::ImageFinder.new(dir, "ch01", "builder", [".jpg"])
35
- assert_equal(path, finder.find_path("foo"))
33
+ finder = ReVIEW::Book::ImageFinder.new(dir, 'ch01', 'builder', ['.jpg'])
34
+ assert_equal(path, finder.find_path('foo'))
36
35
  ensure
37
36
  FileUtils.remove_entry_secure dir
38
37
  end
@@ -41,12 +40,12 @@ class ImageFinderTest < Test::Unit::TestCase
41
40
  def test_find_path_pattern3
42
41
  dir = Dir.mktmpdir
43
42
  begin
44
- path = dir+"/builder/foo.jpg"
43
+ path = dir + '/builder/foo.jpg'
45
44
  FileUtils.mkdir_p(File.dirname(path))
46
45
  FileUtils.touch(path)
47
46
 
48
- finder = ReVIEW::Book::ImageFinder.new(dir, "ch01", "builder", [".jpg"])
49
- assert_equal(path, finder.find_path("foo"))
47
+ finder = ReVIEW::Book::ImageFinder.new(dir, 'ch01', 'builder', ['.jpg'])
48
+ assert_equal(path, finder.find_path('foo'))
50
49
  ensure
51
50
  FileUtils.remove_entry_secure dir
52
51
  end
@@ -55,12 +54,12 @@ class ImageFinderTest < Test::Unit::TestCase
55
54
  def test_find_path_pattern4
56
55
  dir = Dir.mktmpdir
57
56
  begin
58
- path = dir+"/ch01/foo.jpg"
57
+ path = dir + '/ch01/foo.jpg'
59
58
  FileUtils.mkdir_p(File.dirname(path))
60
59
  FileUtils.touch(path)
61
60
 
62
- finder = ReVIEW::Book::ImageFinder.new(dir, "ch01", "builder", [".jpg"])
63
- assert_equal(path, finder.find_path("foo"))
61
+ finder = ReVIEW::Book::ImageFinder.new(dir, 'ch01', 'builder', ['.jpg'])
62
+ assert_equal(path, finder.find_path('foo'))
64
63
  ensure
65
64
  FileUtils.remove_entry_secure dir
66
65
  end
@@ -69,12 +68,12 @@ class ImageFinderTest < Test::Unit::TestCase
69
68
  def test_find_path_pattern5
70
69
  dir = Dir.mktmpdir
71
70
  begin
72
- path = dir+"/ch01-foo.jpg"
71
+ path = dir + '/ch01-foo.jpg'
73
72
  FileUtils.mkdir_p(File.dirname(path))
74
73
  FileUtils.touch(path)
75
74
 
76
- finder = ReVIEW::Book::ImageFinder.new(dir, "ch01", "builder", [".jpg"])
77
- assert_equal(path, finder.find_path("foo"))
75
+ finder = ReVIEW::Book::ImageFinder.new(dir, 'ch01', 'builder', ['.jpg'])
76
+ assert_equal(path, finder.find_path('foo'))
78
77
  ensure
79
78
  FileUtils.remove_entry_secure dir
80
79
  end
@@ -83,16 +82,16 @@ class ImageFinderTest < Test::Unit::TestCase
83
82
  def test_find_path_dir_symlink
84
83
  dir = Dir.mktmpdir
85
84
  begin
86
- path_src = dir+"/src"
87
- path_dst = dir+"/ch01"
85
+ path_src = dir + '/src'
86
+ path_dst = dir + '/ch01'
88
87
  FileUtils.mkdir_p(path_src)
89
88
  FileUtils.symlink(path_src, path_dst)
90
- path_srcimg = path_src+"/foo.jpg"
91
- path_dstimg = path_dst+"/foo.jpg"
89
+ path_srcimg = path_src + '/foo.jpg'
90
+ path_dstimg = path_dst + '/foo.jpg'
92
91
  FileUtils.touch(path_srcimg)
93
92
 
94
- finder = ReVIEW::Book::ImageFinder.new(dir, "ch01", "builder", [".jpg"])
95
- assert_equal(path_dstimg, finder.find_path("foo"))
93
+ finder = ReVIEW::Book::ImageFinder.new(dir, 'ch01', 'builder', ['.jpg'])
94
+ assert_equal(path_dstimg, finder.find_path('foo'))
96
95
  ensure
97
96
  FileUtils.remove_entry_secure dir
98
97
  end
@@ -1,5 +1,3 @@
1
- # encoding: utf-8
2
-
3
1
  require 'test_helper'
4
2
  require 'review/book'
5
3
  require 'review/book/index'
@@ -40,7 +38,7 @@ class IndexTest < Test::Unit::TestCase
40
38
  # rubocop:enable Style/PreferredHashMethods
41
39
  end
42
40
 
43
- def test_HeadelineIndex
41
+ def test_headeline_index
44
42
  src = <<-EOB
45
43
  = chap1
46
44
  == sec1-1
@@ -57,11 +55,11 @@ class IndexTest < Test::Unit::TestCase
57
55
  book = Book::Base.load
58
56
  chap = Book::Chapter.new(book, 1, '-', nil) # dummy
59
57
  index = Book::HeadlineIndex.parse(src, chap)
60
- assert_equal [2,2], index['sec1-2|sec1-2-2'].number
61
- assert_equal "1.2.2", index.number('sec1-2|sec1-2-2')
58
+ assert_equal [2, 2], index['sec1-2|sec1-2-2'].number
59
+ assert_equal '1.2.2', index.number('sec1-2|sec1-2-2')
62
60
  end
63
61
 
64
- def test_HeadelineIndex2
62
+ def test_headeline_index2
65
63
  src = <<-EOB
66
64
  = chap1
67
65
  == sec1-1
@@ -74,11 +72,11 @@ class IndexTest < Test::Unit::TestCase
74
72
  book = Book::Base.load
75
73
  chap = Book::Chapter.new(book, 1, '-', nil) # dummy
76
74
  index = Book::HeadlineIndex.parse(src, chap)
77
- assert_equal [3,1], index['sec1-3|sec1-3-1'].number
78
- assert_equal "1.3.1", index.number('sec1-3|sec1-3-1')
75
+ assert_equal [3, 1], index['sec1-3|sec1-3-1'].number
76
+ assert_equal '1.3.1', index.number('sec1-3|sec1-3-1')
79
77
  end
80
78
 
81
- def test_HeadelineIndex3
79
+ def test_headeline_index3
82
80
  src = <<-EOB
83
81
  = chap1
84
82
  == sec1-1
@@ -92,14 +90,14 @@ class IndexTest < Test::Unit::TestCase
92
90
  book = Book::Base.load
93
91
  chap = Book::Chapter.new(book, 1, '-', nil) # dummy
94
92
  index = Book::HeadlineIndex.parse(src, chap)
95
- assert_equal [2,2], index['sec1-2|sec1-2-2'].number
96
- assert_equal "1.2.2", index.number('sec1-2|sec1-2-2')
93
+ assert_equal [2, 2], index['sec1-2|sec1-2-2'].number
94
+ assert_equal '1.2.2', index.number('sec1-2|sec1-2-2')
97
95
 
98
- assert_equal [3,1], index['sec1-3|sec1-3-1'].number
99
- assert_equal "1.3.1", index.number('sec1-3|sec1-3-1')
96
+ assert_equal [3, 1], index['sec1-3|sec1-3-1'].number
97
+ assert_equal '1.3.1', index.number('sec1-3|sec1-3-1')
100
98
  end
101
99
 
102
- def test_HeadelineIndex4
100
+ def test_headeline_index4
103
101
  src = <<-EOB
104
102
  = chap1
105
103
  ====[column] c1
@@ -111,11 +109,11 @@ class IndexTest < Test::Unit::TestCase
111
109
  book = Book::Base.load
112
110
  chap = Book::Chapter.new(book, 1, '-', nil) # dummy
113
111
  index = Book::HeadlineIndex.parse(src, chap)
114
- assert_equal [2,2], index['sec1-2|sec1-2-2'].number
115
- assert_equal "1.2.2", index.number('sec1-2|sec1-2-2')
112
+ assert_equal [2, 2], index['sec1-2|sec1-2-2'].number
113
+ assert_equal '1.2.2', index.number('sec1-2|sec1-2-2')
116
114
  end
117
115
 
118
- def test_HeadelineIndex5
116
+ def test_headeline_index5
119
117
  src = <<-EOB
120
118
  = chap1
121
119
  ====[column] c1
@@ -127,11 +125,11 @@ class IndexTest < Test::Unit::TestCase
127
125
  book = Book::Base.load
128
126
  chap = Book::Chapter.new(book, 1, '-', nil) # dummy
129
127
  index = Book::HeadlineIndex.parse(src, chap)
130
- assert_equal [2,2], index['sec1-2-2'].number
131
- assert_equal "1.2.2", index.number('sec1-2-2')
128
+ assert_equal [2, 2], index['sec1-2-2'].number
129
+ assert_equal '1.2.2', index.number('sec1-2-2')
132
130
  end
133
131
 
134
- def test_HeadelineIndex6
132
+ def test_headeline_index6
135
133
  src = <<-EOB
136
134
  = chap1
137
135
  == sec1
@@ -142,11 +140,11 @@ class IndexTest < Test::Unit::TestCase
142
140
  book = Book::Base.load
143
141
  chap = Book::Chapter.new(book, 1, '-', nil) # dummy
144
142
  index = Book::HeadlineIndex.parse(src, chap)
145
- assert_equal [1,1], index['target'].number
146
- assert_equal "1.1.1", index.number('target')
143
+ assert_equal [1, 1], index['target'].number
144
+ assert_equal '1.1.1', index.number('target')
147
145
  end
148
146
 
149
- def test_HeadelineIndex7
147
+ def test_headeline_index7
150
148
  src = <<-EOB
151
149
  = chap1
152
150
  == sec1
@@ -162,11 +160,11 @@ class IndexTest < Test::Unit::TestCase
162
160
  index = Book::HeadlineIndex.parse(src, chap)
163
161
 
164
162
  assert_raise ReVIEW::KeyError do
165
- assert_equal [1,1], index['target'].number
163
+ assert_equal [1, 1], index['target'].number
166
164
  end
167
165
  end
168
166
 
169
- def test_HeadelineIndex8
167
+ def test_headeline_index8
170
168
  src = <<-EOB
171
169
  = chap1
172
170
  == sec1
@@ -177,9 +175,6 @@ class IndexTest < Test::Unit::TestCase
177
175
  book = Book::Base.load
178
176
  chap = Book::Chapter.new(book, 1, '-', nil)
179
177
  index = Book::HeadlineIndex.parse(src, chap)
180
- assert_equal "1.1.1", index.number('sec1-1')
178
+ assert_equal '1.1.1', index.number('sec1-1')
181
179
  end
182
-
183
-
184
180
  end
185
-
@@ -1,4 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
1
  require 'test_helper'
3
2
  require 'review/compiler'
4
3
  require 'review/book'
@@ -9,159 +8,159 @@ class LATEXBuidlerTest < Test::Unit::TestCase
9
8
  include ReVIEW
10
9
 
11
10
  def setup
12
- @builder = LATEXBuilder.new()
11
+ @builder = LATEXBuilder.new
13
12
  @config = ReVIEW::Configure.values
14
- @config.merge!({
15
- "secnolevel" => 2, # for IDGXMLBuilder, EPUBBuilder
16
- "toclevel" => 2,
17
- "stylesheet" => nil, # for EPUBBuilder
18
- "image_scale2width" => false,
19
- "texcommand" => "uplatex"
20
- })
13
+ @config.merge!(
14
+ 'secnolevel' => 2, # for IDGXMLBuilder, EPUBBuilder
15
+ 'toclevel' => 2,
16
+ 'stylesheet' => nil, # for EPUBBuilder
17
+ 'image_scale2width' => false,
18
+ 'texcommand' => 'uplatex'
19
+ )
21
20
  @book = Book::Base.new(nil)
22
21
  @book.config = @config
23
22
  @compiler = ReVIEW::Compiler.new(@builder)
24
23
  @chapter = Book::Chapter.new(@book, 1, 'chap1', nil, StringIO.new)
25
24
  location = Location.new(nil, nil)
26
25
  @builder.bind(@compiler, @chapter, location)
27
- I18n.setup("ja")
26
+ I18n.setup('ja')
28
27
  end
29
28
 
30
29
  def test_headline_level1
31
30
  actual = compile_block("={test} this is test.\n")
32
- assert_equal %Q|\\chapter{this is test.}\n\\label{chap:chap1}\n|, actual
31
+ assert_equal %Q(\\chapter{this is test.}\n\\label{chap:chap1}\n), actual
33
32
  end
34
33
 
35
34
  def test_headline_level1_without_secno
36
- @config["secnolevel"] = 0
35
+ @config['secnolevel'] = 0
37
36
  actual = compile_block("={test} this is test.\n")
38
- assert_equal %Q|\\chapter*{this is test.}\n\\addcontentsline{toc}{chapter}{this is test.}\n\\label{chap:chap1}\n|, actual
37
+ assert_equal %Q(\\chapter*{this is test.}\n\\addcontentsline{toc}{chapter}{this is test.}\n\\label{chap:chap1}\n), actual
39
38
  end
40
39
 
41
40
  def test_headline_level1_with_inlinetag
42
- actual = compile_block("={test} this @<b>{is} test.<&\"_>\n")
43
- assert_equal %Q|\\chapter{this \\textbf{is} test.\\textless{}\\&\"\\textunderscore{}\\textgreater{}}\n\\label{chap:chap1}\n|, actual
41
+ 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
44
43
  end
45
44
 
46
45
  def test_headline_level2
47
46
  actual = compile_block("=={test} this is test.\n")
48
- assert_equal %Q|\\section{this is test.}\n\\label{sec:1-1}\n|, actual
47
+ assert_equal %Q(\\section{this is test.}\n\\label{sec:1-1}\n\\label{test}\n), actual
49
48
  end
50
49
 
51
50
  def test_headline_level3
52
51
  actual = compile_block("==={test} this is test.\n")
53
- assert_equal %Q|\\subsection*{this is test.}\n\\label{sec:1-0-1}\n|, actual
52
+ assert_equal %Q(\\subsection*{this is test.}\n\\label{sec:1-0-1}\n\\label{test}\n), actual
54
53
  end
55
54
 
56
55
  def test_headline_level3_with_secno
57
- @config["secnolevel"] = 3
56
+ @config['secnolevel'] = 3
58
57
  actual = compile_block("==={test} this is test.\n")
59
- assert_equal %Q|\\subsection{this is test.}\n\\label{sec:1-0-1}\n|, actual
58
+ assert_equal %Q(\\subsection{this is test.}\n\\label{sec:1-0-1}\n\\label{test}\n), actual
60
59
  end
61
60
 
62
61
  def test_label
63
62
  actual = compile_block("//label[label_test]\n")
64
- assert_equal %Q|\\label{label_test}\n|, actual
63
+ assert_equal %Q(\\label{label_test}\n), actual
65
64
  end
66
65
 
67
66
  def test_href
68
- actual = compile_inline("@<href>{http://github.com,GitHub}")
69
- assert_equal %Q|\\href{http://github.com}{GitHub}|, actual
67
+ actual = compile_inline('@<href>{http://github.com,GitHub}')
68
+ assert_equal '\\href{http://github.com}{GitHub}', actual
70
69
  end
71
70
 
72
71
  def test_inline_href
73
72
  actual = compile_inline('@<href>{http://github.com,Git\\,Hub}')
74
- assert_equal %Q|\\href{http://github.com}{Git,Hub}|, actual
73
+ assert_equal '\\href{http://github.com}{Git,Hub}', actual
75
74
  end
76
75
 
77
76
  def test_href_without_label
78
77
  actual = compile_inline('@<href>{http://github.com}')
79
- assert_equal %Q|\\url{http://github.com}|, actual
78
+ assert_equal '\\url{http://github.com}', actual
80
79
  end
81
80
 
82
81
  def test_href_with_underscore
83
82
  actual = compile_inline('@<href>{http://example.com/aaa/bbb, AAA_BBB}')
84
- assert_equal %Q|\\href{http://example.com/aaa/bbb}{AAA\\textunderscore{}BBB}|, actual
83
+ assert_equal '\\href{http://example.com/aaa/bbb}{AAA\\textunderscore{}BBB}', actual
85
84
  end
86
85
 
87
86
  def test_href_mailto
88
87
  actual = compile_inline('@<href>{mailto:takahashim@example.com, takahashim@example.com}')
89
- assert_equal %Q|\\href{mailto:takahashim@example.com}{takahashim@example.com}|, actual
88
+ assert_equal '\\href{mailto:takahashim@example.com}{takahashim@example.com}', actual
90
89
  end
91
90
 
92
91
  def test_inline_br
93
- actual = compile_inline("@<br>{}")
94
- assert_equal %Q|\\\\\n|, actual
92
+ actual = compile_inline('@<br>{}')
93
+ assert_equal %Q(\\\\\n), actual
95
94
  end
96
95
 
97
96
  def test_inline_br_with_other_strings
98
- actual = compile_inline("abc@<br>{}def")
99
- assert_equal %Q|abc\\\\\ndef|, actual
97
+ actual = compile_inline('abc@<br>{}def')
98
+ assert_equal %Q(abc\\\\\ndef), actual
100
99
  end
101
100
 
102
101
  def test_inline_i
103
- actual = compile_inline("abc@<i>{def}ghi")
104
- assert_equal %Q|abc\\textit{def}ghi|, actual
102
+ actual = compile_inline('abc@<i>{def}ghi')
103
+ assert_equal 'abc\\textit{def}ghi', actual
105
104
  end
106
105
 
107
106
  def test_inline_i_and_escape
108
- actual = compile_inline("test @<i>{inline<&;\\ test} test2")
109
- assert_equal %Q|test \\textit{inline\\textless{}\\&;\\reviewbackslash{} test} test2|, actual
107
+ actual = compile_inline('test @<i>{inline<&;\\ test} test2')
108
+ assert_equal 'test \\textit{inline\\textless{}\\&;\\reviewbackslash{} test} test2', actual
110
109
  end
111
110
 
112
111
  def test_inline_dtp
113
- actual = compile_inline("abc@<dtp>{def}ghi")
114
- assert_equal %Q|abcghi|, actual
112
+ actual = compile_inline('abc@<dtp>{def}ghi')
113
+ assert_equal 'abcghi', actual
115
114
  end
116
115
 
117
116
  def test_inline_code
118
- actual = compile_inline("abc@<code>{def}ghi")
119
- assert_equal %Q|abc\\texttt{def}ghi|, actual
117
+ actual = compile_inline('abc@<code>{def}ghi')
118
+ assert_equal 'abc\\texttt{def}ghi', actual
120
119
  end
121
120
 
122
121
  def test_inline_raw
123
- actual = compile_inline("@<raw>{@<tt>{inline!$%\\}}")
124
- assert_equal "@<tt>{inline!$%}", actual
122
+ actual = compile_inline('@<raw>{@<tt>{inline!$%\\}}')
123
+ assert_equal '@<tt>{inline!$%}', actual
125
124
  end
126
125
 
127
126
  def test_inline_sup
128
- actual = compile_inline("abc@<sup>{def}")
129
- assert_equal %Q|abc\\textsuperscript{def}|, actual
127
+ actual = compile_inline('abc@<sup>{def}')
128
+ assert_equal 'abc\\textsuperscript{def}', actual
130
129
  end
131
130
 
132
131
  def test_inline_sub
133
- actual = compile_inline("abc@<sub>{def}")
134
- assert_equal %Q|abc\\textsubscript{def}|, actual
132
+ actual = compile_inline('abc@<sub>{def}')
133
+ assert_equal 'abc\\textsubscript{def}', actual
135
134
  end
136
135
 
137
136
  def test_inline_b
138
- actual = compile_inline("abc@<b>{def}")
139
- assert_equal %Q|abc\\textbf{def}|, actual
137
+ actual = compile_inline('abc@<b>{def}')
138
+ assert_equal 'abc\\textbf{def}', actual
140
139
  end
141
140
 
142
141
  def test_inline_b_and_escape
143
- actual = compile_inline("test @<b>{inline<&;\\ test} test2")
144
- assert_equal %Q|test \\textbf{inline\\textless{}\\&;\\reviewbackslash{} test} test2|, actual
142
+ actual = compile_inline('test @<b>{inline<&;\\ test} test2')
143
+ assert_equal 'test \\textbf{inline\\textless{}\\&;\\reviewbackslash{} test} test2', actual
145
144
  end
146
145
 
147
146
  def test_inline_em
148
- actual = compile_inline("abc@<em>{def}")
149
- assert_equal %Q|abc\\reviewem{def}|, actual
147
+ actual = compile_inline('abc@<em>{def}')
148
+ assert_equal 'abc\\reviewem{def}', actual
150
149
  end
151
150
 
152
151
  def test_inline_strong
153
- actual = compile_inline("abc@<strong>{def}")
154
- assert_equal %Q|abc\\reviewstrong{def}|, actual
152
+ actual = compile_inline('abc@<strong>{def}')
153
+ assert_equal 'abc\\reviewstrong{def}', actual
155
154
  end
156
155
 
157
156
  def test_inline_u
158
- actual = compile_inline("abc@<u>{def}ghi")
159
- assert_equal %Q|abc\\reviewunderline{def}ghi|, actual
157
+ actual = compile_inline('abc@<u>{def}ghi')
158
+ assert_equal 'abc\\reviewunderline{def}ghi', actual
160
159
  end
161
160
 
162
161
  def test_inline_m
163
- actual = compile_inline("abc@<m>{\\alpha^n = \inf < 2}ghi")
164
- assert_equal "abc $\\alpha^n = inf < 2$ ghi", actual
162
+ actual = compile_inline('abc@<m>{\\alpha^n = \\inf < 2}ghi')
163
+ assert_equal 'abc $\\alpha^n = \\inf < 2$ ghi', actual
165
164
  end
166
165
 
167
166
  def test_inline_m2
@@ -172,49 +171,54 @@ class LATEXBuidlerTest < Test::Unit::TestCase
172
171
  end
173
172
 
174
173
  def test_inline_tt
175
- actual = compile_inline("test @<tt>{inline test} test2")
176
- assert_equal %Q|test \\texttt{inline test} test2|, actual
174
+ actual = compile_inline('test @<tt>{inline test} test2')
175
+ assert_equal 'test \\texttt{inline test} test2', actual
177
176
  end
178
177
 
179
178
  def test_inline_tt_endash
180
- actual = compile_inline("test @<tt>{in-line --test ---foo ----bar -----buz} --test2")
181
- assert_equal %Q|test \\texttt{in{-}line {-}{-}test {-}{-}{-}foo {-}{-}{-}{-}bar {-}{-}{-}{-}{-}buz} {-}{-}test2|, actual
179
+ 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
182
181
  end
183
182
 
184
183
  def test_inline_tti
185
- actual = compile_inline("test @<tti>{inline test} test2")
186
- assert_equal %Q|test \\texttt{\\textit{inline test}} test2|, actual
184
+ actual = compile_inline('test @<tti>{inline test} test2')
185
+ assert_equal 'test \\texttt{\\textit{inline test}} test2', actual
187
186
  end
188
187
 
189
188
  def test_inline_ttb
190
- actual = compile_inline("test @<ttb>{inline test} test2")
191
- assert_equal %Q|test \\texttt{\\textbf{inline test}} test2|, actual
189
+ actual = compile_inline('test @<ttb>{inline test} test2')
190
+ assert_equal 'test \\texttt{\\textbf{inline test}} test2', actual
192
191
  end
193
192
 
194
193
  def test_inline_hd_chap
195
194
  def @chapter.headline_index
196
- items = [Book::HeadlineIndex::Item.new("chap1|test", [1, 1], "te_st")]
195
+ items = [Book::HeadlineIndex::Item.new('chap1|test', [1, 1], 'te_st')]
197
196
  Book::HeadlineIndex.new(items, self)
198
197
  end
199
198
 
200
- @config["secnolevel"] = 3
201
- actual = compile_inline("test @<hd>{chap1|test} test2")
202
- assert_equal %Q|test 「1.1.1 te\\textunderscore{}st」 test2|, actual
199
+ @config['secnolevel'] = 3
200
+ actual = compile_inline('test @<hd>{chap1|test} test2')
201
+ assert_equal 'test 「1.1.1 te\\textunderscore{}st」 test2', actual
202
+ end
203
+
204
+ def test_inline_pageref
205
+ actual = compile_inline('test p.@<pageref>{p1}')
206
+ assert_equal 'test p.\pageref{p1}', actual
203
207
  end
204
208
 
205
209
  def test_inline_ruby_comma
206
- actual = compile_inline("@<ruby>{foo\\, bar\\, buz,フー・バー・バズ}")
207
- assert_equal "\\ruby{foo, bar, buz}{フー・バー・バズ}", actual
210
+ actual = compile_inline('@<ruby>{foo\\, bar\\, buz,フー・バー・バズ}')
211
+ assert_equal '\\ruby{foo, bar, buz}{フー・バー・バズ}', actual
208
212
  end
209
213
 
210
214
  def test_inline_uchar
211
- actual = compile_inline("test @<uchar>{2460} test2")
212
- assert_equal %Q|test \\UTF{2460} test2|, actual
215
+ actual = compile_inline('test @<uchar>{2460} test2')
216
+ assert_equal 'test \\UTF{2460} test2', actual
213
217
  end
214
218
 
215
219
  def test_inline_idx
216
- actual = compile_inline("@<idx>{__TEST%$}, @<hidx>{__TEST%$}")
217
- assert_equal %Q|\\textunderscore{}\\textunderscore{}TEST\\%\\textdollar{}\\index{__TEST%$@\\textunderscore{}\\textunderscore{}TEST\\%\\textdollar{}}, \\index{__TEST%$@\\textunderscore{}\\textunderscore{}TEST\\%\\textdollar{}}|, actual
220
+ actual = compile_inline('@<idx>{__TEST%$}, @<hidx>{__TEST%$}')
221
+ assert_equal '\\textunderscore{}\\textunderscore{}TEST\\%\\textdollar{}\\index{__TEST%$@\\textunderscore{}\\textunderscore{}TEST\\%\\textdollar{}}, \\index{__TEST%$@\\textunderscore{}\\textunderscore{}TEST\\%\\textdollar{}}', actual
218
222
  end
219
223
 
220
224
  def test_inline_idx_yomi
@@ -222,304 +226,304 @@ class LATEXBuidlerTest < Test::Unit::TestCase
222
226
  require 'MeCab'
223
227
  require 'nkf'
224
228
  rescue LoadError
225
- $stderr.puts "skip test_inline_idx_yomi (cannot find MeCab)"
229
+ $stderr.puts 'skip test_inline_idx_yomi (cannot find MeCab)'
226
230
  return true
227
231
  end
228
232
  tmpdir = Dir.mktmpdir
229
233
  File.write("#{tmpdir}/sample.dic", "強運\tはーどらっく\n")
230
- @book.config["pdfmaker"]["makeindex"] = true
231
- @book.config["pdfmaker"]["makeindex_dic"] = "#{tmpdir}/sample.dic"
234
+ @book.config['pdfmaker']['makeindex'] = true
235
+ @book.config['pdfmaker']['makeindex_dic'] = "#{tmpdir}/sample.dic"
232
236
  @builder.setup_index
233
- actual = compile_inline("@<hidx>{漢字}@<hidx>{強運}@<hidx>{項目@1<<>>項目@2}")
237
+ actual = compile_inline('@<hidx>{漢字}@<hidx>{強運}@<hidx>{項目@1<<>>項目@2}')
234
238
  FileUtils.remove_entry_secure(tmpdir)
235
- assert_equal %Q|\\index{かんじ@漢字}\\index{はーどらっく@強運}\\index{こうもく"@1@項目"@1!こうもく"@2@項目"@2}|, actual
239
+ assert_equal %Q(\\index{かんじ@漢字}\\index{はーどらっく@強運}\\index{こうもく"@1@項目"@1!こうもく"@2@項目"@2}), actual
236
240
  end
237
241
 
238
242
  def test_jis_x_0201_kana
239
243
  # uplatex can handle half-width kana natively
240
- actual = compile_inline("foo・カンジ、テスト")
241
- assert_equal %Q|foo・カンジ、テスト|, actual
242
- # assert_equal %Q|foo\\aj半角{・}\\aj半角{カ}\\aj半角{ン}\\aj半角{シ}\\aj半角{゛}\\aj半角{、}テスト|, actual
244
+ actual = compile_inline('foo・カンジ、テスト')
245
+ assert_equal 'foo・カンジ、テスト', actual
246
+ # assert_equal %Q(foo\\aj半角{・}\\aj半角{カ}\\aj半角{ン}\\aj半角{シ}\\aj半角{゛}\\aj半角{、}テスト), actual
243
247
  end
244
248
 
245
249
  def test_dlist
246
250
  actual = compile_block(": foo\n foo.\n bar.\n")
247
- assert_equal %Q|\n\\begin{description}\n\\item[foo] \\mbox{} \\\\\nfoo.bar.\n\\end{description}\n|, actual
251
+ assert_equal %Q(\n\\begin{description}\n\\item[foo] \\mbox{} \\\\\nfoo.bar.\n\\end{description}\n), actual
248
252
  end
249
253
 
250
254
  def test_dlist_with_bracket
251
255
  actual = compile_block(": foo[bar]\n foo.\n bar.\n")
252
- assert_equal %Q|\n\\begin{description}\n\\item[foo\\lbrack{}bar\\rbrack{}] \\mbox{} \\\\\nfoo.bar.\n\\end{description}\n|, actual
256
+ assert_equal %Q(\n\\begin{description}\n\\item[foo\\lbrack{}bar\\rbrack{}] \\mbox{} \\\\\nfoo.bar.\n\\end{description}\n), actual
253
257
  end
254
258
 
255
259
  def test_dlist_beforeulol
256
260
  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")
257
- 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
261
+ 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
258
262
  end
259
263
 
260
264
  def test_cmd
261
265
  actual = compile_block("//cmd{\nfoo\nbar\n\nbuz\n//}\n")
262
- assert_equal %Q|\n\\begin{reviewcmd}\nfoo\nbar\n\nbuz\n\\end{reviewcmd}\n|, actual
266
+ assert_equal %Q(\n\\begin{reviewcmd}\nfoo\nbar\n\nbuz\n\\end{reviewcmd}\n), actual
263
267
  end
264
268
 
265
269
  def test_cmd_caption
266
270
  actual = compile_block("//cmd[cap1]{\nfoo\nbar\n\nbuz\n//}\n")
267
- assert_equal %Q|\n\\reviewcmdcaption{cap1}\n\\begin{reviewcmd}\nfoo\nbar\n\nbuz\n\\end{reviewcmd}\n|, actual
271
+ assert_equal %Q(\n\\reviewcmdcaption{cap1}\n\\begin{reviewcmd}\nfoo\nbar\n\nbuz\n\\end{reviewcmd}\n), actual
268
272
  end
269
273
 
270
274
  def test_cmd_lst
271
- @book.config["highlight"] = {}
272
- @book.config["highlight"]["latex"] = "listings"
275
+ @book.config['highlight'] = {}
276
+ @book.config['highlight']['latex'] = 'listings'
273
277
  actual = compile_block("//cmd{\nfoo\nbar\n\nbuz\n//}\n")
274
- assert_equal %Q|\\vspace{-1.5em}\\begin{reviewcmdlst}[title={\\relax},language={}]\nfoo\nbar\n\nbuz\n\\end{reviewcmdlst}\n|, actual
278
+ assert_equal %Q(\\vspace{-1.5em}\\begin{reviewcmdlst}[title={\\relax},language={}]\nfoo\nbar\n\nbuz\n\\end{reviewcmdlst}\n), actual
275
279
  end
276
280
 
277
281
  def test_emlist
278
282
  actual = compile_block("//emlist{\nfoo\nbar\n\nbuz\n//}\n")
279
- assert_equal %Q|\n\\begin{reviewemlist}\nfoo\nbar\n\nbuz\n\\end{reviewemlist}\n|, actual
283
+ assert_equal %Q(\n\\begin{reviewemlist}\nfoo\nbar\n\nbuz\n\\end{reviewemlist}\n), actual
280
284
  end
281
285
 
282
286
  def test_emlist_lst
283
- @book.config["highlight"] = {}
284
- @book.config["highlight"]["latex"] = "listings"
287
+ @book.config['highlight'] = {}
288
+ @book.config['highlight']['latex'] = 'listings'
285
289
  actual = compile_block("//emlist[][sql]{\nSELECT COUNT(*) FROM tests WHERE tests.no > 10 AND test.name LIKE 'ABC%'\n//}\n")
286
- 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
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
287
291
  end
288
292
 
289
293
  def test_emlist_lst_without_lang
290
- @book.config["highlight"] = {}
291
- @book.config["highlight"]["latex"] = "listings"
292
- @book.config["highlight"]["lang"] = "sql"
294
+ @book.config['highlight'] = {}
295
+ @book.config['highlight']['latex'] = 'listings'
296
+ @book.config['highlight']['lang'] = 'sql'
293
297
  actual = compile_block("//emlist[]{\nSELECT COUNT(*) FROM tests WHERE tests.no > 10 AND test.name LIKE 'ABC%'\n//}\n")
294
- 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
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
295
299
  end
296
300
 
297
301
  def test_emlist_caption
298
302
  actual = compile_block("//emlist[cap1]{\nfoo\nbar\n\nbuz\n//}\n")
299
- assert_equal %Q|\n\\reviewemlistcaption{cap1}\n\\begin{reviewemlist}\nfoo\nbar\n\nbuz\n\\end{reviewemlist}\n|, actual
303
+ assert_equal %Q(\n\\reviewemlistcaption{cap1}\n\\begin{reviewemlist}\nfoo\nbar\n\nbuz\n\\end{reviewemlist}\n), actual
300
304
  end
301
305
 
302
306
  def test_emlist_with_tab
303
307
  actual = compile_block("//emlist{\n\tfoo\n\t\tbar\n\n\tbuz\n//}\n")
304
- assert_equal %Q|\n\\begin{reviewemlist}\n foo\n bar\n\n buz\n\\end{reviewemlist}\n|, actual
308
+ assert_equal %Q(\n\\begin{reviewemlist}\n foo\n bar\n\n buz\n\\end{reviewemlist}\n), actual
305
309
  end
306
310
 
307
311
  def test_emlist_with_tab4
308
- @config["tabwidth"] = 4
312
+ @config['tabwidth'] = 4
309
313
  actual = compile_block("//emlist{\n\tfoo\n\t\tbar\n\n\tbuz\n//}\n")
310
- assert_equal %Q|\n\\begin{reviewemlist}\n foo\n bar\n\n buz\n\\end{reviewemlist}\n|, actual
314
+ assert_equal %Q(\n\\begin{reviewemlist}\n foo\n bar\n\n buz\n\\end{reviewemlist}\n), actual
311
315
  end
312
316
 
313
317
  def test_emlistnum_caption
314
318
  actual = compile_block("//emlistnum[cap1]{\nfoo\nbar\n\nbuz\n//}\n")
315
- 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
319
+ 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
316
320
  end
317
321
 
318
322
  def test_list
319
323
  actual = compile_block("//list[id1][cap1]{\nfoo\nbar\n\nbuz\n//}\n")
320
- assert_equal %Q|\\reviewlistcaption{リスト1.1: cap1}\n\\begin{reviewlist}\nfoo\nbar\n\nbuz\n\\end{reviewlist}\n|, actual
324
+ assert_equal %Q(\\reviewlistcaption{リスト1.1: cap1}\n\\begin{reviewlist}\nfoo\nbar\n\nbuz\n\\end{reviewlist}\n), actual
321
325
  end
322
326
 
323
327
  def test_list_lst
324
- @book.config["highlight"] = {}
325
- @book.config["highlight"]["latex"] = "listings"
328
+ @book.config['highlight'] = {}
329
+ @book.config['highlight']['latex'] = 'listings'
326
330
  actual = compile_block("//list[id1][cap1][sql]{\nSELECT COUNT(*) FROM tests WHERE tests.no > 10 AND test.name LIKE 'ABC%'\n//}\n")
327
- 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
331
+ 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
328
332
  end
329
333
 
330
334
  def test_list_lst_with_lang
331
- @book.config["highlight"] = {}
332
- @book.config["highlight"]["latex"] = "listings"
333
- @book.config["highlight"]["lang"] = "sql"
335
+ @book.config['highlight'] = {}
336
+ @book.config['highlight']['latex'] = 'listings'
337
+ @book.config['highlight']['lang'] = 'sql'
334
338
  actual = compile_block("//list[id1][cap1]{\nSELECT COUNT(*) FROM tests WHERE tests.no > 10 AND test.name LIKE 'ABC%'\n//}\n")
335
- 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
339
+ 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
336
340
  end
337
341
 
338
342
  def test_listnum
339
343
  actual = compile_block("//listnum[test1][ruby]{\nclass Foo\n def foo\n bar\n\n buz\n end\nend\n//}\n")
340
- 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
344
+ 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
341
345
  end
342
346
 
343
347
  def test_listnum_linenum
344
348
  actual = compile_block("//firstlinenum[100]\n//listnum[test1][ruby]{\nclass Foo\n def foo\n bar\n\n buz\n end\nend\n//}\n")
345
- 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
349
+ 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
346
350
  end
347
351
 
348
352
  def test_listnum_lst
349
- @book.config["highlight"] = {}
350
- @book.config["highlight"]["latex"] = "listings"
353
+ @book.config['highlight'] = {}
354
+ @book.config['highlight']['latex'] = 'listings'
351
355
  actual = compile_block("//listnum[test1][ruby]{\nclass Foo\n def foo\n bar\n\n buz\n end\nend\n//}\n")
352
- 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
356
+ 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
353
357
  end
354
358
 
355
359
  def test_listnum_lst_linenum
356
- @book.config["highlight"] = {}
357
- @book.config["highlight"]["latex"] = "listings"
360
+ @book.config['highlight'] = {}
361
+ @book.config['highlight']['latex'] = 'listings'
358
362
  actual = compile_block("//firstlinenum[100]\n//listnum[test1][ruby]{\nclass Foo\n def foo\n bar\n\n buz\n end\nend\n//}\n")
359
- 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
363
+ 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
360
364
  end
361
365
 
362
366
  def test_source
363
367
  actual = compile_block("//source[foo/bar/test.rb]{\nfoo\nbar\n\nbuz\n//}\n")
364
- assert_equal %Q|\\reviewsourcecaption{foo/bar/test.rb}\n\\begin{reviewsource}\nfoo\nbar\n\nbuz\n\\end{reviewsource}\n|, actual
368
+ assert_equal %Q(\\reviewsourcecaption{foo/bar/test.rb}\n\\begin{reviewsource}\nfoo\nbar\n\nbuz\n\\end{reviewsource}\n), actual
365
369
  end
366
370
 
367
371
  def test_source_lst
368
- @book.config["highlight"] = {}
369
- @book.config["highlight"]["latex"] = "listings"
372
+ @book.config['highlight'] = {}
373
+ @book.config['highlight']['latex'] = 'listings'
370
374
  actual = compile_block("//source[foo/bar/test.rb]{\nfoo\nbar\n\nbuz\n//}\n")
371
- assert_equal %Q|\\begin{reviewsourcelst}[title={foo/bar/test.rb},language={}]\nfoo\nbar\n\nbuz\n\\end{reviewsourcelst}\n|, actual
375
+ assert_equal %Q(\\begin{reviewsourcelst}[title={foo/bar/test.rb},language={}]\nfoo\nbar\n\nbuz\n\\end{reviewsourcelst}\n), actual
372
376
  end
373
377
 
374
378
  def test_quote
375
379
  actual = compile_block("//quote{\nfoo\nbar\n\nbuz\n//}\n")
376
- assert_equal %Q|\n\\begin{quote}\nfoobar\n\nbuz\n\\end{quote}\n|, actual
380
+ assert_equal %Q(\n\\begin{quote}\nfoobar\n\nbuz\n\\end{quote}\n), actual
377
381
  end
378
382
 
379
383
  def test_memo
380
384
  actual = compile_block("//memo[this is @<b>{test}<&>_]{\ntest1\n\ntest@<i>{2}\n//}\n")
381
- assert_equal %Q|\\begin{reviewminicolumn}\n\\reviewminicolumntitle{this is \\textbf{test}\\textless{}\\&\\textgreater{}\\textunderscore{}}\ntest1\n\ntest\\textit{2}\n\\end{reviewminicolumn}\n|, actual
385
+ assert_equal %Q(\\begin{reviewminicolumn}\n\\reviewminicolumntitle{this is \\textbf{test}\\textless{}\\&\\textgreater{}\\textunderscore{}}\ntest1\n\ntest\\textit{2}\n\\end{reviewminicolumn}\n), actual
382
386
  end
383
387
 
384
388
  def test_flushright
385
389
  actual = compile_block("//flushright{\nfoo\nbar\n\nbuz\n//}\n")
386
- assert_equal %Q|\n\\begin{flushright}\nfoobar\n\nbuz\n\\end{flushright}\n|, actual
390
+ assert_equal %Q(\n\\begin{flushright}\nfoobar\n\nbuz\n\\end{flushright}\n), actual
387
391
  end
388
392
 
389
393
  def test_centering
390
394
  actual = compile_block("//centering{\nfoo\nbar\n\nbuz\n//}\n")
391
- assert_equal %Q|\n\\begin{center}\nfoobar\n\nbuz\n\\end{center}\n|, actual
395
+ assert_equal %Q(\n\\begin{center}\nfoobar\n\nbuz\n\\end{center}\n), actual
392
396
  end
393
397
 
394
398
  def test_noindent
395
399
  actual = compile_block("//noindent\nfoo\nbar\n\nfoo2\nbar2\n")
396
- assert_equal %Q|\\noindent\nfoo\nbar\n\nfoo2\nbar2\n|, actual
400
+ assert_equal %Q(\\noindent\nfoo\nbar\n\nfoo2\nbar2\n), actual
397
401
  end
398
402
 
399
403
  def test_image
400
- def @chapter.image(id)
401
- item = Book::ImageIndex::Item.new("sampleimg",1)
402
- item.instance_eval{@path="./images/chap1-sampleimg.png"}
404
+ def @chapter.image(_id)
405
+ item = Book::ImageIndex::Item.new('sampleimg', 1)
406
+ item.instance_eval { @path = './images/chap1-sampleimg.png' }
403
407
  item
404
408
  end
405
409
 
406
410
  actual = compile_block("//image[sampleimg][sample photo]{\n//}\n")
407
- assert_equal %Q|\\begin{reviewimage}\n\\includegraphics[width=\\maxwidth]{./images/chap1-sampleimg.png}\n\\caption{sample photo}\n\\label{image:chap1:sampleimg}\n\\end{reviewimage}\n|, actual
411
+ assert_equal %Q(\\begin{reviewimage}\n\\includegraphics[width=\\maxwidth]{./images/chap1-sampleimg.png}\n\\caption{sample photo}\n\\label{image:chap1:sampleimg}\n\\end{reviewimage}\n), actual
408
412
  end
409
413
 
410
414
  def test_image_with_metric
411
- def @chapter.image(id)
412
- item = Book::ImageIndex::Item.new("sampleimg",1)
413
- item.instance_eval{@path="./images/chap1-sampleimg.png"}
415
+ def @chapter.image(_id)
416
+ item = Book::ImageIndex::Item.new('sampleimg', 1)
417
+ item.instance_eval { @path = './images/chap1-sampleimg.png' }
414
418
  item
415
419
  end
416
420
 
417
421
  actual = compile_block("//image[sampleimg][sample photo][scale=1.2]{\n//}\n")
418
- assert_equal %Q|\\begin{reviewimage}\n\\includegraphics[scale=1.2]{./images/chap1-sampleimg.png}\n\\caption{sample photo}\n\\label{image:chap1:sampleimg}\n\\end{reviewimage}\n|, actual
422
+ assert_equal %Q(\\begin{reviewimage}\n\\includegraphics[scale=1.2]{./images/chap1-sampleimg.png}\n\\caption{sample photo}\n\\label{image:chap1:sampleimg}\n\\end{reviewimage}\n), actual
419
423
  end
420
424
 
421
425
  def test_image_with_metric_width
422
- def @chapter.image(id)
423
- item = Book::ImageIndex::Item.new("sampleimg",1)
424
- item.instance_eval{@path="./images/chap1-sampleimg.png"}
426
+ def @chapter.image(_id)
427
+ item = Book::ImageIndex::Item.new('sampleimg', 1)
428
+ item.instance_eval { @path = './images/chap1-sampleimg.png' }
425
429
  item
426
430
  end
427
431
 
428
- @config["image_scale2width"] = true
432
+ @config['image_scale2width'] = true
429
433
  actual = compile_block("//image[sampleimg][sample photo][scale=1.2]{\n//}\n")
430
- assert_equal %Q|\\begin{reviewimage}\n\\includegraphics[width=1.2\\maxwidth]{./images/chap1-sampleimg.png}\n\\caption{sample photo}\n\\label{image:chap1:sampleimg}\n\\end{reviewimage}\n|, actual
434
+ assert_equal %Q(\\begin{reviewimage}\n\\includegraphics[width=1.2\\maxwidth]{./images/chap1-sampleimg.png}\n\\caption{sample photo}\n\\label{image:chap1:sampleimg}\n\\end{reviewimage}\n), actual
431
435
  end
432
436
 
433
437
  def test_image_with_metric2
434
- def @chapter.image(id)
435
- item = Book::ImageIndex::Item.new("sampleimg",1)
436
- item.instance_eval{@path="./images/chap1-sampleimg.png"}
438
+ def @chapter.image(_id)
439
+ item = Book::ImageIndex::Item.new('sampleimg', 1)
440
+ item.instance_eval { @path = './images/chap1-sampleimg.png' }
437
441
  item
438
442
  end
439
443
 
440
444
  actual = compile_block("//image[sampleimg][sample photo][scale=1.2,html::class=sample,latex::ignore=params]{\n//}\n")
441
- assert_equal %Q|\\begin{reviewimage}\n\\includegraphics[scale=1.2,ignore=params]{./images/chap1-sampleimg.png}\n\\caption{sample photo}\n\\label{image:chap1:sampleimg}\n\\end{reviewimage}\n|, actual
445
+ assert_equal %Q(\\begin{reviewimage}\n\\includegraphics[scale=1.2,ignore=params]{./images/chap1-sampleimg.png}\n\\caption{sample photo}\n\\label{image:chap1:sampleimg}\n\\end{reviewimage}\n), actual
442
446
  end
443
447
 
444
448
  def test_image_with_metric2_width
445
- def @chapter.image(id)
446
- item = Book::ImageIndex::Item.new("sampleimg",1)
447
- item.instance_eval{@path="./images/chap1-sampleimg.png"}
449
+ def @chapter.image(_id)
450
+ item = Book::ImageIndex::Item.new('sampleimg', 1)
451
+ item.instance_eval { @path = './images/chap1-sampleimg.png' }
448
452
  item
449
453
  end
450
454
 
451
- @config["image_scale2width"] = true
455
+ @config['image_scale2width'] = true
452
456
  actual = compile_block("//image[sampleimg][sample photo][scale=1.2,html::class=sample,latex::ignore=params]{\n//}\n")
453
- assert_equal %Q|\\begin{reviewimage}\n\\includegraphics[width=1.2\\maxwidth,ignore=params]{./images/chap1-sampleimg.png}\n\\caption{sample photo}\n\\label{image:chap1:sampleimg}\n\\end{reviewimage}\n|, actual
457
+ assert_equal %Q(\\begin{reviewimage}\n\\includegraphics[width=1.2\\maxwidth,ignore=params]{./images/chap1-sampleimg.png}\n\\caption{sample photo}\n\\label{image:chap1:sampleimg}\n\\end{reviewimage}\n), actual
454
458
  end
455
459
 
456
460
  def test_indepimage
457
- def @chapter.image(id)
458
- item = Book::ImageIndex::Item.new("sampleimg",1)
459
- item.instance_eval{@path="./images/chap1-sampleimg.png"}
461
+ def @chapter.image(_id)
462
+ item = Book::ImageIndex::Item.new('sampleimg', 1)
463
+ item.instance_eval { @path = './images/chap1-sampleimg.png' }
460
464
  item
461
465
  end
462
466
 
463
467
  actual = compile_block("//indepimage[sampleimg][sample photo]\n")
464
- assert_equal %Q|\\begin{reviewimage}\n\\includegraphics[width=\\maxwidth]{./images/chap1-sampleimg.png}\n\\reviewindepimagecaption{図: sample photo}\n\\end{reviewimage}\n|, actual
468
+ assert_equal %Q(\\begin{reviewimage}\n\\includegraphics[width=\\maxwidth]{./images/chap1-sampleimg.png}\n\\reviewindepimagecaption{図: sample photo}\n\\end{reviewimage}\n), actual
465
469
  end
466
470
 
467
471
  def test_indepimage_without_caption
468
- def @chapter.image(id)
469
- item = Book::ImageIndex::Item.new("sampleimg",1)
470
- item.instance_eval{@path="./images/chap1-sampleimg.png"}
472
+ def @chapter.image(_id)
473
+ item = Book::ImageIndex::Item.new('sampleimg', 1)
474
+ item.instance_eval { @path = './images/chap1-sampleimg.png' }
471
475
  item
472
476
  end
473
477
 
474
478
  # FIXME: indepimage's caption should not be with a counter.
475
479
  actual = compile_block("//indepimage[sampleimg]\n")
476
- assert_equal %Q|\\begin{reviewimage}\n\\includegraphics[width=\\maxwidth]{./images/chap1-sampleimg.png}\n\\end{reviewimage}\n|, actual
480
+ assert_equal %Q(\\begin{reviewimage}\n\\includegraphics[width=\\maxwidth]{./images/chap1-sampleimg.png}\n\\end{reviewimage}\n), actual
477
481
  end
478
482
 
479
483
  def test_indepimage_with_metric
480
- def @chapter.image(id)
481
- item = Book::ImageIndex::Item.new("sampleimg",1)
482
- item.instance_eval{@path="./images/chap1-sampleimg.png"}
484
+ def @chapter.image(_id)
485
+ item = Book::ImageIndex::Item.new('sampleimg', 1)
486
+ item.instance_eval { @path = './images/chap1-sampleimg.png' }
483
487
  item
484
488
  end
485
489
 
486
490
  actual = compile_block("//indepimage[sampleimg][sample photo][scale=1.2]\n")
487
- assert_equal %Q|\\begin{reviewimage}\n\\includegraphics[scale=1.2]{./images/chap1-sampleimg.png}\n\\reviewindepimagecaption{図: sample photo}\n\\end{reviewimage}\n|, actual
491
+ assert_equal %Q(\\begin{reviewimage}\n\\includegraphics[scale=1.2]{./images/chap1-sampleimg.png}\n\\reviewindepimagecaption{図: sample photo}\n\\end{reviewimage}\n), actual
488
492
  end
489
493
 
490
494
  def test_indepimage_with_metric_width
491
- def @chapter.image(id)
492
- item = Book::ImageIndex::Item.new("sampleimg",1)
493
- item.instance_eval{@path="./images/chap1-sampleimg.png"}
495
+ def @chapter.image(_id)
496
+ item = Book::ImageIndex::Item.new('sampleimg', 1)
497
+ item.instance_eval { @path = './images/chap1-sampleimg.png' }
494
498
  item
495
499
  end
496
500
 
497
- @config["image_scale2width"] = true
501
+ @config['image_scale2width'] = true
498
502
  actual = compile_block("//indepimage[sampleimg][sample photo][scale=1.2]\n")
499
- assert_equal %Q|\\begin{reviewimage}\n\\includegraphics[width=1.2\\maxwidth]{./images/chap1-sampleimg.png}\n\\reviewindepimagecaption{図: sample photo}\n\\end{reviewimage}\n|, actual
503
+ assert_equal %Q(\\begin{reviewimage}\n\\includegraphics[width=1.2\\maxwidth]{./images/chap1-sampleimg.png}\n\\reviewindepimagecaption{図: sample photo}\n\\end{reviewimage}\n), actual
500
504
  end
501
505
 
502
506
  def test_indepimage_with_metric2
503
- def @chapter.image(id)
504
- item = Book::ImageIndex::Item.new("sampleimg",1)
505
- item.instance_eval{@path="./images/chap1-sampleimg.png"}
507
+ def @chapter.image(_id)
508
+ item = Book::ImageIndex::Item.new('sampleimg', 1)
509
+ item.instance_eval { @path = './images/chap1-sampleimg.png' }
506
510
  item
507
511
  end
508
512
 
509
- actual = compile_block("//indepimage[sampleimg][sample photo][scale=1.2, html::class=\"sample\",latex::ignore=params]\n")
510
- assert_equal %Q|\\begin{reviewimage}\n\\includegraphics[scale=1.2,ignore=params]{./images/chap1-sampleimg.png}\n\\reviewindepimagecaption{図: sample photo}\n\\end{reviewimage}\n|, actual
513
+ actual = compile_block(%Q(//indepimage[sampleimg][sample photo][scale=1.2, html::class="sample",latex::ignore=params]\n))
514
+ assert_equal %Q(\\begin{reviewimage}\n\\includegraphics[scale=1.2,ignore=params]{./images/chap1-sampleimg.png}\n\\reviewindepimagecaption{図: sample photo}\n\\end{reviewimage}\n), actual
511
515
  end
512
516
 
513
517
  def test_indepimage_without_caption_but_with_metric
514
- def @chapter.image(id)
515
- item = Book::ImageIndex::Item.new("sampleimg",1)
516
- item.instance_eval{@path="./images/chap1-sampleimg.png"}
518
+ def @chapter.image(_id)
519
+ item = Book::ImageIndex::Item.new('sampleimg', 1)
520
+ item.instance_eval { @path = './images/chap1-sampleimg.png' }
517
521
  item
518
522
  end
519
523
 
520
524
  # FIXME: indepimage's caption should not be with a counter.
521
525
  actual = compile_block("//indepimage[sampleimg][][scale=1.2]\n")
522
- assert_equal %Q|\\begin{reviewimage}\n\\includegraphics[scale=1.2]{./images/chap1-sampleimg.png}\n\\end{reviewimage}\n|, actual
526
+ assert_equal %Q(\\begin{reviewimage}\n\\includegraphics[scale=1.2]{./images/chap1-sampleimg.png}\n\\end{reviewimage}\n), actual
523
527
  end
524
528
 
525
529
  def test_table
@@ -552,48 +556,50 @@ class LATEXBuidlerTest < Test::Unit::TestCase
552
556
  end
553
557
 
554
558
  def test_imgtable
555
- def @chapter.image(id)
556
- item = Book::ImageIndex::Item.new("sampleimg",1, 'sample img')
557
- item.instance_eval{@path="./images/chap1-sampleimg.png"}
559
+ def @chapter.image(_id)
560
+ item = Book::ImageIndex::Item.new('sampleimg', 1, 'sample img')
561
+ item.instance_eval { @path = './images/chap1-sampleimg.png' }
558
562
  item
559
563
  end
560
564
 
561
565
  actual = compile_block("//imgtable[sampleimg][test for imgtable]{\n//}\n")
562
566
 
563
- assert_equal "\\begin{table}[h]\n"+
564
- "\\reviewimgtablecaption{test for imgtable}\n"+
565
- "\\label{table:chap1:sampleimg}\n"+
566
- "\\begin{reviewimage}\n"+
567
- "\\includegraphics[width=\\maxwidth]{./images/chap1-sampleimg.png}\n"+
568
- "\\end{reviewimage}\n"+
569
- "\\end{table}\n",
570
- actual
567
+ expected = <<-EOS
568
+ \\begin{table}[h]
569
+ \\reviewimgtablecaption{test for imgtable}
570
+ \\label{table:chap1:sampleimg}
571
+ \\begin{reviewimage}
572
+ \\includegraphics[width=\\maxwidth]{./images/chap1-sampleimg.png}
573
+ \\end{reviewimage}
574
+ \\end{table}
575
+ EOS
576
+ assert_equal expected, actual
571
577
  end
572
578
 
573
579
  def test_bib
574
- def @chapter.bibpaper(id)
575
- Book::BibpaperIndex::Item.new("samplebib",1,"sample bib")
580
+ def @chapter.bibpaper(_id)
581
+ Book::BibpaperIndex::Item.new('samplebib', 1, 'sample bib')
576
582
  end
577
583
 
578
- assert_equal "\\reviewbibref{[1]}{bib:samplebib}", compile_inline("@<bib>{samplebib}")
584
+ assert_equal '\\reviewbibref{[1]}{bib:samplebib}', compile_inline('@<bib>{samplebib}')
579
585
  end
580
586
 
581
587
  def test_bibpaper
582
- def @chapter.bibpaper(id)
583
- Book::BibpaperIndex::Item.new("samplebib",1,"sample bib")
588
+ def @chapter.bibpaper(_id)
589
+ Book::BibpaperIndex::Item.new('samplebib', 1, 'sample bib')
584
590
  end
585
591
 
586
592
  actual = compile_block("//bibpaper[samplebib][sample bib @<b>{bold}]{\na\nb\n//}\n")
587
- assert_equal %Q|[1] sample bib \\textbf{bold}\n\\label{bib:samplebib}\n\nab\n\n|, actual
593
+ assert_equal %Q([1] sample bib \\textbf{bold}\n\\label{bib:samplebib}\n\nab\n\n), actual
588
594
  end
589
595
 
590
596
  def test_bibpaper_without_body
591
- def @chapter.bibpaper(id)
592
- Book::BibpaperIndex::Item.new("samplebib",1,"sample bib")
597
+ def @chapter.bibpaper(_id)
598
+ Book::BibpaperIndex::Item.new('samplebib', 1, 'sample bib')
593
599
  end
594
600
 
595
601
  actual = compile_block("//bibpaper[samplebib][sample bib]\n")
596
- assert_equal %Q|[1] sample bib\n\\label{bib:samplebib}\n\n|, actual
602
+ assert_equal %Q([1] sample bib\n\\label{bib:samplebib}\n\n), actual
597
603
  end
598
604
 
599
605
  def column_helper(review)
@@ -601,7 +607,7 @@ class LATEXBuidlerTest < Test::Unit::TestCase
601
607
  end
602
608
 
603
609
  def test_column_1
604
- review =<<-EOS
610
+ review = <<-EOS
605
611
  ===[column] prev column
606
612
 
607
613
  inside prev column
@@ -612,7 +618,7 @@ inside column
612
618
 
613
619
  ===[/column]
614
620
  EOS
615
- expected =<<-EOS
621
+ expected = <<-EOS
616
622
 
617
623
  \\begin{reviewcolumn}
618
624
  \\hypertarget{column:chap1:1}{}
@@ -632,19 +638,19 @@ inside column
632
638
 
633
639
  \\end{reviewcolumn}
634
640
  EOS
635
- @config["toclevel"] = 3
641
+ @config['toclevel'] = 3
636
642
  assert_equal expected, column_helper(review)
637
643
  end
638
644
 
639
645
  def test_column_2
640
- review =<<-EOS
646
+ review = <<-EOS
641
647
  ===[column] test
642
648
 
643
649
  inside column
644
650
 
645
651
  === next level
646
652
  EOS
647
- expected =<<-EOS
653
+ expected = <<-EOS
648
654
 
649
655
  \\begin{reviewcolumn}
650
656
  \\hypertarget{column:chap1:1}{}
@@ -658,29 +664,29 @@ inside column
658
664
  \\label{sec:1-0-1}
659
665
  EOS
660
666
 
661
- @config["toclevel"] = 1
667
+ @config['toclevel'] = 1
662
668
  assert_equal expected, column_helper(review)
663
669
  end
664
670
 
665
671
  def test_column_3
666
- review =<<-EOS
672
+ review = <<-EOS
667
673
  ===[column] test
668
674
 
669
675
  inside column
670
676
 
671
677
  ===[/column_dummy]
672
678
  EOS
673
- assert_raise(ReVIEW::CompileError) do
679
+ assert_raise(ReVIEW::ApplicationError) do
674
680
  column_helper(review)
675
681
  end
676
682
  end
677
683
 
678
684
  def test_ul
679
- src =<<-EOS
685
+ src = <<-EOS
680
686
  * AAA
681
687
  * BBB
682
688
  EOS
683
- expected =<<-EOS
689
+ expected = <<-EOS
684
690
 
685
691
  \\begin{itemize}
686
692
  \\item AAA
@@ -692,11 +698,11 @@ EOS
692
698
  end
693
699
 
694
700
  def test_ul_with_bracket
695
- src =<<-EOS
701
+ src = <<-EOS
696
702
  * AAA
697
703
  * []BBB
698
704
  EOS
699
- expected =<<-EOS
705
+ expected = <<-EOS
700
706
 
701
707
  \\begin{itemize}
702
708
  \\item AAA
@@ -708,13 +714,13 @@ EOS
708
714
  end
709
715
 
710
716
  def test_cont
711
- src =<<-EOS
717
+ src = <<-EOS
712
718
  * AAA
713
719
  -AA
714
720
  * BBB
715
721
  -BB
716
722
  EOS
717
- expected =<<-EOS
723
+ expected = <<-EOS
718
724
 
719
725
  \\begin{itemize}
720
726
  \\item AAA{-}AA
@@ -726,12 +732,12 @@ EOS
726
732
  end
727
733
 
728
734
  def test_ul_nest1
729
- src =<<-EOS
735
+ src = <<-EOS
730
736
  * AAA
731
737
  ** AA
732
738
  EOS
733
739
 
734
- expected =<<-EOS
740
+ expected = <<-EOS
735
741
 
736
742
  \\begin{itemize}
737
743
  \\item AAA
@@ -747,14 +753,14 @@ EOS
747
753
  end
748
754
 
749
755
  def test_ul_nest3
750
- src =<<-EOS
756
+ src = <<-EOS
751
757
  * AAA
752
758
  ** AA
753
759
  * BBB
754
760
  ** BB
755
761
  EOS
756
762
 
757
- expected =<<-EOS
763
+ expected = <<-EOS
758
764
 
759
765
  \\begin{itemize}
760
766
  \\item AAA
@@ -776,12 +782,12 @@ EOS
776
782
  end
777
783
 
778
784
  def test_ol
779
- src =<<-EOS
785
+ src = <<-EOS
780
786
  3. AAA
781
787
  3. BBB
782
788
  EOS
783
789
 
784
- expected =<<-EOS
790
+ expected = <<-EOS
785
791
 
786
792
  \\begin{enumerate}
787
793
  \\item AAA
@@ -793,11 +799,11 @@ EOS
793
799
  end
794
800
 
795
801
  def test_ol_with_bracket
796
- src =<<-EOS
802
+ src = <<-EOS
797
803
  1. AAA
798
804
  2. []BBB
799
805
  EOS
800
- expected =<<-EOS
806
+ expected = <<-EOS
801
807
 
802
808
  \\begin{enumerate}
803
809
  \\item AAA
@@ -843,38 +849,38 @@ EOS
843
849
  end
844
850
 
845
851
  def test_inline_raw0
846
- assert_equal "normal", compile_inline("@<raw>{normal}")
852
+ assert_equal 'normal', compile_inline('@<raw>{normal}')
847
853
  end
848
854
 
849
855
  def test_inline_raw1
850
- assert_equal "body", compile_inline("@<raw>{|latex|body}")
856
+ assert_equal 'body', compile_inline('@<raw>{|latex|body}')
851
857
  end
852
858
 
853
859
  def test_inline_raw2
854
- assert_equal "body", compile_inline("@<raw>{|html, latex|body}")
860
+ assert_equal 'body', compile_inline('@<raw>{|html, latex|body}')
855
861
  end
856
862
 
857
863
  def test_inline_raw3
858
- assert_equal "", compile_inline("@<raw>{|idgxml, html|body}")
864
+ assert_equal '', compile_inline('@<raw>{|idgxml, html|body}')
859
865
  end
860
866
 
861
867
  def test_inline_raw4
862
- assert_equal "|latex body", compile_inline("@<raw>{|latex body}")
868
+ assert_equal '|latex body', compile_inline('@<raw>{|latex body}')
863
869
  end
864
870
 
865
871
  def test_inline_raw5
866
- assert_equal "nor\nmal", compile_inline("@<raw>{|latex|nor\\nmal}")
872
+ assert_equal "nor\nmal", compile_inline('@<raw>{|latex|nor\\nmal}')
867
873
  end
868
874
 
869
875
  def test_inline_endash
870
- actual = compile_inline("- -- --- ----")
871
- assert_equal "{-} {-}{-} {-}{-}{-} {-}{-}{-}{-}", actual
876
+ actual = compile_inline('- -- --- ----')
877
+ assert_equal '{-} {-}{-} {-}{-}{-} {-}{-}{-}{-}', actual
872
878
  end
873
879
 
874
880
  def test_inline_imgref
875
- def @chapter.image(id)
876
- item = Book::ImageIndex::Item.new("sampleimg", 1, 'sample photo')
877
- item.instance_eval{@path="./images/chap1-sampleimg.png"}
881
+ def @chapter.image(_id)
882
+ item = Book::ImageIndex::Item.new('sampleimg', 1, 'sample photo')
883
+ item.instance_eval { @path = './images/chap1-sampleimg.png' }
878
884
  item
879
885
  end
880
886
 
@@ -884,9 +890,9 @@ EOS
884
890
  end
885
891
 
886
892
  def test_inline_imgref2
887
- def @chapter.image(id)
888
- item = Book::NumberlessImageIndex::Item.new("sampleimg", 1)
889
- item.instance_eval{@path="./images/chap1-sampleimg.png"}
893
+ def @chapter.image(_id)
894
+ item = Book::NumberlessImageIndex::Item.new('sampleimg', 1)
895
+ item.instance_eval { @path = './images/chap1-sampleimg.png' }
890
896
  item
891
897
  end
892
898
 
@@ -896,69 +902,74 @@ EOS
896
902
  end
897
903
 
898
904
  def test_block_raw0
899
- actual = compile_block("//raw[<>!\"\\n& ]\n")
900
- expected = %Q(<>!\"\n& )
905
+ actual = compile_block(%Q(//raw[<>!"\\n& ]\n))
906
+ expected = %Q(<>!"\n& )
901
907
  assert_equal expected, actual
902
908
  end
903
909
 
904
910
  def test_block_raw1
905
- actual = compile_block("//raw[|latex|<>!\"\\n& ]\n")
906
- expected = %Q(<>!\"\n& )
911
+ actual = compile_block(%Q(//raw[|latex|<>!"\\n& ]\n))
912
+ expected = %Q(<>!"\n& )
907
913
  assert_equal expected, actual
908
914
  end
909
915
 
910
916
  def test_block_raw2
911
- actual = compile_block("//raw[|html, latex|<>!\"\\n& ]\n")
912
- expected = %Q(<>!\"\n& )
917
+ actual = compile_block(%Q(//raw[|html, latex|<>!"\\n& ]\n))
918
+ expected = %Q(<>!"\n& )
913
919
  assert_equal expected, actual
914
920
  end
915
921
 
916
922
  def test_block_raw3
917
- actual = compile_block("//raw[|html, idgxml|<>!\"\\n& ]\n")
923
+ actual = compile_block(%Q(//raw[|html, idgxml|<>!"\\n& ]\n))
918
924
  expected = ''
919
925
  assert_equal expected, actual
920
926
  end
921
927
 
922
928
  def test_block_raw4
923
- actual = compile_block("//raw[|latex <>!\"\\n& ]\n")
924
- expected = %Q(|latex <>!\"\n& )
929
+ actual = compile_block(%Q(//raw[|latex <>!"\\n& ]\n))
930
+ expected = %Q(|latex <>!"\n& )
925
931
  assert_equal expected, actual
926
932
  end
927
933
 
928
934
  def test_comment
929
- actual = compile_block("//comment[コメント]")
930
- assert_equal %Q||, actual
935
+ actual = compile_block('//comment[コメント]')
936
+ assert_equal '', actual
931
937
  end
932
938
 
933
939
  def test_comment_for_draft
934
- @config["draft"] = true
935
- actual = compile_block("//comment[コメント]")
936
- assert_equal %Q|\\pdfcomment{コメント}\n|, actual
940
+ @config['draft'] = true
941
+ actual = compile_block('//comment[コメント]')
942
+ assert_equal %Q(\\pdfcomment{コメント}\n), actual
937
943
  end
938
944
 
939
945
  def test_inline_comment
940
- actual = compile_inline("test @<comment>{コメント} test2")
941
- assert_equal %Q|test test2|, actual
946
+ actual = compile_inline('test @<comment>{コメント} test2')
947
+ assert_equal 'test test2', actual
942
948
  end
943
949
 
944
950
  def test_inline_comment_for_draft
945
- @config["draft"] = true
946
- actual = compile_inline("test @<comment>{コメント} test2")
947
- assert_equal %Q|test \\pdfcomment{コメント} test2|, actual
951
+ @config['draft'] = true
952
+ actual = compile_inline('test @<comment>{コメント} test2')
953
+ assert_equal 'test \\pdfcomment{コメント} test2', actual
954
+ end
955
+
956
+ def test_inline_fence
957
+ actual = compile_inline('test @<code>|@<code>{$サンプル$}|')
958
+ assert_equal 'test \\texttt{@\\textless{}code\\textgreater{}\\{\\textdollar{}サンプル\\textdollar{}\\}}', actual
948
959
  end
949
960
 
950
961
  def test_appendix_list
951
962
  @chapter.instance_eval do
952
- def on_APPENDIX?
963
+ def on_appendix?
953
964
  true
954
965
  end
955
966
  end
956
- src =<<-EOS
967
+ src = <<-EOS
957
968
  @<list>{foo}
958
969
  //list[foo][FOO]{
959
970
  //}
960
971
  EOS
961
- expected =<<-EOS
972
+ expected = <<-EOS
962
973
 
963
974
  \\reviewlistref{A.1}
964
975
 
@@ -972,17 +983,17 @@ EOS
972
983
 
973
984
  def test_appendix_table
974
985
  @chapter.instance_eval do
975
- def on_APPENDIX?
986
+ def on_appendix?
976
987
  true
977
988
  end
978
989
  end
979
- src =<<-EOS
990
+ src = <<-EOS
980
991
  @<table>{foo}
981
992
  //table[foo][FOO]{
982
993
  A B
983
994
  //}
984
995
  EOS
985
- expected =<<-EOS
996
+ expected = <<-EOS
986
997
 
987
998
  \\reviewtableref{A.1}{table:chap1:foo}
988
999
 
@@ -1001,23 +1012,23 @@ EOS
1001
1012
 
1002
1013
  def test_appendix_image
1003
1014
  @chapter.instance_eval do
1004
- def on_APPENDIX?
1015
+ def on_appendix?
1005
1016
  true
1006
1017
  end
1007
1018
  end
1008
1019
 
1009
- def @chapter.image(id)
1010
- item = Book::NumberlessImageIndex::Item.new("sampleimg", 1)
1011
- item.instance_eval{@path="./images/chap1-sampleimg.png"}
1020
+ def @chapter.image(_id)
1021
+ item = Book::NumberlessImageIndex::Item.new('sampleimg', 1)
1022
+ item.instance_eval { @path = './images/chap1-sampleimg.png' }
1012
1023
  item
1013
1024
  end
1014
1025
 
1015
- src =<<-EOS
1026
+ src = <<-EOS
1016
1027
  @<img>{sampleimg}
1017
1028
  //image[sampleimg][FOO]{
1018
1029
  //}
1019
1030
  EOS
1020
- expected =<<-EOS
1031
+ expected = <<-EOS
1021
1032
 
1022
1033
  \\reviewimageref{A.1}{image:chap1:sampleimg}
1023
1034
 
@@ -1030,5 +1041,4 @@ EOS
1030
1041
  actual = compile_block(src)
1031
1042
  assert_equal expected, actual
1032
1043
  end
1033
-
1034
1044
  end