review 3.1.0 → 5.0.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-win.yml +45 -0
- data/.github/workflows/ruby.yml +27 -0
- data/.rubocop.yml +161 -34
- data/.travis.yml +16 -15
- data/Dockerfile +21 -5
- data/NEWS.ja.md +394 -0
- data/NEWS.md +395 -1
- data/README.md +10 -7
- data/appveyor.yml +1 -3
- data/bin/review-catalog-converter +5 -5
- data/bin/review-check +10 -12
- data/bin/review-checkdep +2 -2
- data/bin/review-compile +17 -23
- data/bin/review-epubmaker +3 -35
- data/bin/review-idgxmlmaker +16 -0
- data/bin/review-index +2 -89
- data/bin/review-preproc +13 -13
- data/bin/review-validate +4 -4
- data/bin/review-vol +4 -78
- data/doc/config.yml.sample +47 -12
- data/doc/config.yml.sample-simple +3 -2
- data/doc/format.ja.md +120 -17
- data/doc/format.md +119 -27
- 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 +45 -25
- data/doc/quickstart.md +37 -16
- data/lib/epubmaker/content.rb +3 -2
- data/lib/epubmaker/epubcommon.rb +34 -27
- data/lib/epubmaker/epubv2.rb +5 -6
- data/lib/epubmaker/epubv3.rb +21 -18
- data/lib/epubmaker/producer.rb +2 -1
- data/lib/review/book.rb +2 -2
- data/lib/review/book/base.rb +91 -96
- data/lib/review/book/bib.rb +21 -0
- data/lib/review/book/book_unit.rb +155 -0
- data/lib/review/book/chapter.rb +48 -29
- data/lib/review/book/index.rb +46 -240
- 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 +4 -5
- data/lib/review/builder.rb +172 -56
- data/lib/review/catalog.rb +14 -17
- data/lib/review/compiler.rb +219 -121
- data/lib/review/configure.rb +39 -7
- data/lib/review/converter.rb +1 -1
- data/lib/review/epub2html.rb +43 -5
- data/lib/review/epubmaker.rb +69 -27
- data/lib/review/extentions/string.rb +0 -4
- data/lib/review/htmlbuilder.rb +112 -101
- data/lib/review/htmlutils.rb +9 -13
- data/lib/review/i18n.rb +3 -3
- data/lib/review/idgxmlbuilder.rb +202 -78
- data/lib/review/idgxmlmaker.rb +186 -0
- data/lib/review/index_builder.rb +653 -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 +129 -46
- data/lib/review/latexbuilder.rb +255 -92
- data/lib/review/lineinput.rb +1 -1
- data/lib/review/location.rb +32 -0
- data/lib/review/logger.rb +4 -8
- data/lib/review/makerhelper.rb +35 -5
- data/lib/review/markdownbuilder.rb +50 -38
- data/lib/review/md2inaobuilder.rb +3 -5
- data/lib/review/pdfmaker.rb +60 -57
- data/lib/review/plaintextbuilder.rb +154 -87
- data/lib/review/preprocessor.rb +20 -42
- data/lib/review/rstbuilder.rb +57 -38
- data/lib/review/sec_counter.rb +13 -0
- data/lib/review/textmaker.rb +23 -15
- data/lib/review/textutils.rb +76 -2
- data/lib/review/tocprinter.rb +230 -102
- data/lib/review/topbuilder.rb +139 -60
- data/lib/review/update.rb +24 -24
- data/lib/review/version.rb +1 -1
- data/lib/review/volumeprinter.rb +98 -0
- data/lib/review/webmaker.rb +20 -24
- data/lib/review/webtocprinter.rb +38 -35
- data/lib/review/yamlloader.rb +26 -16
- data/review.gemspec +6 -4
- 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-jlreq-ebook.yml +4 -0
- data/samples/sample-book/src/config-jlreq.yml +6 -0
- data/samples/sample-book/src/config.yml +2 -2
- data/samples/sample-book/src/lib/tasks/review.rake +29 -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 +4 -2
- data/samples/syntax-book/ch02.re +8 -16
- data/samples/syntax-book/ch03.re +3 -6
- 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/lib/tasks/review.rake +30 -15
- data/samples/syntax-book/lib/tasks/z01_copy_sty.rake +14 -8
- data/templates/latex/config.erb +39 -25
- 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 +161 -50
- data/templates/latex/review-jlreq/review-jlreq.cls +21 -22
- data/templates/latex/review-jlreq/review-style.sty +4 -1
- data/templates/latex/review-jsbook/README.md +46 -5
- data/templates/latex/review-jsbook/review-base.sty +123 -35
- data/templates/latex/review-jsbook/review-jsbook.cls +10 -4
- data/templates/latex/review-jsbook/review-style.sty +5 -2
- data/templates/opf/epubv3.opf.erb +1 -0
- data/templates/web/html/layout-html5.html.erb +3 -3
- data/test/assets/test_template.tex +19 -7
- data/test/assets/test_template_backmatter.tex +19 -7
- data/test/book_test_helper.rb +11 -5
- data/test/test_book.rb +124 -79
- data/test/test_book_chapter.rb +97 -54
- data/test/test_book_part.rb +3 -3
- data/test/test_builder.rb +38 -13
- data/test/test_catalog.rb +24 -42
- data/test/test_catalog_converter_cmd.rb +1 -1
- data/test/test_converter.rb +1 -0
- data/test/test_epub3maker.rb +2 -2
- data/test/test_epubmaker.rb +8 -0
- data/test/test_epubmaker_cmd.rb +14 -7
- data/test/test_helper.rb +18 -7
- data/test/test_htmlbuilder.rb +1491 -205
- data/test/test_htmlutils.rb +0 -12
- data/test/test_i18n.rb +37 -37
- data/test/test_idgxmlbuilder.rb +744 -42
- data/test/test_idgxmlmaker_cmd.rb +46 -0
- data/test/test_image_finder.rb +52 -70
- data/test/test_index.rb +94 -44
- data/test/test_indexbuilder.rb +52 -0
- data/test/test_latexbuilder.rb +1784 -161
- data/test/test_latexbuilder_v2.rb +671 -102
- data/test/test_logger.rb +17 -4
- data/test/test_makerhelper.rb +2 -14
- data/test/test_markdownbuilder.rb +137 -16
- data/test/test_md2inaobuilder.rb +32 -9
- data/test/test_pdfmaker.rb +30 -12
- data/test/test_pdfmaker_cmd.rb +100 -6
- data/test/test_plaintextbuilder.rb +791 -30
- data/test/test_preprocessor.rb +2 -16
- data/test/test_review_ext.rb +2 -1
- data/test/test_rstbuilder.rb +274 -27
- data/test/test_sec_counter.rb +156 -0
- data/test/test_textmaker_cmd.rb +54 -0
- data/test/test_textutils.rb +109 -2
- data/test/test_topbuilder.rb +724 -34
- data/test/test_update.rb +20 -11
- data/test/test_webtocprinter.rb +75 -43
- data/test/test_yamlloader.rb +13 -0
- 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 +65 -12
- data/.rubocop_todo.yml +0 -7
- 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
@@ -14,10 +14,10 @@ class LATEXBuidlerV2Test < Test::Unit::TestCase
|
|
14
14
|
'secnolevel' => 2, # for IDGXMLBuilder, EPUBBuilder
|
15
15
|
'toclevel' => 2,
|
16
16
|
'stylesheet' => nil, # for EPUBBuilder
|
17
|
-
'image_scale2width' => false,
|
18
17
|
'texcommand' => 'uplatex',
|
19
18
|
'review_version' => '2.0'
|
20
19
|
)
|
20
|
+
@config['pdfmaker']['image_scale2width'] = nil
|
21
21
|
@book = Book::Base.new
|
22
22
|
@book.config = @config
|
23
23
|
@compiler = ReVIEW::Compiler.new(@builder)
|
@@ -29,34 +29,62 @@ class LATEXBuidlerV2Test < Test::Unit::TestCase
|
|
29
29
|
|
30
30
|
def test_headline_level1
|
31
31
|
actual = compile_block("={test} this is test.\n")
|
32
|
-
|
32
|
+
expected = <<-EOS
|
33
|
+
\\chapter{this is test.}
|
34
|
+
\\label{chap:chap1}
|
35
|
+
EOS
|
36
|
+
assert_equal expected, actual
|
33
37
|
end
|
34
38
|
|
35
39
|
def test_headline_level1_without_secno
|
36
40
|
@config['secnolevel'] = 0
|
37
41
|
actual = compile_block("={test} this is test.\n")
|
38
|
-
|
42
|
+
expected = <<-EOS
|
43
|
+
\\chapter*{this is test.}
|
44
|
+
\\addcontentsline{toc}{chapter}{this is test.}
|
45
|
+
\\label{chap:chap1}
|
46
|
+
EOS
|
47
|
+
assert_equal expected, actual
|
39
48
|
end
|
40
49
|
|
41
50
|
def test_headline_level1_with_inlinetag
|
42
51
|
actual = compile_block(%Q(={test} this @<b>{is} test.<&"_>\n))
|
43
|
-
|
52
|
+
expected = <<-EOS
|
53
|
+
\\chapter{this \\textbf{is} test.\\textless{}\\&"\\textunderscore{}\\textgreater{}}
|
54
|
+
\\label{chap:chap1}
|
55
|
+
EOS
|
56
|
+
assert_equal expected, actual
|
44
57
|
end
|
45
58
|
|
46
59
|
def test_headline_level2
|
47
60
|
actual = compile_block("=={test} this is test.\n")
|
48
|
-
|
61
|
+
expected = <<-EOS
|
62
|
+
\\section{this is test.}
|
63
|
+
\\label{sec:1-1}
|
64
|
+
\\label{test}
|
65
|
+
EOS
|
66
|
+
assert_equal expected, actual
|
49
67
|
end
|
50
68
|
|
51
69
|
def test_headline_level3
|
52
70
|
actual = compile_block("==={test} this is test.\n")
|
53
|
-
|
71
|
+
expected = <<-EOS
|
72
|
+
\\subsection*{this is test.}
|
73
|
+
\\label{sec:1-0-1}
|
74
|
+
\\label{test}
|
75
|
+
EOS
|
76
|
+
assert_equal expected, actual
|
54
77
|
end
|
55
78
|
|
56
79
|
def test_headline_level3_with_secno
|
57
80
|
@config['secnolevel'] = 3
|
58
81
|
actual = compile_block("==={test} this is test.\n")
|
59
|
-
|
82
|
+
expected = <<-EOS
|
83
|
+
\\subsection{this is test.}
|
84
|
+
\\label{sec:1-0-1}
|
85
|
+
\\label{test}
|
86
|
+
EOS
|
87
|
+
assert_equal expected, actual
|
60
88
|
end
|
61
89
|
|
62
90
|
def test_label
|
@@ -193,12 +221,18 @@ class LATEXBuidlerV2Test < Test::Unit::TestCase
|
|
193
221
|
|
194
222
|
def test_inline_hd_chap
|
195
223
|
def @chapter.headline_index
|
196
|
-
|
197
|
-
Book::HeadlineIndex.new(
|
224
|
+
item = Book::Index::Item.new('chap1|test', [1, 1], 'te_st')
|
225
|
+
idx = Book::HeadlineIndex.new(self)
|
226
|
+
idx.add_item(item)
|
227
|
+
idx
|
198
228
|
end
|
199
229
|
|
200
230
|
@config['secnolevel'] = 3
|
201
231
|
actual = compile_inline('test @<hd>{chap1|test} test2')
|
232
|
+
assert_equal 'test \reviewsecref{「1.1.1 te\\textunderscore{}st」}{sec:1-1-1} test2', actual
|
233
|
+
|
234
|
+
@config['chapterlink'] = nil
|
235
|
+
actual = compile_inline('test @<hd>{chap1|test} test2')
|
202
236
|
assert_equal 'test 「1.1.1 te\\textunderscore{}st」 test2', actual
|
203
237
|
end
|
204
238
|
|
@@ -223,9 +257,9 @@ class LATEXBuidlerV2Test < Test::Unit::TestCase
|
|
223
257
|
end
|
224
258
|
|
225
259
|
def test_inline_idx_yomi
|
260
|
+
require 'nkf'
|
226
261
|
begin
|
227
262
|
require 'MeCab'
|
228
|
-
require 'nkf'
|
229
263
|
rescue LoadError
|
230
264
|
$stderr.puts 'skip test_inline_idx_yomi (cannot find MeCab)'
|
231
265
|
return true
|
@@ -248,47 +282,132 @@ class LATEXBuidlerV2Test < Test::Unit::TestCase
|
|
248
282
|
end
|
249
283
|
|
250
284
|
def test_dlist
|
251
|
-
actual = compile_block(": foo\n foo.\n bar.\n")
|
252
|
-
|
285
|
+
actual = compile_block(" : foo\n foo.\n bar.\n")
|
286
|
+
expected = <<-EOS
|
287
|
+
|
288
|
+
\\begin{description}
|
289
|
+
\\item[foo] \\mbox{} \\\\
|
290
|
+
foo.
|
291
|
+
bar.
|
292
|
+
\\end{description}
|
293
|
+
EOS
|
294
|
+
assert_equal expected, actual
|
253
295
|
end
|
254
296
|
|
255
297
|
def test_dlist_with_bracket
|
256
|
-
actual = compile_block(": foo[bar]\n foo.\n bar.\n")
|
257
|
-
|
298
|
+
actual = compile_block(" : foo[bar]\n foo.\n bar.\n")
|
299
|
+
expected = <<-EOS
|
300
|
+
|
301
|
+
\\begin{description}
|
302
|
+
\\item[foo\\lbrack{}bar\\rbrack{}] \\mbox{} \\\\
|
303
|
+
foo.
|
304
|
+
bar.
|
305
|
+
\\end{description}
|
306
|
+
EOS
|
307
|
+
assert_equal expected, actual
|
258
308
|
end
|
259
309
|
|
260
310
|
def test_dlist_beforeulol
|
261
311
|
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")
|
262
|
-
|
312
|
+
expected = <<-EOS
|
313
|
+
|
314
|
+
\\begin{description}
|
315
|
+
\\item[foo] \\mbox{} \\\\
|
316
|
+
foo.
|
317
|
+
\\end{description}
|
318
|
+
|
319
|
+
para
|
320
|
+
|
321
|
+
\\begin{description}
|
322
|
+
\\item[foo] \\mbox{} \\\\
|
323
|
+
foo.
|
324
|
+
\\end{description}
|
325
|
+
|
326
|
+
\\begin{enumerate}
|
327
|
+
\\item bar
|
328
|
+
\\end{enumerate}
|
329
|
+
|
330
|
+
\\begin{description}
|
331
|
+
\\item[foo] \\mbox{} \\\\
|
332
|
+
foo.
|
333
|
+
\\end{description}
|
334
|
+
|
335
|
+
\\begin{itemize}
|
336
|
+
\\item bar
|
337
|
+
\\end{itemize}
|
338
|
+
EOS
|
339
|
+
assert_equal expected, actual
|
263
340
|
end
|
264
341
|
|
265
342
|
def test_cmd
|
266
343
|
actual = compile_block("//cmd{\nfoo\nbar\n\nbuz\n//}\n")
|
267
|
-
|
344
|
+
expected = <<-EOS
|
345
|
+
|
346
|
+
\\begin{reviewcmd}
|
347
|
+
foo
|
348
|
+
bar
|
349
|
+
|
350
|
+
buz
|
351
|
+
\\end{reviewcmd}
|
352
|
+
EOS
|
353
|
+
assert_equal expected, actual
|
268
354
|
end
|
269
355
|
|
270
356
|
def test_cmd_caption
|
271
357
|
actual = compile_block("//cmd[cap1]{\nfoo\nbar\n\nbuz\n//}\n")
|
272
|
-
|
358
|
+
expected = <<-EOS
|
359
|
+
|
360
|
+
\\reviewcmdcaption{cap1}
|
361
|
+
\\begin{reviewcmd}
|
362
|
+
foo
|
363
|
+
bar
|
364
|
+
|
365
|
+
buz
|
366
|
+
\\end{reviewcmd}
|
367
|
+
EOS
|
368
|
+
assert_equal expected, actual
|
273
369
|
end
|
274
370
|
|
275
371
|
def test_cmd_lst
|
276
372
|
@book.config['highlight'] = {}
|
277
373
|
@book.config['highlight']['latex'] = 'listings'
|
278
374
|
actual = compile_block("//cmd{\nfoo\nbar\n\nbuz\n//}\n")
|
279
|
-
|
375
|
+
expected = <<-EOS
|
376
|
+
\\vspace{-1.5em}\\begin{reviewcmdlst}[title={\\relax},language={}]
|
377
|
+
foo
|
378
|
+
bar
|
379
|
+
|
380
|
+
buz
|
381
|
+
\\end{reviewcmdlst}
|
382
|
+
EOS
|
383
|
+
assert_equal expected, actual
|
280
384
|
end
|
281
385
|
|
282
386
|
def test_emlist
|
283
387
|
actual = compile_block("//emlist{\nfoo\nbar\n\nbuz\n//}\n")
|
284
|
-
|
388
|
+
expected = <<-EOS
|
389
|
+
|
390
|
+
\\begin{reviewemlist}
|
391
|
+
foo
|
392
|
+
bar
|
393
|
+
|
394
|
+
buz
|
395
|
+
\\end{reviewemlist}
|
396
|
+
EOS
|
397
|
+
assert_equal expected, actual
|
285
398
|
end
|
286
399
|
|
287
400
|
def test_emlist_lst
|
288
401
|
@book.config['highlight'] = {}
|
289
402
|
@book.config['highlight']['latex'] = 'listings'
|
290
403
|
actual = compile_block("//emlist[][sql]{\nSELECT COUNT(*) FROM tests WHERE tests.no > 10 AND test.name LIKE 'ABC%'\n//}\n")
|
291
|
-
|
404
|
+
expected = <<-EOS
|
405
|
+
|
406
|
+
\\vspace{-1.5em}\\begin{reviewemlistlst}[title={\\relax},language={sql}]
|
407
|
+
SELECT COUNT(*) FROM tests WHERE tests.no > 10 AND test.name LIKE 'ABC%'
|
408
|
+
\\end{reviewemlistlst}
|
409
|
+
EOS
|
410
|
+
assert_equal expected, actual
|
292
411
|
end
|
293
412
|
|
294
413
|
def test_emlist_lst_without_lang
|
@@ -296,45 +415,112 @@ class LATEXBuidlerV2Test < Test::Unit::TestCase
|
|
296
415
|
@book.config['highlight']['latex'] = 'listings'
|
297
416
|
@book.config['highlight']['lang'] = 'sql'
|
298
417
|
actual = compile_block("//emlist[]{\nSELECT COUNT(*) FROM tests WHERE tests.no > 10 AND test.name LIKE 'ABC%'\n//}\n")
|
299
|
-
|
418
|
+
expected = <<-EOS
|
419
|
+
|
420
|
+
\\vspace{-1.5em}\\begin{reviewemlistlst}[title={\\relax},language={sql}]
|
421
|
+
SELECT COUNT(*) FROM tests WHERE tests.no > 10 AND test.name LIKE 'ABC%'
|
422
|
+
\\end{reviewemlistlst}
|
423
|
+
EOS
|
424
|
+
assert_equal expected, actual
|
300
425
|
end
|
301
426
|
|
302
427
|
def test_emlist_caption
|
303
428
|
actual = compile_block("//emlist[cap1]{\nfoo\nbar\n\nbuz\n//}\n")
|
304
|
-
|
429
|
+
expected = <<-EOS
|
430
|
+
|
431
|
+
\\reviewemlistcaption{cap1}
|
432
|
+
\\begin{reviewemlist}
|
433
|
+
foo
|
434
|
+
bar
|
435
|
+
|
436
|
+
buz
|
437
|
+
\\end{reviewemlist}
|
438
|
+
EOS
|
439
|
+
assert_equal expected, actual
|
305
440
|
end
|
306
441
|
|
307
442
|
def test_emlist_empty_caption
|
308
443
|
actual = compile_block("//emlist[]{\nfoo\nbar\n\nbuz\n//}\n")
|
309
|
-
|
444
|
+
expected = <<-EOS
|
445
|
+
|
446
|
+
\\begin{reviewemlist}
|
447
|
+
foo
|
448
|
+
bar
|
449
|
+
|
450
|
+
buz
|
451
|
+
\\end{reviewemlist}
|
452
|
+
EOS
|
453
|
+
assert_equal expected, actual
|
310
454
|
end
|
311
455
|
|
312
456
|
def test_emlist_with_tab
|
313
457
|
actual = compile_block("//emlist{\n\tfoo\n\t\tbar\n\n\tbuz\n//}\n")
|
314
|
-
|
458
|
+
expected = <<-EOS
|
459
|
+
|
460
|
+
\\begin{reviewemlist}
|
461
|
+
foo
|
462
|
+
bar
|
463
|
+
|
464
|
+
buz
|
465
|
+
\\end{reviewemlist}
|
466
|
+
EOS
|
467
|
+
assert_equal expected, actual
|
315
468
|
end
|
316
469
|
|
317
470
|
def test_emlist_with_tab4
|
318
471
|
@config['tabwidth'] = 4
|
319
472
|
actual = compile_block("//emlist{\n\tfoo\n\t\tbar\n\n\tbuz\n//}\n")
|
320
|
-
|
473
|
+
expected = <<-EOS
|
474
|
+
|
475
|
+
\\begin{reviewemlist}
|
476
|
+
foo
|
477
|
+
bar
|
478
|
+
|
479
|
+
buz
|
480
|
+
\\end{reviewemlist}
|
481
|
+
EOS
|
482
|
+
assert_equal expected, actual
|
321
483
|
end
|
322
484
|
|
323
485
|
def test_emlistnum_caption
|
324
486
|
actual = compile_block("//emlistnum[cap1]{\nfoo\nbar\n\nbuz\n//}\n")
|
325
|
-
|
487
|
+
expected = <<-EOS
|
488
|
+
|
489
|
+
\\reviewemlistcaption{cap1}
|
490
|
+
\\begin{reviewemlist}
|
491
|
+
1: foo
|
492
|
+
2: bar
|
493
|
+
3:
|
494
|
+
4: buz
|
495
|
+
\\end{reviewemlist}
|
496
|
+
EOS
|
497
|
+
assert_equal expected, actual
|
326
498
|
end
|
327
499
|
|
328
500
|
def test_list
|
329
501
|
actual = compile_block("//list[id1][cap1]{\nfoo\nbar\n\nbuz\n//}\n")
|
330
|
-
|
502
|
+
expected = <<-EOS
|
503
|
+
\\reviewlistcaption{リスト1.1: cap1}
|
504
|
+
\\begin{reviewlist}
|
505
|
+
foo
|
506
|
+
bar
|
507
|
+
|
508
|
+
buz
|
509
|
+
\\end{reviewlist}
|
510
|
+
EOS
|
511
|
+
assert_equal expected, actual
|
331
512
|
end
|
332
513
|
|
333
514
|
def test_list_lst
|
334
515
|
@book.config['highlight'] = {}
|
335
516
|
@book.config['highlight']['latex'] = 'listings'
|
336
517
|
actual = compile_block("//list[id1][cap1][sql]{\nSELECT COUNT(*) FROM tests WHERE tests.no > 10 AND test.name LIKE 'ABC%'\n//}\n")
|
337
|
-
|
518
|
+
expected = <<-EOS
|
519
|
+
\\begin{reviewlistlst}[caption={cap1},language={sql}]
|
520
|
+
SELECT COUNT(*) FROM tests WHERE tests.no > 10 AND test.name LIKE 'ABC%'
|
521
|
+
\\end{reviewlistlst}
|
522
|
+
EOS
|
523
|
+
assert_equal expected, actual
|
338
524
|
end
|
339
525
|
|
340
526
|
def test_list_lst_with_lang
|
@@ -342,238 +528,495 @@ class LATEXBuidlerV2Test < Test::Unit::TestCase
|
|
342
528
|
@book.config['highlight']['latex'] = 'listings'
|
343
529
|
@book.config['highlight']['lang'] = 'sql'
|
344
530
|
actual = compile_block("//list[id1][cap1]{\nSELECT COUNT(*) FROM tests WHERE tests.no > 10 AND test.name LIKE 'ABC%'\n//}\n")
|
345
|
-
|
531
|
+
expected = <<-EOS
|
532
|
+
\\begin{reviewlistlst}[caption={cap1},language={sql}]
|
533
|
+
SELECT COUNT(*) FROM tests WHERE tests.no > 10 AND test.name LIKE 'ABC%'
|
534
|
+
\\end{reviewlistlst}
|
535
|
+
EOS
|
536
|
+
assert_equal expected, actual
|
346
537
|
end
|
347
538
|
|
348
539
|
def test_listnum
|
349
540
|
actual = compile_block("//listnum[test1][ruby]{\nclass Foo\n def foo\n bar\n\n buz\n end\nend\n//}\n")
|
350
|
-
|
541
|
+
expected = <<-EOS
|
542
|
+
\\reviewlistcaption{リスト1.1: ruby}
|
543
|
+
\\begin{reviewlist}
|
544
|
+
1: class Foo
|
545
|
+
2: def foo
|
546
|
+
3: bar
|
547
|
+
4:
|
548
|
+
5: buz
|
549
|
+
6: end
|
550
|
+
7: end
|
551
|
+
\\end{reviewlist}
|
552
|
+
EOS
|
553
|
+
assert_equal expected, actual
|
351
554
|
end
|
352
555
|
|
353
556
|
def test_listnum_linenum
|
354
557
|
actual = compile_block("//firstlinenum[100]\n//listnum[test1][ruby]{\nclass Foo\n def foo\n bar\n\n buz\n end\nend\n//}\n")
|
355
|
-
|
558
|
+
expected = <<-EOS
|
559
|
+
\\reviewlistcaption{リスト1.1: ruby}
|
560
|
+
\\begin{reviewlist}
|
561
|
+
100: class Foo
|
562
|
+
101: def foo
|
563
|
+
102: bar
|
564
|
+
103:
|
565
|
+
104: buz
|
566
|
+
105: end
|
567
|
+
106: end
|
568
|
+
\\end{reviewlist}
|
569
|
+
EOS
|
570
|
+
assert_equal expected, actual
|
356
571
|
end
|
357
572
|
|
358
573
|
def test_listnum_lst
|
359
574
|
@book.config['highlight'] = {}
|
360
575
|
@book.config['highlight']['latex'] = 'listings'
|
361
576
|
actual = compile_block("//listnum[test1][ruby]{\nclass Foo\n def foo\n bar\n\n buz\n end\nend\n//}\n")
|
362
|
-
|
577
|
+
expected = <<-EOS
|
578
|
+
\\begin{reviewlistnumlst}[caption={ruby},language={}]
|
579
|
+
class Foo
|
580
|
+
def foo
|
581
|
+
bar
|
582
|
+
|
583
|
+
buz
|
584
|
+
end
|
585
|
+
end
|
586
|
+
\\end{reviewlistnumlst}
|
587
|
+
EOS
|
588
|
+
assert_equal expected, actual
|
363
589
|
end
|
364
590
|
|
365
591
|
def test_listnum_lst_linenum
|
366
592
|
@book.config['highlight'] = {}
|
367
593
|
@book.config['highlight']['latex'] = 'listings'
|
368
594
|
actual = compile_block("//firstlinenum[100]\n//listnum[test1][ruby]{\nclass Foo\n def foo\n bar\n\n buz\n end\nend\n//}\n")
|
369
|
-
|
595
|
+
expected = <<-EOS
|
596
|
+
\\begin{reviewlistnumlst}[caption={ruby},language={},firstnumber=100]
|
597
|
+
class Foo
|
598
|
+
def foo
|
599
|
+
bar
|
600
|
+
|
601
|
+
buz
|
602
|
+
end
|
603
|
+
end
|
604
|
+
\\end{reviewlistnumlst}
|
605
|
+
EOS
|
606
|
+
assert_equal expected, actual
|
370
607
|
end
|
371
608
|
|
372
609
|
def test_source
|
373
610
|
actual = compile_block("//source[foo/bar/test.rb]{\nfoo\nbar\n\nbuz\n//}\n")
|
374
|
-
|
611
|
+
expected = <<-EOS
|
612
|
+
\\reviewsourcecaption{foo/bar/test.rb}
|
613
|
+
\\begin{reviewsource}
|
614
|
+
foo
|
615
|
+
bar
|
616
|
+
|
617
|
+
buz
|
618
|
+
\\end{reviewsource}
|
619
|
+
EOS
|
620
|
+
assert_equal expected, actual
|
375
621
|
end
|
376
622
|
|
377
623
|
def test_source_empty_caption
|
378
624
|
actual = compile_block("//source[]{\nfoo\nbar\n\nbuz\n//}\n")
|
379
|
-
|
625
|
+
expected = <<-EOS
|
626
|
+
\\begin{reviewsource}
|
627
|
+
foo
|
628
|
+
bar
|
629
|
+
|
630
|
+
buz
|
631
|
+
\\end{reviewsource}
|
632
|
+
EOS
|
633
|
+
assert_equal expected, actual
|
380
634
|
end
|
381
635
|
|
382
636
|
def test_source_lst
|
383
637
|
@book.config['highlight'] = {}
|
384
638
|
@book.config['highlight']['latex'] = 'listings'
|
385
639
|
actual = compile_block("//source[foo/bar/test.rb]{\nfoo\nbar\n\nbuz\n//}\n")
|
386
|
-
|
640
|
+
expected = <<-EOS
|
641
|
+
\\begin{reviewsourcelst}[title={foo/bar/test.rb},language={}]
|
642
|
+
foo
|
643
|
+
bar
|
644
|
+
|
645
|
+
buz
|
646
|
+
\\end{reviewsourcelst}
|
647
|
+
EOS
|
648
|
+
assert_equal expected, actual
|
387
649
|
end
|
388
650
|
|
389
651
|
def test_quote
|
390
652
|
actual = compile_block("//quote{\nfoo\nbar\n\nbuz\n//}\n")
|
391
|
-
|
653
|
+
expected = <<-EOS
|
654
|
+
|
655
|
+
\\begin{quote}
|
656
|
+
foobar
|
657
|
+
|
658
|
+
buz
|
659
|
+
\\end{quote}
|
660
|
+
EOS
|
661
|
+
assert_equal expected, actual
|
392
662
|
end
|
393
663
|
|
394
664
|
def test_memo
|
395
665
|
actual = compile_block("//memo[this is @<b>{test}<&>_]{\ntest1\n\ntest@<i>{2}\n//}\n")
|
396
|
-
|
666
|
+
expected = <<-EOS
|
667
|
+
\\begin{reviewminicolumn}
|
668
|
+
\\reviewminicolumntitle{this is \\textbf{test}\\textless{}\\&\\textgreater{}\\textunderscore{}}
|
669
|
+
|
670
|
+
test1
|
671
|
+
|
672
|
+
test\\textit{2}
|
673
|
+
|
674
|
+
\\end{reviewminicolumn}
|
675
|
+
EOS
|
676
|
+
assert_equal expected, actual
|
397
677
|
end
|
398
678
|
|
399
679
|
def test_flushright
|
400
680
|
actual = compile_block("//flushright{\nfoo\nbar\n\nbuz\n//}\n")
|
401
|
-
|
681
|
+
expected = <<-EOS
|
682
|
+
|
683
|
+
\\begin{flushright}
|
684
|
+
foobar
|
685
|
+
|
686
|
+
buz
|
687
|
+
\\end{flushright}
|
688
|
+
EOS
|
689
|
+
assert_equal expected, actual
|
402
690
|
end
|
403
691
|
|
404
692
|
def test_centering
|
405
693
|
actual = compile_block("//centering{\nfoo\nbar\n\nbuz\n//}\n")
|
406
|
-
|
694
|
+
expected = <<-EOS
|
695
|
+
|
696
|
+
\\begin{center}
|
697
|
+
foobar
|
698
|
+
|
699
|
+
buz
|
700
|
+
\\end{center}
|
701
|
+
EOS
|
702
|
+
assert_equal expected, actual
|
407
703
|
end
|
408
704
|
|
409
705
|
def test_blankline
|
410
706
|
actual = compile_block("//blankline\nfoo\n")
|
411
|
-
|
707
|
+
expected = <<-EOS
|
708
|
+
\\vspace*{\\baselineskip}
|
709
|
+
|
710
|
+
foo
|
711
|
+
EOS
|
712
|
+
assert_equal expected, actual
|
412
713
|
end
|
413
714
|
|
414
715
|
def test_noindent
|
415
716
|
actual = compile_block("//noindent\nfoo\nbar\n\nfoo2\nbar2\n")
|
416
|
-
|
717
|
+
expected = <<-EOS
|
718
|
+
\\noindent
|
719
|
+
foo
|
720
|
+
bar
|
721
|
+
|
722
|
+
foo2
|
723
|
+
bar2
|
724
|
+
EOS
|
725
|
+
assert_equal expected, actual
|
417
726
|
end
|
418
727
|
|
419
728
|
def test_image
|
420
729
|
def @chapter.image(_id)
|
421
|
-
item = Book::
|
730
|
+
item = Book::Index::Item.new('sampleimg', 1)
|
422
731
|
item.instance_eval { @path = './images/chap1-sampleimg.png' }
|
423
732
|
item
|
424
733
|
end
|
425
734
|
|
426
735
|
actual = compile_block("//image[sampleimg][sample photo]{\n//}\n")
|
427
|
-
|
736
|
+
expected = <<-EOS
|
737
|
+
\\begin{reviewimage}%%sampleimg
|
738
|
+
\\includegraphics[width=\\maxwidth]{./images/chap1-sampleimg.png}
|
739
|
+
\\caption{sample photo}
|
740
|
+
\\label{image:chap1:sampleimg}
|
741
|
+
\\end{reviewimage}
|
742
|
+
EOS
|
743
|
+
assert_equal expected, actual
|
428
744
|
end
|
429
745
|
|
430
746
|
def test_image_with_metric
|
431
747
|
def @chapter.image(_id)
|
432
|
-
item = Book::
|
748
|
+
item = Book::Index::Item.new('sampleimg', 1)
|
433
749
|
item.instance_eval { @path = './images/chap1-sampleimg.png' }
|
434
750
|
item
|
435
751
|
end
|
436
752
|
|
437
753
|
actual = compile_block("//image[sampleimg][sample photo][scale=1.2]{\n//}\n")
|
438
|
-
|
754
|
+
expected = <<-EOS
|
755
|
+
\\begin{reviewimage}%%sampleimg
|
756
|
+
\\includegraphics[scale=1.2]{./images/chap1-sampleimg.png}
|
757
|
+
\\caption{sample photo}
|
758
|
+
\\label{image:chap1:sampleimg}
|
759
|
+
\\end{reviewimage}
|
760
|
+
EOS
|
761
|
+
assert_equal expected, actual
|
439
762
|
end
|
440
763
|
|
441
764
|
def test_image_with_metric_width
|
442
765
|
def @chapter.image(_id)
|
443
|
-
item = Book::
|
766
|
+
item = Book::Index::Item.new('sampleimg', 1)
|
444
767
|
item.instance_eval { @path = './images/chap1-sampleimg.png' }
|
445
768
|
item
|
446
769
|
end
|
447
770
|
|
448
|
-
@config['image_scale2width'] = true
|
771
|
+
@config['pdfmaker']['image_scale2width'] = true
|
449
772
|
actual = compile_block("//image[sampleimg][sample photo][scale=1.2]{\n//}\n")
|
450
|
-
|
773
|
+
expected = <<-EOS
|
774
|
+
\\begin{reviewimage}%%sampleimg
|
775
|
+
\\includegraphics[width=1.2\\maxwidth]{./images/chap1-sampleimg.png}
|
776
|
+
\\caption{sample photo}
|
777
|
+
\\label{image:chap1:sampleimg}
|
778
|
+
\\end{reviewimage}
|
779
|
+
EOS
|
780
|
+
assert_equal expected, actual
|
451
781
|
end
|
452
782
|
|
453
783
|
def test_image_with_metric2
|
454
784
|
def @chapter.image(_id)
|
455
|
-
item = Book::
|
785
|
+
item = Book::Index::Item.new('sampleimg', 1)
|
456
786
|
item.instance_eval { @path = './images/chap1-sampleimg.png' }
|
457
787
|
item
|
458
788
|
end
|
459
789
|
|
460
790
|
actual = compile_block("//image[sampleimg][sample photo][scale=1.2,html::class=sample,latex::ignore=params]{\n//}\n")
|
461
|
-
|
791
|
+
expected = <<-EOS
|
792
|
+
\\begin{reviewimage}%%sampleimg
|
793
|
+
\\includegraphics[scale=1.2,ignore=params]{./images/chap1-sampleimg.png}
|
794
|
+
\\caption{sample photo}
|
795
|
+
\\label{image:chap1:sampleimg}
|
796
|
+
\\end{reviewimage}
|
797
|
+
EOS
|
798
|
+
assert_equal expected, actual
|
462
799
|
end
|
463
800
|
|
464
801
|
def test_image_with_metric2_width
|
465
802
|
def @chapter.image(_id)
|
466
|
-
item = Book::
|
803
|
+
item = Book::Index::Item.new('sampleimg', 1)
|
467
804
|
item.instance_eval { @path = './images/chap1-sampleimg.png' }
|
468
805
|
item
|
469
806
|
end
|
470
807
|
|
471
|
-
@config['image_scale2width'] = true
|
808
|
+
@config['pdfmaker']['image_scale2width'] = true
|
472
809
|
actual = compile_block("//image[sampleimg][sample photo][scale=1.2,html::class=sample,latex::ignore=params]{\n//}\n")
|
473
|
-
|
810
|
+
expected = <<-EOS
|
811
|
+
\\begin{reviewimage}%%sampleimg
|
812
|
+
\\includegraphics[width=1.2\\maxwidth,ignore=params]{./images/chap1-sampleimg.png}
|
813
|
+
\\caption{sample photo}
|
814
|
+
\\label{image:chap1:sampleimg}
|
815
|
+
\\end{reviewimage}
|
816
|
+
EOS
|
817
|
+
assert_equal expected, actual
|
474
818
|
end
|
475
819
|
|
476
820
|
def test_indepimage
|
477
821
|
def @chapter.image(_id)
|
478
|
-
item = Book::
|
822
|
+
item = Book::Index::Item.new('sampleimg', 1)
|
479
823
|
item.instance_eval { @path = './images/chap1-sampleimg.png' }
|
480
824
|
item
|
481
825
|
end
|
482
826
|
|
483
827
|
actual = compile_block("//indepimage[sampleimg][sample photo]\n")
|
484
|
-
|
828
|
+
expected = <<-EOS
|
829
|
+
\\begin{reviewimage}%%sampleimg
|
830
|
+
\\includegraphics[width=\\maxwidth]{./images/chap1-sampleimg.png}
|
831
|
+
\\reviewindepimagecaption{図: sample photo}
|
832
|
+
\\end{reviewimage}
|
833
|
+
EOS
|
834
|
+
assert_equal expected, actual
|
485
835
|
end
|
486
836
|
|
487
837
|
def test_indepimage_without_caption
|
488
838
|
def @chapter.image(_id)
|
489
|
-
item = Book::
|
839
|
+
item = Book::Index::Item.new('sampleimg', 1)
|
490
840
|
item.instance_eval { @path = './images/chap1-sampleimg.png' }
|
491
841
|
item
|
492
842
|
end
|
493
843
|
|
494
844
|
# FIXME: indepimage's caption should not be with a counter.
|
495
845
|
actual = compile_block("//indepimage[sampleimg]\n")
|
496
|
-
|
846
|
+
expected = <<-EOS
|
847
|
+
\\begin{reviewimage}%%sampleimg
|
848
|
+
\\includegraphics[width=\\maxwidth]{./images/chap1-sampleimg.png}
|
849
|
+
\\end{reviewimage}
|
850
|
+
EOS
|
851
|
+
assert_equal expected, actual
|
497
852
|
end
|
498
853
|
|
499
854
|
def test_indepimage_with_metric
|
500
855
|
def @chapter.image(_id)
|
501
|
-
item = Book::
|
856
|
+
item = Book::Index::Item.new('sampleimg', 1)
|
502
857
|
item.instance_eval { @path = './images/chap1-sampleimg.png' }
|
503
858
|
item
|
504
859
|
end
|
505
860
|
|
506
861
|
actual = compile_block("//indepimage[sampleimg][sample photo][scale=1.2]\n")
|
507
|
-
|
862
|
+
expected = <<-EOS
|
863
|
+
\\begin{reviewimage}%%sampleimg
|
864
|
+
\\includegraphics[scale=1.2]{./images/chap1-sampleimg.png}
|
865
|
+
\\reviewindepimagecaption{図: sample photo}
|
866
|
+
\\end{reviewimage}
|
867
|
+
EOS
|
868
|
+
assert_equal expected, actual
|
508
869
|
end
|
509
870
|
|
510
871
|
def test_indepimage_with_metric_width
|
511
872
|
def @chapter.image(_id)
|
512
|
-
item = Book::
|
873
|
+
item = Book::Index::Item.new('sampleimg', 1)
|
513
874
|
item.instance_eval { @path = './images/chap1-sampleimg.png' }
|
514
875
|
item
|
515
876
|
end
|
516
877
|
|
517
|
-
@config['image_scale2width'] = true
|
878
|
+
@config['pdfmaker']['image_scale2width'] = true
|
518
879
|
actual = compile_block("//indepimage[sampleimg][sample photo][scale=1.2]\n")
|
519
|
-
|
880
|
+
expected = <<-EOS
|
881
|
+
\\begin{reviewimage}%%sampleimg
|
882
|
+
\\includegraphics[width=1.2\\maxwidth]{./images/chap1-sampleimg.png}
|
883
|
+
\\reviewindepimagecaption{図: sample photo}
|
884
|
+
\\end{reviewimage}
|
885
|
+
EOS
|
886
|
+
assert_equal expected, actual
|
520
887
|
end
|
521
888
|
|
522
889
|
def test_indepimage_with_metric2
|
523
890
|
def @chapter.image(_id)
|
524
|
-
item = Book::
|
891
|
+
item = Book::Index::Item.new('sampleimg', 1)
|
525
892
|
item.instance_eval { @path = './images/chap1-sampleimg.png' }
|
526
893
|
item
|
527
894
|
end
|
528
895
|
|
529
896
|
actual = compile_block(%Q(//indepimage[sampleimg][sample photo][scale=1.2, html::class="sample",latex::ignore=params]\n))
|
530
|
-
|
897
|
+
expected = <<-EOS
|
898
|
+
\\begin{reviewimage}%%sampleimg
|
899
|
+
\\includegraphics[scale=1.2,ignore=params]{./images/chap1-sampleimg.png}
|
900
|
+
\\reviewindepimagecaption{図: sample photo}
|
901
|
+
\\end{reviewimage}
|
902
|
+
EOS
|
903
|
+
assert_equal expected, actual
|
531
904
|
end
|
532
905
|
|
533
906
|
def test_indepimage_without_caption_but_with_metric
|
534
907
|
def @chapter.image(_id)
|
535
|
-
item = Book::
|
908
|
+
item = Book::Index::Item.new('sampleimg', 1)
|
536
909
|
item.instance_eval { @path = './images/chap1-sampleimg.png' }
|
537
910
|
item
|
538
911
|
end
|
539
912
|
|
540
913
|
# FIXME: indepimage's caption should not be with a counter.
|
541
914
|
actual = compile_block("//indepimage[sampleimg][][scale=1.2]\n")
|
542
|
-
|
915
|
+
expected = <<-EOS
|
916
|
+
\\begin{reviewimage}%%sampleimg
|
917
|
+
\\includegraphics[scale=1.2]{./images/chap1-sampleimg.png}
|
918
|
+
\\end{reviewimage}
|
919
|
+
EOS
|
920
|
+
assert_equal expected, actual
|
543
921
|
end
|
544
922
|
|
545
923
|
def test_table
|
546
924
|
actual = compile_block("//table{\naaa\tbbb\n------------\nccc\tddd<>&\n//}\n")
|
547
|
-
|
548
|
-
|
925
|
+
expected = <<-EOS
|
926
|
+
\\begin{reviewtable}{|l|l|}
|
927
|
+
\\hline
|
928
|
+
\\reviewth{aaa} & \\reviewth{bbb} \\\\ \\hline
|
929
|
+
ccc & ddd\\textless{}\\textgreater{}\\& \\\\ \\hline
|
930
|
+
\\end{reviewtable}
|
931
|
+
EOS
|
932
|
+
assert_equal expected, actual
|
933
|
+
|
934
|
+
actual = compile_block("//table[foo][FOO]{\naaa\tbbb\n------------\nccc\tddd<>&\n//}\n")
|
935
|
+
expected = <<-EOS
|
936
|
+
\\begin{table}[h]%%foo
|
937
|
+
\\reviewtablecaption{FOO}
|
938
|
+
\\label{table:chap1:foo}
|
939
|
+
\\begin{reviewtable}{|l|l|}
|
940
|
+
\\hline
|
941
|
+
\\reviewth{aaa} & \\reviewth{bbb} \\\\ \\hline
|
942
|
+
ccc & ddd\\textless{}\\textgreater{}\\& \\\\ \\hline
|
943
|
+
\\end{reviewtable}
|
944
|
+
\\end{table}
|
945
|
+
EOS
|
946
|
+
assert_equal expected, actual
|
549
947
|
end
|
550
948
|
|
551
949
|
def test_customize_cellwidth
|
552
950
|
actual = compile_block("//tsize[2,3,5]\n//table{\nA\tB\tC\n//}\n")
|
553
|
-
|
951
|
+
expected = <<-EOS
|
952
|
+
\\begin{reviewtable}{|p{2mm}|p{3mm}|p{5mm}|}
|
953
|
+
\\hline
|
954
|
+
\\reviewth{A} & B & C \\\\ \\hline
|
955
|
+
\\end{reviewtable}
|
956
|
+
EOS
|
957
|
+
assert_equal expected, actual
|
554
958
|
|
555
959
|
actual = compile_block("//tsize[|latex,html|2,3,5]\n//table{\nA\tB\tC\n//}\n")
|
556
|
-
|
960
|
+
expected = <<-EOS
|
961
|
+
\\begin{reviewtable}{|p{2mm}|p{3mm}|p{5mm}|}
|
962
|
+
\\hline
|
963
|
+
\\reviewth{A} & B & C \\\\ \\hline
|
964
|
+
\\end{reviewtable}
|
965
|
+
EOS
|
966
|
+
assert_equal expected, actual
|
557
967
|
|
558
968
|
actual = compile_block("//tsize[|html|2,3,5]\n//table{\nA\tB\tC\n//}\n")
|
559
|
-
|
969
|
+
expected = <<-EOS
|
970
|
+
\\begin{reviewtable}{|l|l|l|}
|
971
|
+
\\hline
|
972
|
+
\\reviewth{A} & B & C \\\\ \\hline
|
973
|
+
\\end{reviewtable}
|
974
|
+
EOS
|
975
|
+
assert_equal expected, actual
|
560
976
|
|
561
977
|
actual = compile_block("//tsize[|latex|2,3,5]\n//table{\nA\tB\tC\n//}\n")
|
562
|
-
|
978
|
+
expected = <<-EOS
|
979
|
+
\\begin{reviewtable}{|p{2mm}|p{3mm}|p{5mm}|}
|
980
|
+
\\hline
|
981
|
+
\\reviewth{A} & B & C \\\\ \\hline
|
982
|
+
\\end{reviewtable}
|
983
|
+
EOS
|
984
|
+
assert_equal expected, actual
|
563
985
|
|
564
986
|
actual = compile_block("//tsize[|latex||p{5mm}|cr|]\n//table{\nA\tB\tC\n//}\n")
|
565
|
-
|
987
|
+
expected = <<-EOS
|
988
|
+
\\begin{reviewtable}{|p{5mm}|cr|}
|
989
|
+
\\hline
|
990
|
+
\\reviewth{A} & B & C \\\\ \\hline
|
991
|
+
\\end{reviewtable}
|
992
|
+
EOS
|
993
|
+
assert_equal expected, actual
|
566
994
|
end
|
567
995
|
|
568
996
|
def test_emtable
|
569
997
|
actual = compile_block("//emtable[foo]{\naaa\tbbb\n------------\nccc\tddd<>&\n//}\n//emtable{\naaa\tbbb\n------------\nccc\tddd<>&\n//}\n")
|
570
|
-
|
571
|
-
|
998
|
+
expected = <<-EOS
|
999
|
+
\\begin{table}[h]%%
|
1000
|
+
\\reviewtablecaption*{foo}
|
1001
|
+
\\begin{reviewtable}{|l|l|}
|
1002
|
+
\\hline
|
1003
|
+
\\reviewth{aaa} & \\reviewth{bbb} \\\\ \\hline
|
1004
|
+
ccc & ddd\\textless{}\\textgreater{}\\& \\\\ \\hline
|
1005
|
+
\\end{reviewtable}
|
1006
|
+
\\end{table}
|
1007
|
+
|
1008
|
+
\\begin{reviewtable}{|l|l|}
|
1009
|
+
\\hline
|
1010
|
+
\\reviewth{aaa} & \\reviewth{bbb} \\\\ \\hline
|
1011
|
+
ccc & ddd\\textless{}\\textgreater{}\\& \\\\ \\hline
|
1012
|
+
\\end{reviewtable}
|
1013
|
+
EOS
|
1014
|
+
assert_equal expected, actual
|
572
1015
|
end
|
573
1016
|
|
574
1017
|
def test_imgtable
|
575
1018
|
def @chapter.image(_id)
|
576
|
-
item = Book::
|
1019
|
+
item = Book::Index::Item.new('sampleimg', 1, 'sample img')
|
577
1020
|
item.instance_eval { @path = './images/chap1-sampleimg.png' }
|
578
1021
|
item
|
579
1022
|
end
|
@@ -594,7 +1037,7 @@ EOS
|
|
594
1037
|
|
595
1038
|
def test_bib
|
596
1039
|
def @chapter.bibpaper(_id)
|
597
|
-
Book::
|
1040
|
+
Book::Index::Item.new('samplebib', 1, 'sample bib')
|
598
1041
|
end
|
599
1042
|
|
600
1043
|
assert_equal '\\reviewbibref{[1]}{bib:samplebib}', compile_inline('@<bib>{samplebib}')
|
@@ -602,20 +1045,32 @@ EOS
|
|
602
1045
|
|
603
1046
|
def test_bibpaper
|
604
1047
|
def @chapter.bibpaper(_id)
|
605
|
-
Book::
|
1048
|
+
Book::Index::Item.new('samplebib', 1, 'sample bib')
|
606
1049
|
end
|
607
1050
|
|
608
1051
|
actual = compile_block("//bibpaper[samplebib][sample bib @<b>{bold}]{\na\nb\n//}\n")
|
609
|
-
|
1052
|
+
expected = <<-EOS
|
1053
|
+
[1] sample bib \\textbf{bold}
|
1054
|
+
\\label{bib:samplebib}
|
1055
|
+
|
1056
|
+
ab
|
1057
|
+
|
1058
|
+
EOS
|
1059
|
+
assert_equal expected, actual
|
610
1060
|
end
|
611
1061
|
|
612
1062
|
def test_bibpaper_without_body
|
613
1063
|
def @chapter.bibpaper(_id)
|
614
|
-
Book::
|
1064
|
+
Book::Index::Item.new('samplebib', 1, 'sample bib')
|
615
1065
|
end
|
616
1066
|
|
617
1067
|
actual = compile_block("//bibpaper[samplebib][sample bib]\n")
|
618
|
-
|
1068
|
+
expected = <<-EOS
|
1069
|
+
[1] sample bib
|
1070
|
+
\\label{bib:samplebib}
|
1071
|
+
|
1072
|
+
EOS
|
1073
|
+
assert_equal expected, actual
|
619
1074
|
end
|
620
1075
|
|
621
1076
|
def column_helper(review)
|
@@ -739,8 +1194,10 @@ EOS
|
|
739
1194
|
expected = <<-EOS
|
740
1195
|
|
741
1196
|
\\begin{itemize}
|
742
|
-
\\item AAA
|
743
|
-
|
1197
|
+
\\item AAA
|
1198
|
+
{-}AA
|
1199
|
+
\\item BBB
|
1200
|
+
{-}BB
|
744
1201
|
\\end{itemize}
|
745
1202
|
EOS
|
746
1203
|
actual = compile_block(src)
|
@@ -832,35 +1289,147 @@ EOS
|
|
832
1289
|
|
833
1290
|
def test_major_blocks
|
834
1291
|
actual = compile_block("//note{\nA\n\nB\n//}\n//note[caption]{\nA\n//}")
|
835
|
-
expected =
|
1292
|
+
expected = <<-EOS
|
1293
|
+
\\begin{reviewminicolumn}
|
1294
|
+
|
1295
|
+
A
|
1296
|
+
|
1297
|
+
B
|
1298
|
+
|
1299
|
+
\\end{reviewminicolumn}
|
1300
|
+
\\begin{reviewminicolumn}
|
1301
|
+
\\reviewminicolumntitle{caption}
|
1302
|
+
|
1303
|
+
A
|
1304
|
+
|
1305
|
+
\\end{reviewminicolumn}
|
1306
|
+
EOS
|
836
1307
|
assert_equal expected, actual
|
837
1308
|
|
838
1309
|
actual = compile_block("//memo{\nA\n\nB\n//}\n//memo[caption]{\nA\n//}")
|
839
|
-
expected =
|
1310
|
+
expected = <<-EOS
|
1311
|
+
\\begin{reviewminicolumn}
|
1312
|
+
|
1313
|
+
A
|
1314
|
+
|
1315
|
+
B
|
1316
|
+
|
1317
|
+
\\end{reviewminicolumn}
|
1318
|
+
\\begin{reviewminicolumn}
|
1319
|
+
\\reviewminicolumntitle{caption}
|
1320
|
+
|
1321
|
+
A
|
1322
|
+
|
1323
|
+
\\end{reviewminicolumn}
|
1324
|
+
EOS
|
840
1325
|
assert_equal expected, actual
|
841
1326
|
|
842
1327
|
actual = compile_block("//info{\nA\n\nB\n//}\n//info[caption]{\nA\n//}")
|
843
|
-
expected =
|
1328
|
+
expected = <<-EOS
|
1329
|
+
\\begin{reviewminicolumn}
|
1330
|
+
|
1331
|
+
A
|
1332
|
+
|
1333
|
+
B
|
1334
|
+
|
1335
|
+
\\end{reviewminicolumn}
|
1336
|
+
\\begin{reviewminicolumn}
|
1337
|
+
\\reviewminicolumntitle{caption}
|
1338
|
+
|
1339
|
+
A
|
1340
|
+
|
1341
|
+
\\end{reviewminicolumn}
|
1342
|
+
EOS
|
844
1343
|
assert_equal expected, actual
|
845
1344
|
|
846
1345
|
actual = compile_block("//important{\nA\n\nB\n//}\n//important[caption]{\nA\n//}")
|
847
|
-
expected =
|
1346
|
+
expected = <<-EOS
|
1347
|
+
\\begin{reviewminicolumn}
|
1348
|
+
|
1349
|
+
A
|
1350
|
+
|
1351
|
+
B
|
1352
|
+
|
1353
|
+
\\end{reviewminicolumn}
|
1354
|
+
\\begin{reviewminicolumn}
|
1355
|
+
\\reviewminicolumntitle{caption}
|
1356
|
+
|
1357
|
+
A
|
1358
|
+
|
1359
|
+
\\end{reviewminicolumn}
|
1360
|
+
EOS
|
848
1361
|
assert_equal expected, actual
|
849
1362
|
|
850
1363
|
actual = compile_block("//caution{\nA\n\nB\n//}\n//caution[caption]{\nA\n//}")
|
851
|
-
expected =
|
1364
|
+
expected = <<-EOS
|
1365
|
+
\\begin{reviewminicolumn}
|
1366
|
+
|
1367
|
+
A
|
1368
|
+
|
1369
|
+
B
|
1370
|
+
|
1371
|
+
\\end{reviewminicolumn}
|
1372
|
+
\\begin{reviewminicolumn}
|
1373
|
+
\\reviewminicolumntitle{caption}
|
1374
|
+
|
1375
|
+
A
|
1376
|
+
|
1377
|
+
\\end{reviewminicolumn}
|
1378
|
+
EOS
|
852
1379
|
assert_equal expected, actual
|
853
1380
|
|
854
1381
|
actual = compile_block("//notice{\nA\n\nB\n//}\n//notice[caption]{\nA\n//}")
|
855
|
-
expected =
|
1382
|
+
expected = <<-EOS
|
1383
|
+
\\begin{reviewminicolumn}
|
1384
|
+
|
1385
|
+
A
|
1386
|
+
|
1387
|
+
B
|
1388
|
+
|
1389
|
+
\\end{reviewminicolumn}
|
1390
|
+
\\begin{reviewminicolumn}
|
1391
|
+
\\reviewminicolumntitle{caption}
|
1392
|
+
|
1393
|
+
A
|
1394
|
+
|
1395
|
+
\\end{reviewminicolumn}
|
1396
|
+
EOS
|
856
1397
|
assert_equal expected, actual
|
857
1398
|
|
858
1399
|
actual = compile_block("//warning{\nA\n\nB\n//}\n//warning[caption]{\nA\n//}")
|
859
|
-
expected =
|
1400
|
+
expected = <<-EOS
|
1401
|
+
\\begin{reviewminicolumn}
|
1402
|
+
|
1403
|
+
A
|
1404
|
+
|
1405
|
+
B
|
1406
|
+
|
1407
|
+
\\end{reviewminicolumn}
|
1408
|
+
\\begin{reviewminicolumn}
|
1409
|
+
\\reviewminicolumntitle{caption}
|
1410
|
+
|
1411
|
+
A
|
1412
|
+
|
1413
|
+
\\end{reviewminicolumn}
|
1414
|
+
EOS
|
860
1415
|
assert_equal expected, actual
|
861
1416
|
|
862
1417
|
actual = compile_block("//tip{\nA\n\nB\n//}\n//tip[caption]{\nA\n//}")
|
863
|
-
expected =
|
1418
|
+
expected = <<-EOS
|
1419
|
+
\\begin{reviewminicolumn}
|
1420
|
+
|
1421
|
+
A
|
1422
|
+
|
1423
|
+
B
|
1424
|
+
|
1425
|
+
\\end{reviewminicolumn}
|
1426
|
+
\\begin{reviewminicolumn}
|
1427
|
+
\\reviewminicolumntitle{caption}
|
1428
|
+
|
1429
|
+
A
|
1430
|
+
|
1431
|
+
\\end{reviewminicolumn}
|
1432
|
+
EOS
|
864
1433
|
assert_equal expected, actual
|
865
1434
|
end
|
866
1435
|
|
@@ -895,24 +1464,24 @@ EOS
|
|
895
1464
|
|
896
1465
|
def test_inline_imgref
|
897
1466
|
def @chapter.image(_id)
|
898
|
-
item = Book::
|
1467
|
+
item = Book::Index::Item.new('sampleimg', 1, 'sample photo')
|
899
1468
|
item.instance_eval { @path = './images/chap1-sampleimg.png' }
|
900
1469
|
item
|
901
1470
|
end
|
902
1471
|
|
903
|
-
actual = compile_block
|
1472
|
+
actual = compile_block("@<imgref>{sampleimg}\n")
|
904
1473
|
expected = "\n\\reviewimageref{1.1}{image:chap1:sampleimg}「sample photo」\n"
|
905
1474
|
assert_equal expected, actual
|
906
1475
|
end
|
907
1476
|
|
908
1477
|
def test_inline_imgref2
|
909
1478
|
def @chapter.image(_id)
|
910
|
-
item = Book::
|
1479
|
+
item = Book::Index::Item.new('sampleimg', 1)
|
911
1480
|
item.instance_eval { @path = './images/chap1-sampleimg.png' }
|
912
1481
|
item
|
913
1482
|
end
|
914
1483
|
|
915
|
-
actual = compile_block
|
1484
|
+
actual = compile_block("@<imgref>{sampleimg}\n")
|
916
1485
|
expected = "\n\\reviewimageref{1.1}{image:chap1:sampleimg}\n"
|
917
1486
|
assert_equal expected, actual
|
918
1487
|
end
|
@@ -975,18 +1544,18 @@ EOS
|
|
975
1544
|
end
|
976
1545
|
|
977
1546
|
def test_inline_unknown
|
978
|
-
e = assert_raises(ReVIEW::ApplicationError) { compile_block
|
1547
|
+
e = assert_raises(ReVIEW::ApplicationError) { compile_block("@<img>{n}\n") }
|
979
1548
|
assert_equal ':1: error: unknown image: n', e.message
|
980
|
-
e = assert_raises(ReVIEW::ApplicationError) { compile_block
|
1549
|
+
e = assert_raises(ReVIEW::ApplicationError) { compile_block("@<fn>{n}\n") }
|
981
1550
|
assert_equal ':1: error: unknown footnote: n', e.message
|
982
|
-
e = assert_raises(ReVIEW::ApplicationError) { compile_block
|
1551
|
+
e = assert_raises(ReVIEW::ApplicationError) { compile_block("@<hd>{n}\n") }
|
983
1552
|
assert_equal ':1: error: unknown headline: n', e.message
|
984
1553
|
%w[list table column].each do |name|
|
985
|
-
e = assert_raises(ReVIEW::ApplicationError) { compile_block
|
1554
|
+
e = assert_raises(ReVIEW::ApplicationError) { compile_block("@<#{name}>{n}\n") }
|
986
1555
|
assert_equal ":1: error: unknown #{name}: n", e.message
|
987
1556
|
end
|
988
1557
|
%w[chap chapref title].each do |name|
|
989
|
-
e = assert_raises(ReVIEW::ApplicationError) { compile_block
|
1558
|
+
e = assert_raises(ReVIEW::ApplicationError) { compile_block("@<#{name}>{n}\n") }
|
990
1559
|
assert_equal ':1: error: key not found: "n"', e.message
|
991
1560
|
end
|
992
1561
|
end
|
@@ -1051,7 +1620,7 @@ EOS
|
|
1051
1620
|
end
|
1052
1621
|
|
1053
1622
|
def @chapter.image(_id)
|
1054
|
-
item = Book::
|
1623
|
+
item = Book::Index::Item.new('sampleimg', 1)
|
1055
1624
|
item.instance_eval { @path = './images/chap1-sampleimg.png' }
|
1056
1625
|
item
|
1057
1626
|
end
|