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,5 +1,3 @@
1
- # encoding: utf-8
2
-
3
1
  require 'test_helper'
4
2
  require 'tmpdir'
5
3
  require 'fileutils'
@@ -24,7 +22,7 @@ class PDFMakerCmdTest < Test::Unit::TestCase
24
22
  def test_pdfmaker_cmd
25
23
  if /mswin|mingw|cygwin/ !~ RUBY_PLATFORM
26
24
  config = prepare_samplebook(@tmpdir1)
27
- builddir = @tmpdir1 + "/" + config['bookname'] + '-pdf'
25
+ builddir = @tmpdir1 + '/' + config['bookname'] + '-pdf'
28
26
  assert !File.exist?(builddir)
29
27
 
30
28
  ruby_cmd = File.join(RbConfig::CONFIG['bindir'], RbConfig::CONFIG['ruby_install_name'])
@@ -1,5 +1,3 @@
1
- # encoding: utf-8
2
-
3
1
  require 'test_helper'
4
2
  require 'book_test_helper'
5
3
  require 'review/compiler'
@@ -22,11 +20,11 @@ end
22
20
 
23
21
  ReVIEW::Book::Base.clear_rubyenv ## to load review-ext.rb
24
22
  mktmpbookdir('CHAPS' => "ch01.re\n",
25
- "ch01.re" => "= test\n\ntest.\n",
26
- "review-ext.rb" => review_ext) do |dir, book, files|
23
+ 'ch01.re' => "= test\n\ntest.\n",
24
+ 'review-ext.rb' => review_ext) do |_dir, _book, _files|
27
25
  builder = ReVIEW::HTMLBuilder.new(false)
28
26
  ReVIEW::Compiler.new(builder)
29
- assert_equal "test", builder.builder_init_test
27
+ assert_equal 'test', builder.builder_init_test
30
28
  end
31
29
  end
32
30
  end
@@ -1,5 +1,3 @@
1
- # encoding: utf-8
2
-
3
1
  require 'test_helper'
4
2
  require 'review/compiler'
5
3
  require 'review/book'
@@ -10,12 +8,10 @@ class RSTBuidlerTest < Test::Unit::TestCase
10
8
  include ReVIEW
11
9
 
12
10
  def setup
13
- @builder = RSTBuilder.new()
11
+ @builder = RSTBuilder.new
14
12
  @config = ReVIEW::Configure.values
15
- @config.merge!({
16
- "secnolevel" => 2,
17
- "language" => "ja",
18
- })
13
+ @config['secnolevel'] = 2
14
+ @config['language'] = 'ja'
19
15
  @book = Book::Base.new(nil)
20
16
  @book.config = @config
21
17
  @compiler = ReVIEW::Compiler.new(@builder)
@@ -29,182 +25,182 @@ class RSTBuidlerTest < Test::Unit::TestCase
29
25
  puts msg
30
26
  end
31
27
  end
32
- I18n.setup(@config["language"])
28
+ I18n.setup(@config['language'])
33
29
  end
34
30
 
35
31
  def test_headline_level1
36
32
  actual = compile_block("={test} this is test.\n")
37
- assert_equal %Q|.. _test:\n\n==========================\nthis is test.\n==========================\n\n|, actual
33
+ assert_equal %Q(.. _test:\n\n==========================\nthis is test.\n==========================\n\n), actual
38
34
  end
39
35
 
40
36
  def test_headline_level1_without_secno
41
- @config["secnolevel"] = 0
37
+ @config['secnolevel'] = 0
42
38
  actual = compile_block("={test} this is test.\n")
43
- assert_equal %Q|.. _test:\n\n==========================\nthis is test.\n==========================\n\n|, actual
39
+ assert_equal %Q(.. _test:\n\n==========================\nthis is test.\n==========================\n\n), actual
44
40
  end
45
41
 
46
42
  def test_headline_level2
