review 3.2.0 → 5.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby-tex.yml +31 -0
- data/.github/workflows/ruby-win.yml +45 -0
- data/.github/workflows/ruby.yml +27 -0
- data/.rubocop.yml +167 -42
- data/.travis.yml +1 -1
- data/Dockerfile +21 -5
- data/NEWS.ja.md +428 -1
- data/NEWS.md +429 -2
- data/README.md +11 -7
- data/Rakefile +7 -2
- data/appveyor.yml +0 -20
- data/bin/review +2 -4
- data/bin/review-catalog-converter +5 -5
- data/bin/review-check +13 -17
- data/bin/review-checkdep +3 -6
- data/bin/review-compile +13 -22
- data/bin/review-epub2html +1 -4
- data/bin/review-epubmaker +3 -4
- data/bin/review-idgxmlmaker +14 -0
- data/bin/review-index +5 -86
- data/bin/review-init +1 -4
- data/bin/review-pdfmaker +1 -3
- data/bin/review-preproc +11 -13
- data/bin/review-textmaker +1 -3
- data/bin/review-update +1 -4
- data/bin/review-validate +7 -7
- data/bin/review-vol +5 -82
- data/bin/review-webmaker +1 -3
- data/doc/config.yml.sample +67 -16
- data/doc/config.yml.sample-simple +4 -3
- data/doc/format.ja.md +133 -21
- data/doc/format.md +135 -34
- data/doc/makeindex.ja.md +2 -2
- data/doc/pdfmaker.ja.md +43 -1
- data/doc/pdfmaker.md +42 -1
- data/doc/quickstart.ja.md +55 -25
- data/doc/quickstart.md +47 -17
- data/lib/review.rb +1 -1
- data/lib/review/book.rb +2 -2
- data/lib/review/book/base.rb +89 -90
- data/lib/review/book/bib.rb +21 -0
- data/lib/review/book/book_unit.rb +158 -0
- data/lib/review/book/chapter.rb +51 -29
- data/lib/review/book/index.rb +42 -248
- data/lib/review/book/index/item.rb +46 -0
- data/lib/review/book/page_metric.rb +7 -7
- data/lib/review/book/part.rb +45 -10
- data/lib/review/book/volume.rb +5 -5
- data/lib/review/builder.rb +171 -54
- data/lib/review/call_hook.rb +20 -0
- data/lib/review/catalog.rb +15 -17
- data/lib/review/compiler.rb +240 -102
- data/lib/review/configure.rb +101 -12
- data/lib/review/converter.rb +1 -1
- data/lib/review/epub2html.rb +6 -1
- data/lib/review/epubmaker.rb +120 -118
- data/lib/review/epubmaker/content.rb +113 -0
- data/lib/review/epubmaker/epubcommon.rb +372 -0
- data/lib/review/epubmaker/epubv2.rb +178 -0
- data/lib/review/epubmaker/epubv3.rb +231 -0
- data/lib/review/epubmaker/producer.rb +168 -0
- data/lib/review/epubmaker/reviewheaderlistener.rb +12 -2
- data/lib/review/epubmaker/zip_exporter.rb +84 -0
- data/lib/review/exception.rb +6 -0
- data/lib/review/extentions/string.rb +0 -4
- data/lib/review/htmlbuilder.rb +147 -149
- data/lib/review/htmlutils.rb +10 -14
- data/lib/review/i18n.rb +4 -3
- data/lib/review/idgxmlbuilder.rb +229 -103
- data/lib/review/idgxmlmaker.rb +188 -0
- data/lib/review/img_math.rb +245 -0
- data/lib/review/index_builder.rb +654 -0
- data/lib/review/init-web/finish.html +10 -0
- data/lib/review/init-web/index.html +190 -0
- data/lib/review/init-web/review-layout-design.js +691 -0
- data/lib/review/init.rb +124 -41
- data/lib/review/latexbox.rb +58 -0
- data/lib/review/latexbuilder.rb +249 -97
- data/lib/review/latexutils.rb +9 -1
- data/lib/review/lineinput.rb +113 -3
- data/lib/review/logger.rb +43 -8
- data/lib/review/makerhelper.rb +13 -186
- data/lib/review/markdownbuilder.rb +75 -39
- data/lib/review/md2inaobuilder.rb +3 -5
- data/lib/review/pdfmaker.rb +88 -83
- data/lib/review/plaintextbuilder.rb +158 -83
- data/lib/review/preprocessor.rb +30 -24
- data/lib/review/rstbuilder.rb +58 -39
- data/lib/review/sec_counter.rb +14 -0
- data/lib/review/template.rb +6 -0
- data/lib/review/textmaker.rb +29 -17
- data/lib/review/textutils.rb +68 -2
- data/lib/review/tocprinter.rb +242 -97
- data/lib/review/topbuilder.rb +147 -61
- data/lib/review/update.rb +27 -28
- data/lib/review/version.rb +1 -1
- data/lib/review/volumeprinter.rb +97 -0
- data/lib/review/webmaker.rb +36 -35
- data/lib/review/webtocprinter.rb +39 -35
- data/lib/review/yamlloader.rb +4 -0
- data/review.gemspec +8 -5
- data/samples/sample-book/README.md +7 -2
- data/samples/sample-book/src/.gitignore +154 -0
- data/samples/sample-book/src/config-ebook.yml +4 -0
- data/samples/sample-book/src/config-epub2.yml +1 -1
- data/samples/sample-book/src/config-jlreq-ebook.yml +4 -0
- data/samples/sample-book/src/config-jlreq.yml +6 -0
- data/samples/sample-book/src/config.yml +3 -3
- data/samples/sample-book/src/lib/tasks/review.rake +45 -14
- data/samples/sample-book/src/lib/tasks/z01_copy_sty.rake +14 -8
- data/samples/syntax-book/Gemfile +1 -1
- data/samples/syntax-book/ch01.re +3 -1
- data/samples/syntax-book/ch02.re +28 -21
- data/samples/syntax-book/ch03.re +4 -7
- data/samples/syntax-book/config-jlreq-lualatex.yml +4 -0
- data/samples/syntax-book/config-jlreq.yml +5 -0
- data/samples/syntax-book/config-print.yml +3 -0
- data/samples/syntax-book/config.yml +1 -1
- data/samples/syntax-book/images/img3-2.png +0 -0
- data/samples/syntax-book/lib/tasks/review.rake +30 -15
- data/samples/syntax-book/lib/tasks/z01_copy_sty.rake +14 -8
- data/templates/html/_colophon.html.erb +23 -0
- data/templates/html/_colophon_history.html.erb +9 -0
- data/templates/html/_cover.html.erb +10 -0
- data/templates/html/_part_body.html.erb +6 -0
- data/templates/html/_titlepage.html.erb +20 -0
- data/templates/html/layout-html5.html.erb +6 -0
- data/templates/html/layout-xhtml1.html.erb +6 -0
- data/templates/latex/config.erb +45 -27
- data/templates/latex/layout.tex.erb +1 -0
- data/templates/latex/review-jlreq/README.md +3 -1
- data/templates/latex/review-jlreq/review-base.sty +124 -37
- data/templates/latex/review-jlreq/review-jlreq.cls +29 -22
- data/templates/latex/review-jlreq/review-style.sty +9 -1
- data/templates/latex/review-jlreq/review-tcbox.sty +348 -0
- data/templates/latex/review-jlreq/reviewmacro.sty +5 -0
- data/templates/latex/review-jsbook/README.md +46 -5
- data/templates/latex/review-jsbook/review-base.sty +111 -30
- data/templates/latex/review-jsbook/review-jsbook.cls +16 -2
- data/templates/latex/review-jsbook/review-style.sty +10 -2
- data/templates/latex/review-jsbook/review-tcbox.sty +348 -0
- data/templates/latex/review-jsbook/reviewmacro.sty +5 -0
- data/templates/opf/epubv2.opf.erb +7 -7
- data/templates/opf/epubv3.opf.erb +7 -7
- data/templates/opf/opf_manifest_epubv2.opf.erb +10 -0
- data/templates/opf/opf_manifest_epubv3.opf.erb +10 -0
- data/templates/opf/opf_metainfo_epubv2.opf.erb +17 -0
- data/templates/opf/opf_metainfo_epubv3.opf.erb +49 -0
- data/templates/opf/opf_tocx_epubv2.opf.erb +9 -0
- data/templates/opf/opf_tocx_epubv3.opf.erb +17 -0
- data/templates/web/html/layout-html5.html.erb +9 -8
- data/templates/web/html/layout-xhtml1.html.erb +6 -0
- data/test/assets/header_listener.html +35 -0
- data/test/assets/img_math/img1.png +0 -0
- data/test/assets/img_math/img2.png +0 -0
- data/test/assets/img_math/img3.png +0 -0
- data/test/assets/syntax_book_index_detail.txt +58 -0
- data/test/assets/test_template.tex +20 -9
- data/test/assets/test_template_backmatter.tex +20 -9
- data/test/book_test_helper.rb +11 -5
- data/test/run_test.rb +1 -1
- data/test/test_book.rb +123 -78
- data/test/test_book_chapter.rb +99 -56
- data/test/test_book_part.rb +3 -3
- data/test/test_builder.rb +24 -15
- data/test/test_catalog.rb +19 -42
- data/test/test_catalog_converter_cmd.rb +1 -1
- data/test/test_converter.rb +1 -0
- data/test/test_epub3maker.rb +170 -126
- data/test/test_epubmaker.rb +249 -129
- data/test/test_epubmaker_cmd.rb +16 -9
- data/test/test_helper.rb +23 -11
- data/test/test_htmlbuilder.rb +1083 -114
- data/test/test_htmlutils.rb +0 -12
- data/test/test_i18n.rb +37 -37
- data/test/test_idgxmlbuilder.rb +627 -27
- data/test/test_idgxmlmaker_cmd.rb +50 -0
- data/test/test_image_finder.rb +52 -70
- data/test/test_img_math.rb +111 -0
- data/test/test_index.rb +62 -52
- data/test/test_indexbuilder.rb +52 -0
- data/test/test_latexbuilder.rb +1189 -59
- data/test/test_latexbuilder_v2.rb +74 -34
- data/test/test_lineinput.rb +20 -93
- data/test/test_logger.rb +17 -4
- data/test/test_makerhelper.rb +2 -14
- data/test/test_markdownbuilder.rb +77 -4
- data/test/test_md2inaobuilder.rb +12 -2
- data/test/test_pdfmaker.rb +101 -12
- data/test/test_pdfmaker_cmd.rb +102 -8
- data/test/test_plaintextbuilder.rb +562 -31
- data/test/test_review_ext.rb +2 -1
- data/test/test_reviewheaderlistener.rb +49 -0
- data/test/test_rstbuilder.rb +58 -5
- data/test/test_sec_counter.rb +156 -0
- data/test/test_template.rb +12 -2
- data/test/test_textmaker_cmd.rb +58 -0
- data/test/test_textutils.rb +109 -2
- data/test/test_tocprinter.rb +46 -0
- data/test/test_topbuilder.rb +400 -17
- data/test/test_update.rb +53 -44
- data/test/test_webtocprinter.rb +75 -43
- data/test/test_yamlloader.rb +13 -0
- data/test/test_zip_exporter.rb +5 -6
- data/vendor/gentombow/LICENSE +1 -1
- data/vendor/gentombow/Makefile +0 -1
- data/vendor/gentombow/bounddvi-en.pdf +0 -0
- data/vendor/gentombow/bounddvi-en.tex +1 -0
- data/vendor/gentombow/bounddvi.pdf +0 -0
- data/vendor/gentombow/bounddvi.sty +30 -7
- data/vendor/gentombow/bounddvi.tex +1 -0
- data/vendor/gentombow/create_archive.sh +1 -0
- data/vendor/gentombow/gentombow-ja.pdf +0 -0
- data/vendor/gentombow/gentombow-ja.tex +9 -0
- data/vendor/gentombow/gentombow.pdf +0 -0
- data/vendor/gentombow/gentombow.sty +32 -10
- data/vendor/gentombow/gentombow.tex +8 -0
- data/vendor/gentombow/tests/gentombow-01-pdfx.tex +8 -0
- data/vendor/gentombow/tests/gentombow-02-pdfx.tex +8 -0
- data/vendor/jsclasses/LICENSE +1 -1
- data/vendor/jsclasses/Makefile +3 -2
- data/vendor/jsclasses/create_archive.sh +5 -5
- data/vendor/jsclasses/jis/Makefile +3 -2
- data/vendor/jsclasses/jis/jsarticle.cls +74 -31
- data/vendor/jsclasses/jis/jsbook.cls +74 -31
- data/vendor/jsclasses/jis/jsclasses.dtx +176 -36
- data/vendor/jsclasses/jis/jsclasses.ins +15 -5
- data/vendor/jsclasses/jis/jslogo.dtx +4 -4
- data/vendor/jsclasses/jis/jslogo.ins +9 -0
- data/vendor/jsclasses/jis/jslogo.sty +4 -16
- data/vendor/jsclasses/jis/jspf.cls +73 -30
- data/vendor/jsclasses/jis/jsreport.cls +74 -31
- data/vendor/jsclasses/jis/jsverb.ins +9 -0
- data/vendor/jsclasses/jis/jsverb.sty +1 -13
- data/vendor/jsclasses/jis/kiyou.cls +74 -31
- data/vendor/jsclasses/jis/minijs.sty +65 -22
- data/vendor/jsclasses/jis/okumacro.dtx +4 -5
- data/vendor/jsclasses/jis/okumacro.ins +9 -0
- data/vendor/jsclasses/jis/okumacro.sty +4 -17
- data/vendor/jsclasses/jis/okuverb.ins +9 -0
- data/vendor/jsclasses/jis/okuverb.sty +1 -13
- data/vendor/jsclasses/jis/winjis.sty +23 -19
- data/vendor/jsclasses/jsarticle.cls +74 -31
- data/vendor/jsclasses/jsbook.cls +74 -31
- data/vendor/jsclasses/jsclasses.dtx +176 -36
- data/vendor/jsclasses/jsclasses.ins +15 -5
- data/vendor/jsclasses/jsclasses.pdf +0 -0
- data/vendor/jsclasses/jslogo.dtx +4 -4
- data/vendor/jsclasses/jslogo.ins +9 -0
- data/vendor/jsclasses/jslogo.pdf +0 -0
- data/vendor/jsclasses/jslogo.sty +4 -16
- data/vendor/jsclasses/jspf.cls +73 -30
- data/vendor/jsclasses/jsreport.cls +74 -31
- data/vendor/jsclasses/jsverb.ins +9 -0
- data/vendor/jsclasses/jsverb.pdf +0 -0
- data/vendor/jsclasses/jsverb.sty +1 -13
- data/vendor/jsclasses/kiyou.cls +74 -31
- data/vendor/jsclasses/minijs.sty +68 -22
- data/vendor/jsclasses/okumacro.dtx +4 -5
- data/vendor/jsclasses/okumacro.ins +9 -0
- data/vendor/jsclasses/okumacro.pdf +0 -0
- data/vendor/jsclasses/okumacro.sty +4 -17
- data/vendor/jsclasses/okuverb.ins +9 -0
- data/vendor/jsclasses/okuverb.pdf +0 -0
- data/vendor/jsclasses/okuverb.sty +1 -13
- data/vendor/jsclasses/tests/relfont.tex +10 -0
- data/vendor/jsclasses/winjis.sty +23 -19
- metadata +136 -23
- data/.rubocop_todo.yml +0 -7
- data/lib/epubmaker.rb +0 -23
- data/lib/epubmaker/content.rb +0 -110
- data/lib/epubmaker/epubcommon.rb +0 -441
- data/lib/epubmaker/epubv2.rb +0 -143
- data/lib/epubmaker/epubv3.rb +0 -233
- data/lib/epubmaker/producer.rb +0 -375
- data/lib/epubmaker/zip_exporter.rb +0 -81
- data/lib/lineinput.rb +0 -155
- data/lib/review/book/compilable.rb +0 -173
- data/lib/review/tocparser.rb +0 -271
- data/samples/syntax-book/review-ext.rb +0 -14
- data/test/test_tocparser.rb +0 -25
@@ -90,9 +90,16 @@ class PLAINTEXTBuidlerTest < Test::Unit::TestCase
|
|
90
90
|
assert_equal "\n", actual
|
91
91
|
end
|
92
92
|
|
93
|
-
def
|
94
|
-
|
95
|
-
|
93
|
+
def test_inline_asis
|
94
|
+
%w[i b tti ttb bou ami u strong em code ins tcy].each do |tag|
|
95
|
+
actual = compile_inline("test @<#{tag}>{inline test} test2")
|
96
|
+
assert_equal 'test inline test test2', actual
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
def test_inline_del
|
101
|
+
actual = compile_inline('test @<del>{inline test} test2')
|
102
|
+
assert_equal 'test test2', actual
|
96
103
|
end
|
97
104
|
|
98
105
|
def test_inline_i_and_escape
|
@@ -100,11 +107,6 @@ class PLAINTEXTBuidlerTest < Test::Unit::TestCase
|
|
100
107
|
assert_equal 'test inline<&;\\ test test2', actual
|
101
108
|
end
|
102
109
|
|
103
|
-
def test_inline_b
|
104
|
-
actual = compile_inline('test @<b>{inline test} test2')
|
105
|
-
assert_equal 'test inline test test2', actual
|
106
|
-
end
|
107
|
-
|
108
110
|
def test_inline_b_and_escape
|
109
111
|
actual = compile_inline('test @<b>{inline<&;\\ test} test2')
|
110
112
|
assert_equal 'test inline<&;\\ test test2', actual
|
@@ -115,16 +117,6 @@ class PLAINTEXTBuidlerTest < Test::Unit::TestCase
|
|
115
117
|
assert_equal 'test inline test test2}', actual
|
116
118
|
end
|
117
119
|
|
118
|
-
def test_inline_tti
|
119
|
-
actual = compile_inline('test @<tti>{inline test} test2')
|
120
|
-
assert_equal 'test inline test test2', actual
|
121
|
-
end
|
122
|
-
|
123
|
-
def test_inline_ttb
|
124
|
-
actual = compile_inline('test @<ttb>{inline test} test2')
|
125
|
-
assert_equal 'test inline test test2', actual
|
126
|
-
end
|
127
|
-
|
128
120
|
def test_inline_uchar
|
129
121
|
actual = compile_inline('test @<uchar>{2460} test2')
|
130
122
|
assert_equal 'test ① test2', actual
|
@@ -176,11 +168,19 @@ EOS
|
|
176
168
|
def test_paragraph
|
177
169
|
actual = compile_block("foo\nbar\n")
|
178
170
|
assert_equal %Q(foobar\n), actual
|
171
|
+
|
172
|
+
@book.config['join_lines_by_lang'] = true
|
173
|
+
actual = compile_block("foo\nbar\n")
|
174
|
+
assert_equal %Q(foo bar\n), actual
|
179
175
|
end
|
180
176
|
|
181
177
|
def test_tabbed_paragraph
|
182
178
|
actual = compile_block("\tfoo\nbar\n")
|
183
179
|
assert_equal %Q(\tfoobar\n), actual
|
180
|
+
|
181
|
+
@book.config['join_lines_by_lang'] = true
|
182
|
+
actual = compile_block("\tfoo\nbar\n")
|
183
|
+
assert_equal %Q(\tfoo bar\n), actual
|
184
184
|
end
|
185
185
|
|
186
186
|
def test_flushright
|
@@ -189,6 +189,15 @@ EOS
|
|
189
189
|
foobar
|
190
190
|
buz
|
191
191
|
|
192
|
+
EOS
|
193
|
+
assert_equal expected, actual
|
194
|
+
|
195
|
+
@book.config['join_lines_by_lang'] = true
|
196
|
+
actual = compile_block("//flushright{\nfoo\nbar\n\nbuz\n//}\n")
|
197
|
+
expected = <<-EOS
|
198
|
+
foo bar
|
199
|
+
buz
|
200
|
+
|
192
201
|
EOS
|
193
202
|
assert_equal expected, actual
|
194
203
|
end
|
@@ -198,6 +207,14 @@ EOS
|
|
198
207
|
expected = <<-EOS
|
199
208
|
foobar
|
200
209
|
foo2bar2
|
210
|
+
EOS
|
211
|
+
assert_equal expected, actual
|
212
|
+
|
213
|
+
@book.config['join_lines_by_lang'] = true
|
214
|
+
actual = compile_block("//noindent\nfoo\nbar\n\nfoo2\nbar2\n")
|
215
|
+
expected = <<-EOS
|
216
|
+
foo bar
|
217
|
+
foo2 bar2
|
201
218
|
EOS
|
202
219
|
assert_equal expected, actual
|
203
220
|
end
|
@@ -215,7 +232,7 @@ EOS
|
|
215
232
|
|
216
233
|
def test_list
|
217
234
|
def @chapter.list(_id)
|
218
|
-
Book::
|
235
|
+
Book::Index::Item.new('test', 1)
|
219
236
|
end
|
220
237
|
actual = compile_block("//list[samplelist][this is @<b>{test}<&>_]{\nfoo\nbar\n//}\n")
|
221
238
|
expected = <<-EOS
|
@@ -224,13 +241,24 @@ EOS
|
|
224
241
|
foo
|
225
242
|
bar
|
226
243
|
|
244
|
+
EOS
|
245
|
+
assert_equal expected, actual
|
246
|
+
|
247
|
+
@config['caption_position']['list'] = 'bottom'
|
248
|
+
actual = compile_block("//list[samplelist][this is @<b>{test}<&>_]{\nfoo\nbar\n//}\n")
|
249
|
+
expected = <<-EOS
|
250
|
+
foo
|
251
|
+
bar
|
252
|
+
|
253
|
+
リスト1.1 this is test<&>_
|
254
|
+
|
227
255
|
EOS
|
228
256
|
assert_equal expected, actual
|
229
257
|
end
|
230
258
|
|
231
259
|
def test_listnum
|
232
260
|
def @chapter.list(_id)
|
233
|
-
Book::
|
261
|
+
Book::Index::Item.new('test', 1)
|
234
262
|
end
|
235
263
|
actual = compile_block("//listnum[test][this is @<b>{test}<&>_]{\nfoo\nbar\n//}\n")
|
236
264
|
expected = <<-EOS
|
@@ -239,6 +267,17 @@ EOS
|
|
239
267
|
1: foo
|
240
268
|
2: bar
|
241
269
|
|
270
|
+
EOS
|
271
|
+
assert_equal expected, actual
|
272
|
+
|
273
|
+
@config['caption_position']['list'] = 'bottom'
|
274
|
+
actual = compile_block("//listnum[test][this is @<b>{test}<&>_]{\nfoo\nbar\n//}\n")
|
275
|
+
expected = <<-EOS
|
276
|
+
1: foo
|
277
|
+
2: bar
|
278
|
+
|
279
|
+
リスト1.1 this is test<&>_
|
280
|
+
|
242
281
|
EOS
|
243
282
|
assert_equal expected, actual
|
244
283
|
end
|
@@ -252,6 +291,18 @@ bar
|
|
252
291
|
|
253
292
|
buz
|
254
293
|
|
294
|
+
EOS
|
295
|
+
assert_equal expected, actual
|
296
|
+
|
297
|
+
@config['caption_position']['list'] = 'bottom'
|
298
|
+
actual = compile_block("//source[foo/bar/test.rb]{\nfoo\nbar\n\nbuz\n//}\n")
|
299
|
+
expected = <<-EOS
|
300
|
+
foo
|
301
|
+
bar
|
302
|
+
|
303
|
+
buz
|
304
|
+
foo/bar/test.rb
|
305
|
+
|
255
306
|
EOS
|
256
307
|
assert_equal expected, actual
|
257
308
|
end
|
@@ -283,6 +334,16 @@ FOO
|
|
283
334
|
foo
|
284
335
|
bar
|
285
336
|
|
337
|
+
EOS
|
338
|
+
assert_equal expected, actual
|
339
|
+
|
340
|
+
@config['caption_position']['list'] = 'bottom'
|
341
|
+
actual = compile_block("//box[FOO]{\nfoo\nbar\n//}\n")
|
342
|
+
expected = <<-EOS
|
343
|
+
foo
|
344
|
+
bar
|
345
|
+
FOO
|
346
|
+
|
286
347
|
EOS
|
287
348
|
assert_equal expected, actual
|
288
349
|
end
|
@@ -302,6 +363,16 @@ cap1
|
|
302
363
|
lineA
|
303
364
|
lineB
|
304
365
|
|
366
|
+
EOS
|
367
|
+
assert_equal expected, actual
|
368
|
+
|
369
|
+
@config['caption_position']['list'] = 'bottom'
|
370
|
+
actual = compile_block("//cmd[cap1]{\nlineA\nlineB\n//}\n")
|
371
|
+
expected = <<-EOS
|
372
|
+
lineA
|
373
|
+
lineB
|
374
|
+
cap1
|
375
|
+
|
305
376
|
EOS
|
306
377
|
assert_equal expected, actual
|
307
378
|
end
|
@@ -323,6 +394,16 @@ cap1
|
|
323
394
|
lineA
|
324
395
|
lineB
|
325
396
|
|
397
|
+
EOS
|
398
|
+
assert_equal expected, actual
|
399
|
+
|
400
|
+
@config['caption_position']['list'] = 'bottom'
|
401
|
+
actual = compile_block("//emlist[cap1]{\nlineA\nlineB\n//}\n")
|
402
|
+
expected = <<-EOS
|
403
|
+
lineA
|
404
|
+
lineB
|
405
|
+
cap1
|
406
|
+
|
326
407
|
EOS
|
327
408
|
assert_equal expected, actual
|
328
409
|
end
|
@@ -334,13 +415,23 @@ this is test<&>_
|
|
334
415
|
1: foo
|
335
416
|
2: bar
|
336
417
|
|
418
|
+
EOS
|
419
|
+
assert_equal expected, actual
|
420
|
+
|
421
|
+
@config['caption_position']['list'] = 'bottom'
|
422
|
+
actual = compile_block("//emlistnum[this is @<b>{test}<&>_]{\nfoo\nbar\n//}\n")
|
423
|
+
expected = <<-EOS
|
424
|
+
1: foo
|
425
|
+
2: bar
|
426
|
+
this is test<&>_
|
427
|
+
|
337
428
|
EOS
|
338
429
|
assert_equal expected, actual
|
339
430
|
end
|
340
431
|
|
341
432
|
def test_bib
|
342
433
|
def @chapter.bibpaper(_id)
|
343
|
-
Book::
|
434
|
+
Book::Index::Item.new('samplebib', 1, 'sample bib')
|
344
435
|
end
|
345
436
|
|
346
437
|
assert_equal '1 ', compile_inline('@<bib>{samplebib}')
|
@@ -362,21 +453,31 @@ EOS
|
|
362
453
|
aaa\tbbb
|
363
454
|
ccc\tddd<>&
|
364
455
|
|
456
|
+
EOS
|
457
|
+
assert_equal expected, actual
|
458
|
+
|
459
|
+
@config['caption_position']['table'] = 'bottom'
|
460
|
+
actual = compile_block("//table[foo][FOO]{\naaa\tbbb\n------------\nccc\tddd<>&\n//}\n")
|
461
|
+
expected = <<-EOS
|
462
|
+
aaa\tbbb
|
463
|
+
ccc\tddd<>&
|
464
|
+
|
465
|
+
表1.1 FOO
|
365
466
|
EOS
|
366
467
|
assert_equal expected, actual
|
367
468
|
end
|
368
469
|
|
369
470
|
def test_empty_table
|
370
|
-
e = assert_raises(ReVIEW::ApplicationError) { compile_block
|
471
|
+
e = assert_raises(ReVIEW::ApplicationError) { compile_block("//table{\n//}\n") }
|
371
472
|
assert_equal ':2: error: no rows in the table', e.message
|
372
473
|
|
373
|
-
e = assert_raises(ReVIEW::ApplicationError) { compile_block
|
474
|
+
e = assert_raises(ReVIEW::ApplicationError) { compile_block("//table{\n------------\n//}\n") }
|
374
475
|
assert_equal ':3: error: no rows in the table', e.message
|
375
476
|
end
|
376
477
|
|
377
478
|
def test_inline_table
|
378
479
|
def @chapter.table(_id)
|
379
|
-
Book::
|
480
|
+
Book::Index::Item.new('sampletable', 1)
|
380
481
|
end
|
381
482
|
actual = compile_block("@<table>{sampletest}\n")
|
382
483
|
assert_equal "表1.1\n", actual
|
@@ -487,20 +588,165 @@ EOS
|
|
487
588
|
assert_equal expected, actual
|
488
589
|
end
|
489
590
|
|
591
|
+
def test_minicolumn_blocks
|
592
|
+
%w[note memo tip info warning important caution notice].each do |type|
|
593
|
+
@builder.doc_status.clear
|
594
|
+
src = <<-EOS
|
595
|
+
//#{type}[#{type}1]{
|
596
|
+
|
597
|
+
//}
|
598
|
+
|
599
|
+
//#{type}[#{type}2]{
|
600
|
+
//}
|
601
|
+
EOS
|
602
|
+
|
603
|
+
expected = <<-EOS
|
604
|
+
#{type}1
|
605
|
+
|
606
|
+
#{type}2
|
607
|
+
|
608
|
+
EOS
|
609
|
+
assert_equal expected, compile_block(src)
|
610
|
+
|
611
|
+
src = <<-EOS
|
612
|
+
//#{type}[#{type}2]{
|
613
|
+
|
614
|
+
//}
|
615
|
+
|
616
|
+
//#{type}[#{type}3]{
|
617
|
+
|
618
|
+
//}
|
619
|
+
|
620
|
+
//#{type}[#{type}4]{
|
621
|
+
|
622
|
+
//}
|
623
|
+
|
624
|
+
//#{type}[#{type}5]{
|
625
|
+
|
626
|
+
//}
|
627
|
+
|
628
|
+
//#{type}[#{type}6]{
|
629
|
+
|
630
|
+
//}
|
631
|
+
EOS
|
632
|
+
|
633
|
+
expected = <<-EOS
|
634
|
+
#{type}2
|
635
|
+
|
636
|
+
#{type}3
|
637
|
+
|
638
|
+
#{type}4
|
639
|
+
|
640
|
+
#{type}5
|
641
|
+
|
642
|
+
#{type}6
|
643
|
+
|
644
|
+
EOS
|
645
|
+
assert_equal expected, compile_block(src)
|
646
|
+
|
647
|
+
src = <<-EOS
|
648
|
+
//#{type}{
|
649
|
+
|
650
|
+
* A
|
651
|
+
|
652
|
+
1. B
|
653
|
+
|
654
|
+
//}
|
655
|
+
|
656
|
+
//#{type}[OMITEND1]{
|
657
|
+
|
658
|
+
//emlist{
|
659
|
+
LIST
|
660
|
+
//}
|
661
|
+
|
662
|
+
//}
|
663
|
+
//#{type}[OMITEND2]{
|
664
|
+
//}
|
665
|
+
EOS
|
666
|
+
|
667
|
+
expected = <<-EOS
|
668
|
+
A
|
669
|
+
|
670
|
+
1 B
|
671
|
+
|
672
|
+
OMITEND1
|
673
|
+
|
674
|
+
LIST
|
675
|
+
|
676
|
+
OMITEND2
|
677
|
+
|
678
|
+
EOS
|
679
|
+
assert_equal expected, compile_block(src)
|
680
|
+
end
|
681
|
+
end
|
682
|
+
|
683
|
+
def test_minicolumn_blocks_nest_error1
|
684
|
+
%w[note memo tip info warning important caution notice].each do |type|
|
685
|
+
@builder.doc_status.clear
|
686
|
+
src = <<-EOS
|
687
|
+
//#{type}{
|
688
|
+
|
689
|
+
//#{type}{
|
690
|
+
//}
|
691
|
+
|
692
|
+
//}
|
693
|
+
EOS
|
694
|
+
e = assert_raises(ReVIEW::ApplicationError) { compile_block(src) }
|
695
|
+
assert_match(/minicolumn cannot be nested:/, e.message)
|
696
|
+
end
|
697
|
+
end
|
698
|
+
|
699
|
+
def test_minicolumn_blocks_nest_error2
|
700
|
+
%w[note memo tip info warning important caution notice].each do |type|
|
701
|
+
@builder.doc_status.clear
|
702
|
+
src = <<-EOS
|
703
|
+
//#{type}{
|
704
|
+
|
705
|
+
//#{type}{
|
706
|
+
|
707
|
+
//}
|
708
|
+
|
709
|
+
//}
|
710
|
+
EOS
|
711
|
+
e = assert_raises(ReVIEW::ApplicationError) { compile_block(src) }
|
712
|
+
assert_match(/minicolumn cannot be nested:/, e.message)
|
713
|
+
end
|
714
|
+
end
|
715
|
+
|
716
|
+
def test_minicolumn_blocks_nest_error3
|
717
|
+
%w[memo tip info warning important caution notice].each do |type|
|
718
|
+
@builder.doc_status.clear
|
719
|
+
src = <<-EOS
|
720
|
+
//#{type}{
|
721
|
+
|
722
|
+
//note{
|
723
|
+
//}
|
724
|
+
|
725
|
+
//}
|
726
|
+
EOS
|
727
|
+
e = assert_raises(ReVIEW::ApplicationError) { compile_block(src) }
|
728
|
+
assert_match(/minicolumn cannot be nested:/, e.message)
|
729
|
+
end
|
730
|
+
end
|
731
|
+
|
490
732
|
def test_image
|
491
733
|
def @chapter.image(_id)
|
492
|
-
item = Book::
|
734
|
+
item = Book::Index::Item.new('sampleimg', 1)
|
493
735
|
item.instance_eval { @path = './images/chap1-sampleimg.png' }
|
494
736
|
item
|
495
737
|
end
|
496
738
|
|
497
739
|
actual = compile_block("//image[sampleimg][sample photo]{\nfoo\n//}\n")
|
498
740
|
assert_equal %Q(図1.1 sample photo\n\n), actual
|
741
|
+
|
742
|
+
@config['caption_position']['image'] = 'top'
|
743
|
+
actual = compile_block("//image[sampleimg][sample photo]{\nfoo\n//}\n")
|
744
|
+
assert_equal %Q(図1.1 sample photo\n\n), actual
|
499
745
|
end
|
500
746
|
|
501
747
|
def test_image_with_metric
|
502
748
|
def @chapter.image(_id)
|
503
|
-
item = Book::
|
749
|
+
item = Book::Index::Item.new('sampleimg', 1)
|
504
750
|
item.instance_eval { @path = './images/chap1-sampleimg.png' }
|
505
751
|
item
|
506
752
|
end
|
@@ -515,18 +761,18 @@ EOS
|
|
515
761
|
end
|
516
762
|
|
517
763
|
def test_inline_unknown
|
518
|
-
e = assert_raises(ReVIEW::ApplicationError) { compile_block
|
764
|
+
e = assert_raises(ReVIEW::ApplicationError) { compile_block("@<img>{n}\n") }
|
519
765
|
assert_equal ':1: error: unknown image: n', e.message
|
520
|
-
e = assert_raises(ReVIEW::ApplicationError) { compile_block
|
766
|
+
e = assert_raises(ReVIEW::ApplicationError) { compile_block("@<fn>{n}\n") }
|
521
767
|
assert_equal ':1: error: unknown footnote: n', e.message
|
522
|
-
e = assert_raises(ReVIEW::ApplicationError) { compile_block
|
768
|
+
e = assert_raises(ReVIEW::ApplicationError) { compile_block("@<hd>{n}\n") }
|
523
769
|
assert_equal ':1: error: unknown headline: n', e.message
|
524
770
|
%w[list table column].each do |name|
|
525
|
-
e = assert_raises(ReVIEW::ApplicationError) { compile_block
|
771
|
+
e = assert_raises(ReVIEW::ApplicationError) { compile_block("@<#{name}>{n}\n") }
|
526
772
|
assert_equal ":1: error: unknown #{name}: n", e.message
|
527
773
|
end
|
528
774
|
%w[chap chapref title].each do |name|
|
529
|
-
e = assert_raises(ReVIEW::ApplicationError) { compile_block
|
775
|
+
e = assert_raises(ReVIEW::ApplicationError) { compile_block("@<#{name}>{n}\n") }
|
530
776
|
assert_equal ':1: error: key not found: "n"', e.message
|
531
777
|
end
|
532
778
|
end
|
@@ -627,5 +873,290 @@ e=mc^2
|
|
627
873
|
EOS
|
628
874
|
actual = compile_block(src)
|
629
875
|
assert_equal expected, actual
|
876
|
+
|
877
|
+
@config['caption_position']['equation'] = 'bottom'
|
878
|
+
expected = <<-EOS
|
879
|
+
式1.1
|
880
|
+
|
881
|
+
e=mc^2
|
882
|
+
式1.1 The Equivalence of Mass and Energy
|
883
|
+
|
884
|
+
EOS
|
885
|
+
actual = compile_block(src)
|
886
|
+
assert_equal expected, actual
|
887
|
+
end
|
888
|
+
|
889
|
+
def test_nest_error_open
|
890
|
+
src = <<-EOS
|
891
|
+
//endchild
|
892
|
+
EOS
|
893
|
+
e = assert_raises(ReVIEW::ApplicationError) { compile_block(src) }
|
894
|
+
assert_equal ":1: error: //endchild is shown, but any opened //beginchild doesn't exist", e.message
|
895
|
+
end
|
896
|
+
|
897
|
+
def test_nest_error_close1
|
898
|
+
src = <<-EOS
|
899
|
+
//beginchild
|
900
|
+
EOS
|
901
|
+
e = assert_raises(ReVIEW::ApplicationError) { compile_block(src) }
|
902
|
+
assert_equal ":1: error: //beginchild is shown, but previous element isn't ul, ol, or dl", e.message
|
903
|
+
end
|
904
|
+
|
905
|
+
def test_nest_error_close2
|
906
|
+
src = <<-EOS
|
907
|
+
* foo
|
908
|
+
|
909
|
+
//beginchild
|
910
|
+
|
911
|
+
1. foo
|
912
|
+
|
913
|
+
//beginchild
|
914
|
+
|
915
|
+
: foo
|
916
|
+
|
917
|
+
//beginchild
|
918
|
+
EOS
|
919
|
+
e = assert_raises(ReVIEW::ApplicationError) { compile_block(src) }
|
920
|
+
assert_equal ':12: error: //beginchild of dl,ol,ul misses //endchild', e.message
|
921
|
+
end
|
922
|
+
|
923
|
+
def test_nest_error_close3
|
924
|
+
src = <<-EOS
|
925
|
+
* foo
|
926
|
+
|
927
|
+
//beginchild
|
928
|
+
|
929
|
+
1. foo
|
930
|
+
|
931
|
+
//beginchild
|
932
|
+
|
933
|
+
: foo
|
934
|
+
|
935
|
+
//beginchild
|
936
|
+
|
937
|
+
//endchild
|
938
|
+
EOS
|
939
|
+
e = assert_raises(ReVIEW::ApplicationError) { compile_block(src) }
|
940
|
+
assert_equal ':14: error: //beginchild of ol,ul misses //endchild', e.message
|
941
|
+
end
|
942
|
+
|
943
|
+
def test_nest_ul
|
944
|
+
src = <<-EOS
|
945
|
+
* UL1
|
946
|
+
|
947
|
+
//beginchild
|
948
|
+
|
949
|
+
1. UL1-OL1
|
950
|
+
2. UL1-OL2
|
951
|
+
|
952
|
+
* UL1-UL1
|
953
|
+
* UL1-UL2
|
954
|
+
|
955
|
+
: UL1-DL1
|
956
|
+
UL1-DD1
|
957
|
+
: UL1-DL2
|
958
|
+
UL1-DD2
|
959
|
+
|
960
|
+
//endchild
|
961
|
+
|
962
|
+
* UL2
|
963
|
+
|
964
|
+
//beginchild
|
965
|
+
|
966
|
+
UL2-PARA
|
967
|
+
|
968
|
+
//endchild
|
969
|
+
EOS
|
970
|
+
|
971
|
+
expected = <<-EOS
|
972
|
+
UL1
|
973
|
+
|
974
|
+
1 UL1-OL1
|
975
|
+
2 UL1-OL2
|
976
|
+
|
977
|
+
UL1-UL1
|
978
|
+
UL1-UL2
|
979
|
+
|
980
|
+
UL1-DL1
|
981
|
+
UL1-DD1
|
982
|
+
UL1-DL2
|
983
|
+
UL1-DD2
|
984
|
+
|
985
|
+
UL2
|
986
|
+
UL2-PARA
|
987
|
+
EOS
|
988
|
+
|
989
|
+
actual = compile_block(src)
|
990
|
+
assert_equal expected, actual
|
991
|
+
end
|
992
|
+
|
993
|
+
def test_nest_ol
|
994
|
+
src = <<-EOS
|
995
|
+
1. OL1
|
996
|
+
|
997
|
+
//beginchild
|
998
|
+
|
999
|
+
1. OL1-OL1
|
1000
|
+
2. OL1-OL2
|
1001
|
+
|
1002
|
+
* OL1-UL1
|
1003
|
+
* OL1-UL2
|
1004
|
+
|
1005
|
+
: OL1-DL1
|
1006
|
+
OL1-DD1
|
1007
|
+
: OL1-DL2
|
1008
|
+
OL1-DD2
|
1009
|
+
|
1010
|
+
//endchild
|
1011
|
+
|
1012
|
+
2. OL2
|
1013
|
+
|
1014
|
+
//beginchild
|
1015
|
+
|
1016
|
+
OL2-PARA
|
1017
|
+
|
1018
|
+
//endchild
|
1019
|
+
EOS
|
1020
|
+
|
1021
|
+
expected = <<-EOS
|
1022
|
+
1 OL1
|
1023
|
+
|
1024
|
+
1 OL1-OL1
|
1025
|
+
2 OL1-OL2
|
1026
|
+
|
1027
|
+
OL1-UL1
|
1028
|
+
OL1-UL2
|
1029
|
+
|
1030
|
+
OL1-DL1
|
1031
|
+
OL1-DD1
|
1032
|
+
OL1-DL2
|
1033
|
+
OL1-DD2
|
1034
|
+
|
1035
|
+
2 OL2
|
1036
|
+
OL2-PARA
|
1037
|
+
EOS
|
1038
|
+
|
1039
|
+
actual = compile_block(src)
|
1040
|
+
assert_equal expected, actual
|
1041
|
+
end
|
1042
|
+
|
1043
|
+
def test_nest_dl
|
1044
|
+
src = <<-EOS
|
1045
|
+
: DL1
|
1046
|
+
|
1047
|
+
//beginchild
|
1048
|
+
|
1049
|
+
1. DL1-OL1
|
1050
|
+
2. DL1-OL2
|
1051
|
+
|
1052
|
+
* DL1-UL1
|
1053
|
+
* DL1-UL2
|
1054
|
+
|
1055
|
+
: DL1-DL1
|
1056
|
+
DL1-DD1
|
1057
|
+
: DL1-DL2
|
1058
|
+
DL1-DD2
|
1059
|
+
|
1060
|
+
//endchild
|
1061
|
+
|
1062
|
+
: DL2
|
1063
|
+
DD2
|
1064
|
+
|
1065
|
+
//beginchild
|
1066
|
+
|
1067
|
+
* DD2-UL1
|
1068
|
+
* DD2-UL2
|
1069
|
+
|
1070
|
+
DD2-PARA
|
1071
|
+
|
1072
|
+
//endchild
|
1073
|
+
EOS
|
1074
|
+
|
1075
|
+
expected = <<-EOS
|
1076
|
+
DL1
|
1077
|
+
|
1078
|
+
1 DL1-OL1
|
1079
|
+
2 DL1-OL2
|
1080
|
+
|
1081
|
+
DL1-UL1
|
1082
|
+
DL1-UL2
|
1083
|
+
|
1084
|
+
DL1-DL1
|
1085
|
+
DL1-DD1
|
1086
|
+
DL1-DL2
|
1087
|
+
DL1-DD2
|
1088
|
+
|
1089
|
+
DL2
|
1090
|
+
DD2
|
1091
|
+
|
1092
|
+
DD2-UL1
|
1093
|
+
DD2-UL2
|
1094
|
+
|
1095
|
+
DD2-PARA
|
1096
|
+
EOS
|
1097
|
+
|
1098
|
+
actual = compile_block(src)
|
1099
|
+
assert_equal expected, actual
|
1100
|
+
end
|
1101
|
+
|
1102
|
+
def test_nest_multi
|
1103
|
+
src = <<-EOS
|
1104
|
+
1. OL1
|
1105
|
+
|
1106
|
+
//beginchild
|
1107
|
+
|
1108
|
+
1. OL1-OL1
|
1109
|
+
|
1110
|
+
//beginchild
|
1111
|
+
|
1112
|
+
* OL1-OL1-UL1
|
1113
|
+
|
1114
|
+
OL1-OL1-PARA
|
1115
|
+
|
1116
|
+
//endchild
|
1117
|
+
|
1118
|
+
2. OL1-OL2
|
1119
|
+
|
1120
|
+
* OL1-UL1
|
1121
|
+
|
1122
|
+
//beginchild
|
1123
|
+
|
1124
|
+
: OL1-UL1-DL1
|
1125
|
+
OL1-UL1-DD1
|
1126
|
+
|
1127
|
+
OL1-UL1-PARA
|
1128
|
+
|
1129
|
+
//endchild
|
1130
|
+
|
1131
|
+
* OL1-UL2
|
1132
|
+
|
1133
|
+
//endchild
|
1134
|
+
EOS
|
1135
|
+
expected = <<-EOS
|
1136
|
+
1 OL1
|
1137
|
+
|
1138
|
+
1 OL1-OL1
|
1139
|
+
|
1140
|
+
|
1141
|
+
OL1-OL1-UL1
|
1142
|
+
|
1143
|
+
OL1-OL1-PARA
|
1144
|
+
|
1145
|
+
2 OL1-OL2
|
1146
|
+
|
1147
|
+
OL1-UL1
|
1148
|
+
|
1149
|
+
|
1150
|
+
OL1-UL1-DL1
|
1151
|
+
OL1-UL1-DD1
|
1152
|
+
|
1153
|
+
OL1-UL1-PARA
|
1154
|
+
|
1155
|
+
OL1-UL2
|
1156
|
+
|
1157
|
+
EOS
|
1158
|
+
|
1159
|
+
actual = compile_block(src)
|
1160
|
+
assert_equal expected, actual
|
630
1161
|
end
|
631
1162
|
end
|