47
43
  actual = compile_block("=={test} this is test.\n")
48
- assert_equal %Q|.. _test:\n\nthis is test.\n==========================\n\n|, actual
44
+ assert_equal %Q(.. _test:\n\nthis is test.\n==========================\n\n), actual
49
45
  end
50
46
 
51
47
  def test_headline_level3
52
48
  actual = compile_block("==={test} this is test.\n")
53
- assert_equal %Q|.. _test:\n\nthis is test.\n--------------------------\n\n|, actual
49
+ assert_equal %Q(.. _test:\n\nthis is test.\n--------------------------\n\n), actual
54
50
  end
55
51
 
56
52
  def test_headline_level3_with_secno
57
- @config["secnolevel"] = 3
53
+ @config['secnolevel'] = 3
58
54
  actual = compile_block("==={test} this is test.\n")
59
- assert_equal %Q|.. _test:\n\nthis is test.\n--------------------------\n\n|, actual
55
+ assert_equal %Q(.. _test:\n\nthis is test.\n--------------------------\n\n), actual
60
56
  end
61
57
 
62
58
  def test_href
63
- actual = compile_inline("@<href>{http://github.com, GitHub}")
64
- assert_equal %Q| `GitHub <http://github.com>`_ |, actual
59
+ actual = compile_inline('@<href>{http://github.com, GitHub}')
60
+ assert_equal %Q( `GitHub <http://github.com>`_ ), actual
65
61
  end
66
62
 
67
63
  def test_href_without_label
68
- actual = compile_inline("@<href>{http://github.com}")
69
- assert_equal %Q| `http://github.com <http://github.com>`_ |, actual
64
+ actual = compile_inline('@<href>{http://github.com}')
65
+ assert_equal ' `http://github.com <http://github.com>`_ ', actual
70
66
  end
71
67
 
72
68
  def test_inline_raw
73
- actual = compile_inline("@<raw>{@<tt>{inline\}}")
74
- assert_equal %Q|@<tt>{inline}|, actual
69
+ actual = compile_inline('@<raw>{@<tt>{inline\}}')
70
+ assert_equal '@<tt>{inline}', actual
75
71
  end
76
72
 
77
73
  def test_inline_ruby
78
- actual = compile_inline("@<ruby>{coffin,bed}")
79
- assert_equal %Q| :ruby:`coffin`<bed>`_ |, actual
74
+ actual = compile_inline('@<ruby>{coffin,bed}')
75
+ assert_equal ' :ruby:`coffin`<bed>`_ ', actual
80
76
  end
81
77
 
82
78
  def test_inline_kw
83
- actual = compile_inline("@<kw>{ISO, International Organization for Standardization } @<kw>{Ruby<>}")
84
- assert_equal %Q| **ISO(International Organization for Standardization)** **Ruby<>** |, actual
79
+ actual = compile_inline('@<kw>{ISO, International Organization for Standardization } @<kw>{Ruby<>}')
80
+ assert_equal ' **ISO(International Organization for Standardization)** **Ruby<>** ', actual
85
81
  end
86
82
 
87
83
  def test_inline_maru
88
- actual = compile_inline("@<maru>{1}@<maru>{20}@<maru>{A}@<maru>{z}")
89
- assert_equal %Q| :maru:`1` :maru:`20` :maru:`A` :maru:`z` |, actual
84
+ actual = compile_inline('@<maru>{1}@<maru>{20}@<maru>{A}@<maru>{z}')
85
+ assert_equal ' :maru:`1` :maru:`20` :maru:`A` :maru:`z` ', actual
90
86
  end
91
87
 
92
88
  def test_inline_br
93
- actual = compile_inline("@<br>{}")
94
- assert_equal %Q|\n|, actual
89
+ actual = compile_inline('@<br>{}')
90
+ assert_equal "\n", actual
95
91
  end
96
92
 
97
93
  def test_inline_i
98
- actual = compile_inline("test @<i>{inline test} test2")
99
- assert_equal %Q|test *inline test* test2|, actual
94
+ actual = compile_inline('test @<i>{inline test} test2')
95
+ assert_equal 'test *inline test* test2', actual
100
96
  end
101
97
 
102
98
  def test_inline_i_and_escape
103
- actual = compile_inline("test @<i>{inline<&;\\ test} test2")
104
- assert_equal %Q|test *inline<&;\\ test* test2|, actual
99
+ actual = compile_inline('test @<i>{inline<&;\\ test} test2')
100
+ assert_equal 'test *inline<&;\\ test* test2', actual
105
101
  end
106
102
 
107
103
  def test_inline_b
108
- actual = compile_inline("test @<b>{inline test} test2")
109
- assert_equal %Q|test **inline test** test2|, actual
104
+ actual = compile_inline('test @<b>{inline test} test2')
105
+ assert_equal 'test **inline test** test2', actual
110
106
  end
111
107
 
112
108
  def test_inline_b_and_escape
113
- actual = compile_inline("test @<b>{inline<&;\\ test} test2")
114
- assert_equal %Q|test **inline<&;\\ test** test2|, actual
109
+ actual = compile_inline('test @<b>{inline<&;\\ test} test2')
110
+ assert_equal 'test **inline<&;\\ test** test2', actual
115
111
  end
116
112
 
117
113
  def test_inline_tt
118
- actual = compile_inline("test @<tt>{inline test} test2@<tt>{\\}}")
119
- assert_equal %Q|test ``inline test`` test2 ``}`` |, actual
114
+ actual = compile_inline('test @<tt>{inline test} test2@<tt>{\\}}')
115
+ assert_equal 'test ``inline test`` test2 ``}`` ', actual
120
116
  end
121
117
 
122
118
  def test_inline_tti
123
- actual = compile_inline("test @<tti>{inline test} test2")
124
- assert_equal %Q|test ``inline test`` test2|, actual
119
+ actual = compile_inline('test @<tti>{inline test} test2')
120
+ assert_equal 'test ``inline test`` test2', actual
125
121
  end
126
122
 
127
123
  def test_inline_ttb
128
- actual = compile_inline("test @<ttb>{inline test} test2")
129
- assert_equal %Q|test ``inline test`` test2|, actual
124
+ actual = compile_inline('test @<ttb>{inline test} test2')
125
+ assert_equal 'test ``inline test`` test2', actual
130
126
  end
131
127
 
132
128
  def test_inline_uchar
133
- actual = compile_inline("test @<uchar>{2460} test2")
134
- assert_equal %Q|test ① test2|, actual
129
+ actual = compile_inline('test @<uchar>{2460} test2')
130
+ assert_equal 'test ① test2', actual
135
131
  end
136
132
 
137
133
  def test_inline_comment
138
- actual = compile_inline("test @<comment>{コメント} test2")
139
- assert_equal %Q|test test2|, actual
134
+ actual = compile_inline('test @<comment>{コメント} test2')
135
+ assert_equal 'test test2', actual
140
136
  end
141
137
 
142
138
  def test_inline_comment_for_draft
143
- @config["draft"] = true
144
- actual = compile_inline("test @<comment>{コメント} test2")
145
- assert_equal %Q|test コメント test2|, actual
139
+ @config['draft'] = true
140
+ actual = compile_inline('test @<comment>{コメント} test2')
141
+ assert_equal 'test コメント test2', actual
146
142
  end
147
143
 
148
144
  def test_inline_in_table
149
145
  actual = compile_block("//table{\n★1☆\t▲2☆\n------------\n★3☆\t▲4☆<>&\n//}\n")
150
- assert_equal %Q| * - ★1☆\n - ▲2☆\n * - ★3☆\n - ▲4☆<>&\n\n|, actual
146
+ assert_equal %Q( * - ★1☆\n - ▲2☆\n * - ★3☆\n - ▲4☆<>&\n\n), actual
151
147
  end
152
148
 
153
149
  def test_emtable
154
150
  actual = compile_block("//emtable[foo]{\nA\n//}\n//emtable{\nA\n//}")
155
- assert_equal %Q|.. list-table:: foo\n :header-rows: 1\n\n * - A\n\n * - A\n\n|, actual
151
+ assert_equal %Q(.. list-table:: foo\n :header-rows: 1\n\n * - A\n\n * - A\n\n), actual
156
152
  end
157
153
 
158
154
  def test_paragraph
159
155
  actual = compile_block("foo\nbar\n")
160
- assert_equal %Q|foobar\n\n|, actual
156
+ assert_equal %Q(foobar\n\n), actual
161
157
  end
162
158
 
163
159
  def test_tabbed_paragraph
164
160
  actual = compile_block("\tfoo\nbar\n")
165
- assert_equal %Q|\tfoobar\n\n|, actual
161
+ assert_equal %Q(\tfoobar\n\n), actual
166
162
  end
167
163
 
168
164
  def test_flushright
169
165
  actual = compile_block("//flushright{\nfoo\nbar\n\nbuz\n//}\n")
170
- assert_equal %Q|.. flushright::\n\n foobar\nbuz\n\n|, actual
166
+ assert_equal %Q(.. flushright::\n\n foobar\nbuz\n\n), actual
171
167
  end
172
168
 
173
169
  def test_noindent
174
170
  actual = compile_block("//noindent\nfoo\nbar\n\nfoo2\nbar2\n")
175
- assert_equal %Q|foobar\n\nfoo2bar2\n\n|, actual
171
+ assert_equal %Q(foobar\n\nfoo2bar2\n\n), actual
176
172
  end
177
173
 
178
174
  def test_comment
179
- actual = compile_block("//comment[コメント]")
180
- assert_equal %Q|\n|, actual
175
+ actual = compile_block('//comment[コメント]')
176
+ assert_equal "\n", actual
181
177
  end
182
178
 
183
179
  def test_comment_for_draft
184
- @config["draft"] = true
185
- actual = compile_block("//comment[コメント]")
186
- assert_equal %Q|\n|, actual
180
+ @config['draft'] = true
181
+ actual = compile_block('//comment[コメント]')
182
+ assert_equal "\n", actual
187
183
  end
188
184
 
189
185
  def test_list
190
- def @chapter.list(id)
191
- Book::ListIndex::Item.new("test",1)
186
+ def @chapter.list(_id)
187
+ Book::ListIndex::Item.new('test', 1)
192
188
  end
193
189
  actual = compile_block("//list[samplelist][this is @<b>{test}<&>_]{\nfoo\nbar\n//}\n")
194
- assert_equal %Q|.. _samplelist:\n\n-foo\n-bar\n|, actual
190
+ assert_equal %Q(.. _samplelist:\n\n-foo\n-bar\n), actual
195
191
  end
196
192
 
197
193
  def test_listnum
198
- def @chapter.list(id)
199
- Book::ListIndex::Item.new("test",1)
194
+ def @chapter.list(_id)
195
+ Book::ListIndex::Item.new('test', 1)
200
196
  end
201
197
  actual = compile_block("//listnum[test][this is @<b>{test}<&>_]{\nfoo\nbar\n//}\n")
202
- assert_equal %Q|.. _test:\n\n1\n2\n\n|, actual
198
+ assert_equal %Q(.. _test:\n\n1\n2\n\n), actual
203
199
  end
204
200
 
205
201
  def test_emlistnum
206
202
  actual = compile_block("//emlistnum[this is @<b>{test}<&>_]{\nfoo\nbar\n//}\n")
207
- assert_equal %Q|this is @<b>{test}<&>_\n\n.. code-block:: none\n :linenos:\n\n foo\n bar\n\n|, actual
203
+ assert_equal %Q(this is @<b>{test}<&>_\n\n.. code-block:: none\n :linenos:\n\n foo\n bar\n\n), actual
208
204
  end
209
205
 
210
206
  def test_major_blocks
@@ -242,25 +238,25 @@ class RSTBuidlerTest < Test::Unit::TestCase
242
238
  end
243
239
 
244
240
  def test_image
245
- def @chapter.image(id)
246
- item = Book::ImageIndex::Item.new("sampleimg",1)
247
- item.instance_eval{@path="./images/chap1-sampleimg.png"}
241
+ def @chapter.image(_id)
242
+ item = Book::ImageIndex::Item.new('sampleimg', 1)
243
+ item.instance_eval { @path = './images/chap1-sampleimg.png' }
248
244
  item
249
245
  end
250
246
 
251
247
  actual = compile_block("//image[sampleimg][sample photo]{\nfoo\n//}\n")
252
- assert_equal %Q|.. _sampleimg:\n\n.. figure:: images/-/sampleimg.png\n\n sample photo\n\n|, actual
248
+ assert_equal %Q(.. _sampleimg:\n\n.. figure:: images/-/sampleimg.png\n\n sample photo\n\n), actual
253
249
  end
254
250
 
255
251
  def test_image_with_metric
256
- def @chapter.image(id)
257
- item = Book::ImageIndex::Item.new("sampleimg",1)
258
- item.instance_eval{@path="./images/chap1-sampleimg.png"}
252
+ def @chapter.image(_id)
253
+ item = Book::ImageIndex::Item.new('sampleimg', 1)
254
+ item.instance_eval { @path = './images/chap1-sampleimg.png' }
259
255
  item
260
256
  end
261
257
 
262
258
  actual = compile_block("//image[sampleimg][sample photo][scale=1.2]{\nfoo\n//}\n")
263
- assert_equal %Q|.. _sampleimg:\n\n.. figure:: images/-/sampleimg.png\n :scale:120.0%\n\n sample photo\n\n|, actual
259
+ assert_equal %Q(.. _sampleimg:\n\n.. figure:: images/-/sampleimg.png\n :scale:120.0%\n\n sample photo\n\n), actual
264
260
  end
265
261
 
266
262
  def test_texequation
@@ -275,57 +271,57 @@ EOS
275
271
  end
276
272
 
277
273
  def test_inline_raw0
278
- assert_equal "normal", compile_inline("@<raw>{normal}")
274
+ assert_equal 'normal', compile_inline('@<raw>{normal}')
279
275
  end
280
276
 
281
277
  def test_inline_raw1
282
- assert_equal "body", compile_inline("@<raw>{|top|body}")
278
+ assert_equal 'body', compile_inline('@<raw>{|top|body}')
283
279
  end
284
280
 
285
281
  def test_inline_raw2
286
- assert_equal "body", compile_inline("@<raw>{|top, latex|body}")
282
+ assert_equal 'body', compile_inline('@<raw>{|top, latex|body}')
287
283
  end
288
284
 
289
285
  def test_inline_raw3
290
- assert_equal "body", compile_inline("@<raw>{|idgxml, html|body}")
286
+ assert_equal 'body', compile_inline('@<raw>{|idgxml, html|body}')
291
287
  end
292
288
 
293
289
  def test_inline_raw4
294
- assert_equal "|top body", compile_inline("@<raw>{|top body}")
290
+ assert_equal '|top body', compile_inline('@<raw>{|top body}')
295
291
  end
296
292
 
297
293
  def test_inline_raw5
298
- assert_equal "nor\nmal", compile_inline("@<raw>{|top|nor\\nmal}")
294
+ assert_equal "nor\nmal", compile_inline('@<raw>{|top|nor\\nmal}')
299
295
  end
300
296
 
301
297
  def test_block_raw0
302
- actual = compile_block("//raw[<>!\"\\n& ]\n")
303
- expected = %Q(<>!\"\n& )
304
- assert_equal expected.chomp, actual
298
+ actual = compile_block(%Q(//raw[<>!"\\n& ]\n))
299
+ expected = %Q(<>!"\n& )
300
+ assert_equal expected, actual
305
301
  end
306
302
 
307
303
  def test_block_raw1
308
- actual = compile_block("//raw[|top|<>!\"\\n& ]\n")
304
+ actual = compile_block(%Q(//raw[|top|<>!"\\n& ]\n))
309
305
  expected = ''
310
- assert_equal expected.chomp, actual
306
+ assert_equal expected, actual
311
307
  end
312
308
 
313
309
  def test_block_raw2
314
- actual = compile_block("//raw[|top, latex|<>!\"\\n& ]\n")
310
+ actual = compile_block(%Q(//raw[|top, latex|<>!"\\n& ]\n))
315
311
  expected = ''
316
- assert_equal expected.chomp, actual
312
+ assert_equal expected, actual
317
313
  end
318
314
 
319
315
  def test_block_raw3
320
- actual = compile_block("//raw[|latex, idgxml|<>!\"\\n& ]\n")
316
+ actual = compile_block(%Q(//raw[|latex, idgxml|<>!"\\n& ]\n))
321
317
  expected = ''
322
- assert_equal expected.chomp, actual
318
+ assert_equal expected, actual
323
319
  end
324
320
 
325
321
  def test_block_raw4
326
- actual = compile_block("//raw[|top <>!\"\\n& ]\n")
327
- expected = %Q(|top <>!\"\n& )
328
- assert_equal expected.chomp, actual
322
+ actual = compile_block(%Q(//raw[|top <>!"\\n& ]\n))
323
+ expected = %Q(|top <>!"\n& )
324
+ assert_equal expected, actual
329
325
  end
330
326
 
331
327
  def column_helper(review)
@@ -333,7 +329,7 @@ EOS
333
329
  end
334
330
 
335
331
  def test_column_ref
336
- review =<<-EOS
332
+ review = <<-EOS
337
333
  ===[column]{foo} test
338
334
 
339
335
  inside column
@@ -342,7 +338,7 @@ inside column
342
338
 
343
339
  this is @<column>{foo}.
344
340
  EOS
345
- expected =<<-EOS
341
+ expected = <<-EOS
346
342
  .. column:: test
347
343
 
348
344
  inside column
@@ -357,5 +353,4 @@ EOS
357
353
 
358
354
  assert_equal expected, column_helper(review)
359
355
  end
360
-
361
356
  end
@@ -1,5 +1,3 @@
1
- # encoding: utf-8
2
-
3
1
  require 'test_helper'
4
2
  require 'review/template'
5
3
 
@@ -13,15 +11,13 @@ class TemplateTest < Test::Unit::TestCase
13
11
  def test_load
14
12
  tmplfile = File.expand_path('./assets/test.xml.erb', File.dirname(__FILE__))
15
13
  tmpl = ReVIEW::Template.load(tmplfile)
16
- assert_equal("<test>\n<name></name>\n</test>\n",tmpl.result(binding))
14
+ assert_equal("<test>\n<name></name>\n</test>\n", tmpl.result(binding))
17
15
  end
18
16
 
19
17
  def test_open_with_value
20
18
  tmplfile = File.expand_path('./assets/test.xml.erb', File.dirname(__FILE__))
21
19
  tmpl = ReVIEW::Template.load(tmplfile)
22
- @name = "test"
23
- assert_equal("<test>\n<name>test</name>\n</test>\n",tmpl.result(binding))
20
+ @name = 'test'
21
+ assert_equal("<test>\n<name>test</name>\n</test>\n", tmpl.result(binding))
24
22
  end
25
23
  end
26
-
27
-