review 4.1.0 → 4.2.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.yml +1 -1
- data/.rubocop.yml +4 -1
- data/NEWS.ja.md +29 -0
- data/NEWS.md +29 -0
- data/bin/review-index +2 -89
- data/bin/review-vol +4 -78
- data/doc/config.yml.sample +18 -5
- data/doc/config.yml.sample-simple +1 -1
- data/doc/pdfmaker.ja.md +42 -0
- data/doc/pdfmaker.md +41 -0
- data/doc/quickstart.ja.md +8 -5
- data/doc/quickstart.md +7 -4
- data/lib/review/book/base.rb +2 -4
- data/lib/review/book/compilable.rb +1 -5
- data/lib/review/book/page_metric.rb +7 -7
- data/lib/review/book/part.rb +6 -3
- data/lib/review/book/volume.rb +3 -4
- data/lib/review/builder.rb +23 -10
- data/lib/review/compiler.rb +9 -9
- data/lib/review/configure.rb +6 -0
- data/lib/review/epubmaker.rb +1 -1
- data/lib/review/htmlbuilder.rb +56 -16
- data/lib/review/idgxmlbuilder.rb +63 -22
- data/lib/review/latexbuilder.rb +70 -19
- data/lib/review/makerhelper.rb +18 -1
- data/lib/review/pdfmaker.rb +8 -1
- data/lib/review/plaintextbuilder.rb +41 -11
- data/lib/review/textmaker.rb +1 -1
- data/lib/review/textutils.rb +2 -3
- data/lib/review/tocprinter.rb +231 -102
- data/lib/review/topbuilder.rb +47 -13
- data/lib/review/version.rb +1 -1
- data/lib/review/volumeprinter.rb +99 -0
- data/lib/review/webmaker.rb +1 -1
- data/lib/review/webtocprinter.rb +38 -35
- data/review.gemspec +1 -1
- data/samples/sample-book/src/config.yml +1 -1
- data/templates/web/html/layout-html5.html.erb +2 -2
- data/test/test_book.rb +1 -1
- data/test/test_book_part.rb +3 -3
- data/test/test_helper.rb +4 -1
- data/test/test_htmlbuilder.rb +179 -0
- data/test/test_idgxmlbuilder.rb +143 -0
- data/test/test_latexbuilder.rb +223 -0
- data/test/test_pdfmaker.rb +17 -0
- data/test/test_plaintextbuilder.rb +99 -0
- data/test/test_topbuilder.rb +116 -2
- data/test/test_webtocprinter.rb +66 -34
- metadata +3 -5
- data/lib/review/tocparser.rb +0 -275
- data/test/test_tocparser.rb +0 -25
data/test/test_idgxmlbuilder.rb
CHANGED
@@ -100,6 +100,27 @@ class IDGXMLBuidlerTest < Test::Unit::TestCase
|
|
100
100
|
assert_equal %Q(<table><tbody><tr><b>1</b>\t<i>2</i></tr><tr type="lastline"><b>3</b>\t<i>4</i><>&</tr></tbody></table>), actual
|
101
101
|
end
|
102
102
|
|
103
|
+
def test_table
|
104
|
+
actual = compile_block("//table{\naaa\tbbb\n------------\nccc\tddd<>&\n//}\n")
|
105
|
+
expected = <<-EOS.chomp
|
106
|
+
<table><tbody xmlns:aid5="http://ns.adobe.com/AdobeInDesign/5.0/" aid:table="table" aid:trows="2" aid:tcols="2"><td xyh="1,1,1" aid:table="cell" aid:theader="1" aid:crows="1" aid:ccols="1" aid:ccolwidth="14.172">aaa</td><td xyh="2,1,1" aid:table="cell" aid:theader="1" aid:crows="1" aid:ccols="1" aid:ccolwidth="14.172">bbb</td><td xyh="1,2,1" aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="14.172">ccc</td><td xyh="2,2,1" aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="14.172">ddd<>&</td></tbody></table>
|
107
|
+
EOS
|
108
|
+
assert_equal expected, actual
|
109
|
+
|
110
|
+
actual = compile_block("//table[foo][FOO]{\naaa\tbbb\n------------\nccc\tddd<>&\n//}\n")
|
111
|
+
expected = <<-EOS.chomp
|
112
|
+
<table><caption>表1.1 FOO</caption><tbody xmlns:aid5="http://ns.adobe.com/AdobeInDesign/5.0/" aid:table="table" aid:trows="2" aid:tcols="2"><td xyh="1,1,1" aid:table="cell" aid:theader="1" aid:crows="1" aid:ccols="1" aid:ccolwidth="14.172">aaa</td><td xyh="2,1,1" aid:table="cell" aid:theader="1" aid:crows="1" aid:ccols="1" aid:ccolwidth="14.172">bbb</td><td xyh="1,2,1" aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="14.172">ccc</td><td xyh="2,2,1" aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="14.172">ddd<>&</td></tbody></table>
|
113
|
+
EOS
|
114
|
+
assert_equal expected, actual
|
115
|
+
|
116
|
+
@config['caption_position']['table'] = 'bottom'
|
117
|
+
actual = compile_block("//table[foo][FOO]{\naaa\tbbb\n------------\nccc\tddd<>&\n//}\n")
|
118
|
+
expected = <<-EOS.chomp
|
119
|
+
<table><tbody xmlns:aid5="http://ns.adobe.com/AdobeInDesign/5.0/" aid:table="table" aid:trows="2" aid:tcols="2"><td xyh="1,1,1" aid:table="cell" aid:theader="1" aid:crows="1" aid:ccols="1" aid:ccolwidth="14.172">aaa</td><td xyh="2,1,1" aid:table="cell" aid:theader="1" aid:crows="1" aid:ccols="1" aid:ccolwidth="14.172">bbb</td><td xyh="1,2,1" aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="14.172">ccc</td><td xyh="2,2,1" aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="14.172">ddd<>&</td></tbody><caption>表1.1 FOO</caption></table>
|
120
|
+
EOS
|
121
|
+
assert_equal expected, actual
|
122
|
+
end
|
123
|
+
|
103
124
|
def test_customize_cellwidth
|
104
125
|
actual = compile_block("//tsize[2,3,5]\n//table{\nA\tB\tC\n//}\n")
|
105
126
|
assert_equal %Q(<table><tbody xmlns:aid5="http://ns.adobe.com/AdobeInDesign/5.0/" aid:table="table" aid:trows="1" aid:tcols="3"><td xyh="1,1,0" aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="5.669">A</td><td xyh="2,1,0" aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="8.503">B</td><td xyh="3,1,0" aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="14.172">C</td></tbody></table>), actual
|
@@ -144,6 +165,10 @@ class IDGXMLBuidlerTest < Test::Unit::TestCase
|
|
144
165
|
def test_emtable
|
145
166
|
actual = compile_block("//emtable[foo]{\nA\n//}\n//emtable{\nA\n//}")
|
146
167
|
assert_equal %Q(<table><caption>foo</caption><tbody xmlns:aid5="http://ns.adobe.com/AdobeInDesign/5.0/" aid:table="table" aid:trows="1" aid:tcols="1"><td xyh="1,1,0" aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="28.345">A</td></tbody></table><table><tbody xmlns:aid5="http://ns.adobe.com/AdobeInDesign/5.0/" aid:table="table" aid:trows="1" aid:tcols="1"><td xyh="1,1,0" aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="28.345">A</td></tbody></table>), actual
|
168
|
+
|
169
|
+
@config['caption_position']['table'] = 'bottom'
|
170
|
+
actual = compile_block("//emtable[foo]{\nA\n//}\n//emtable{\nA\n//}")
|
171
|
+
assert_equal %Q(<table><tbody xmlns:aid5="http://ns.adobe.com/AdobeInDesign/5.0/" aid:table="table" aid:trows="1" aid:tcols="1"><td xyh="1,1,0" aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="28.345">A</td></tbody><caption>foo</caption></table><table><tbody xmlns:aid5="http://ns.adobe.com/AdobeInDesign/5.0/" aid:table="table" aid:trows="1" aid:tcols="1"><td xyh="1,1,0" aid:table="cell" aid:crows="1" aid:ccols="1" aid:ccolwidth="28.345">A</td></tbody></table>), actual
|
147
172
|
end
|
148
173
|
|
149
174
|
def test_table_row_separator
|
@@ -329,11 +354,19 @@ EOS
|
|
329
354
|
def test_emlist
|
330
355
|
actual = compile_block("//emlist[this is @<b>{test}<&>_]{\ntest1\ntest1.5\n\ntest@<i>{2}\n//}\n")
|
331
356
|
assert_equal %Q(<list type='emlist'><caption aid:pstyle='emlist-title'>this is <b>test</b><&>_</caption><pre>test1\ntest1.5\n\ntest<i>2</i>\n</pre></list>), actual
|
357
|
+
|
358
|
+
@config['caption_position']['list'] = 'bottom'
|
359
|
+
actual = compile_block("//emlist[this is @<b>{test}<&>_]{\ntest1\ntest1.5\n\ntest@<i>{2}\n//}\n")
|
360
|
+
assert_equal %Q(<list type='emlist'><pre>test1\ntest1.5\n\ntest<i>2</i>\n</pre><caption aid:pstyle='emlist-title'>this is <b>test</b><&>_</caption></list>), actual
|
332
361
|
end
|
333
362
|
|
334
363
|
def test_emlistnum
|
335
364
|
actual = compile_block("//emlistnum[this is @<b>{test}<&>_]{\ntest1\ntest1.5\n\ntest@<i>{2}\n//}\n")
|
336
365
|
assert_equal %Q(<list type='emlistnum'><caption aid:pstyle='emlistnum-title'>this is <b>test</b><&>_</caption><pre><span type='lineno'> 1: </span>test1\n<span type='lineno'> 2: </span>test1.5\n<span type='lineno'> 3: </span>\n<span type='lineno'> 4: </span>test<i>2</i>\n</pre></list>), actual
|
366
|
+
|
367
|
+
@config['caption_position']['list'] = 'bottom'
|
368
|
+
actual = compile_block("//emlistnum[this is @<b>{test}<&>_]{\ntest1\ntest1.5\n\ntest@<i>{2}\n//}\n")
|
369
|
+
assert_equal %Q(<list type='emlistnum'><pre><span type='lineno'> 1: </span>test1\n<span type='lineno'> 2: </span>test1.5\n<span type='lineno'> 3: </span>\n<span type='lineno'> 4: </span>test<i>2</i>\n</pre><caption aid:pstyle='emlistnum-title'>this is <b>test</b><&>_</caption></list>), actual
|
337
370
|
end
|
338
371
|
|
339
372
|
def test_emlist_listinfo
|
@@ -385,6 +418,17 @@ test1.5
|
|
385
418
|
|
386
419
|
test<i>2</i>
|
387
420
|
</pre></codelist>
|
421
|
+
EOS
|
422
|
+
assert_equal expected, actual
|
423
|
+
|
424
|
+
@config['caption_position']['list'] = 'bottom'
|
425
|
+
actual = compile_block("//list[samplelist][this is @<b>{test}<&>_]{\ntest1\ntest1.5\n\ntest@<i>{2}\n//}\n")
|
426
|
+
expected = <<-EOS.chomp
|
427
|
+
<codelist><pre>test1
|
428
|
+
test1.5
|
429
|
+
|
430
|
+
test<i>2</i>
|
431
|
+
</pre><caption>リスト1.1 this is <b>test</b><&>_</caption></codelist>
|
388
432
|
EOS
|
389
433
|
assert_equal expected, actual
|
390
434
|
end
|
@@ -400,6 +444,17 @@ EOS
|
|
400
444
|
<span type='lineno'> 3: </span>
|
401
445
|
<span type='lineno'> 4: </span>test<i>2</i>
|
402
446
|
</pre></codelist>
|
447
|
+
EOS
|
448
|
+
assert_equal expected, actual
|
449
|
+
|
450
|
+
@config['caption_position']['list'] = 'bottom'
|
451
|
+
actual = compile_block("//listnum[samplelist][this is @<b>{test}<&>_]{\ntest1\ntest1.5\n\ntest@<i>{2}\n//}\n")
|
452
|
+
expected = <<-EOS.chomp
|
453
|
+
<codelist><pre><span type='lineno'> 1: </span>test1
|
454
|
+
<span type='lineno'> 2: </span>test1.5
|
455
|
+
<span type='lineno'> 3: </span>
|
456
|
+
<span type='lineno'> 4: </span>test<i>2</i>
|
457
|
+
</pre><caption>リスト1.1 this is <b>test</b><&>_</caption></codelist>
|
403
458
|
EOS
|
404
459
|
assert_equal expected, actual
|
405
460
|
end
|
@@ -415,6 +470,17 @@ EOS
|
|
415
470
|
<span type='lineno'>102: </span>
|
416
471
|
<span type='lineno'>103: </span>test<i>2</i>
|
417
472
|
</pre></codelist>
|
473
|
+
EOS
|
474
|
+
assert_equal expected, actual
|
475
|
+
|
476
|
+
@config['caption_position']['list'] = 'bottom'
|
477
|
+
actual = compile_block("//firstlinenum[100]\n//listnum[samplelist][this is @<b>{test}<&>_]{\ntest1\ntest1.5\n\ntest@<i>{2}\n//}\n")
|
478
|
+
expected = <<-EOS.chomp
|
479
|
+
<codelist><pre><span type='lineno'>100: </span>test1
|
480
|
+
<span type='lineno'>101: </span>test1.5
|
481
|
+
<span type='lineno'>102: </span>
|
482
|
+
<span type='lineno'>103: </span>test<i>2</i>
|
483
|
+
</pre><caption>リスト1.1 this is <b>test</b><&>_</caption></codelist>
|
418
484
|
EOS
|
419
485
|
assert_equal expected, actual
|
420
486
|
end
|
@@ -431,6 +497,17 @@ EOS
|
|
431
497
|
</listinfo><listinfo line="3">
|
432
498
|
</listinfo><listinfo line="4" end="4">test<i>2</i>
|
433
499
|
</listinfo></pre></codelist>
|
500
|
+
EOS
|
501
|
+
assert_equal expected, actual
|
502
|
+
|
503
|
+
@config['caption_position']['list'] = 'bottom'
|
504
|
+
actual = compile_block("//list[samplelist][this is @<b>{test}<&>_]{\ntest1\ntest1.5\n\ntest@<i>{2}\n//}\n")
|
505
|
+
expected = <<-EOS.chomp
|
506
|
+
<codelist><pre><listinfo line="1" begin="1">test1
|
507
|
+
</listinfo><listinfo line="2">test1.5
|
508
|
+
</listinfo><listinfo line="3">
|
509
|
+
</listinfo><listinfo line="4" end="4">test<i>2</i>
|
510
|
+
</listinfo></pre><caption>リスト1.1 this is <b>test</b><&>_</caption></codelist>
|
434
511
|
EOS
|
435
512
|
assert_equal expected, actual
|
436
513
|
end
|
@@ -449,6 +526,15 @@ EOS
|
|
449
526
|
<list type='cmd'><caption aid:pstyle='cmd-title'>cap1</caption><pre>lineA
|
450
527
|
lineB
|
451
528
|
</pre></list>
|
529
|
+
EOS
|
530
|
+
assert_equal expected, actual
|
531
|
+
|
532
|
+
@config['caption_position']['list'] = 'bottom'
|
533
|
+
actual = compile_block("//cmd[cap1]{\nlineA\nlineB\n//}\n")
|
534
|
+
expected = <<-EOS.chomp
|
535
|
+
<list type='cmd'><pre>lineA
|
536
|
+
lineB
|
537
|
+
</pre><caption aid:pstyle='cmd-title'>cap1</caption></list>
|
452
538
|
EOS
|
453
539
|
assert_equal expected, actual
|
454
540
|
end
|
@@ -461,6 +547,17 @@ bar
|
|
461
547
|
|
462
548
|
buz
|
463
549
|
</pre></source>
|
550
|
+
EOS
|
551
|
+
assert_equal expected, actual
|
552
|
+
|
553
|
+
@config['caption_position']['list'] = 'bottom'
|
554
|
+
actual = compile_block("//source[foo/bar/test.rb]{\nfoo\nbar\n\nbuz\n//}\n")
|
555
|
+
expected = <<-EOS.chomp
|
556
|
+
<source><pre>foo
|
557
|
+
bar
|
558
|
+
|
559
|
+
buz
|
560
|
+
</pre><caption>foo/bar/test.rb</caption></source>
|
464
561
|
EOS
|
465
562
|
assert_equal expected, actual
|
466
563
|
end
|
@@ -498,6 +595,17 @@ EOS
|
|
498
595
|
</listinfo><listinfo line="3">
|
499
596
|
</listinfo><listinfo line="4" end="4">test<i>2</i>
|
500
597
|
</listinfo></insn>
|
598
|
+
EOS
|
599
|
+
assert_equal expected, actual
|
600
|
+
|
601
|
+
@config['caption_position']['list'] = 'bottom'
|
602
|
+
actual = compile_block("//insn[this is @<b>{test}<&>_]{\ntest1\ntest1.5\n\ntest@<i>{2}\n//}\n")
|
603
|
+
expected = <<-EOS.chomp
|
604
|
+
<insn><listinfo line="1" begin="1">test1
|
605
|
+
</listinfo><listinfo line="2">test1.5
|
606
|
+
</listinfo><listinfo line="3">
|
607
|
+
</listinfo><listinfo line="4" end="4">test<i>2</i>
|
608
|
+
</listinfo><floattitle type="insn">this is <b>test</b><&>_</floattitle></insn>
|
501
609
|
EOS
|
502
610
|
assert_equal expected, actual
|
503
611
|
end
|
@@ -511,6 +619,17 @@ EOS
|
|
511
619
|
</listinfo><listinfo line="3">
|
512
620
|
</listinfo><listinfo line="4" end="4">test<i>2</i>
|
513
621
|
</listinfo></box>
|
622
|
+
EOS
|
623
|
+
assert_equal expected, actual
|
624
|
+
|
625
|
+
@config['caption_position']['list'] = 'bottom'
|
626
|
+
actual = compile_block("//box[this is @<b>{test}<&>_]{\ntest1\ntest1.5\n\ntest@<i>{2}\n//}\n")
|
627
|
+
expected = <<-EOS.chomp
|
628
|
+
<box><listinfo line="1" begin="1">test1
|
629
|
+
</listinfo><listinfo line="2">test1.5
|
630
|
+
</listinfo><listinfo line="3">
|
631
|
+
</listinfo><listinfo line="4" end="4">test<i>2</i>
|
632
|
+
</listinfo><caption aid:pstyle="box-title">this is <b>test</b><&>_</caption></box>
|
514
633
|
EOS
|
515
634
|
assert_equal expected, actual
|
516
635
|
end
|
@@ -524,6 +643,17 @@ test1.5
|
|
524
643
|
|
525
644
|
test<i>2</i>
|
526
645
|
</box>
|
646
|
+
EOS
|
647
|
+
assert_equal expected, actual
|
648
|
+
|
649
|
+
@config['caption_position']['list'] = 'bottom'
|
650
|
+
actual = compile_block("//box[this is @<b>{test}<&>_]{\ntest1\ntest1.5\n\ntest@<i>{2}\n//}\n")
|
651
|
+
expected = <<-EOS.chomp
|
652
|
+
<box>test1
|
653
|
+
test1.5
|
654
|
+
|
655
|
+
test<i>2</i>
|
656
|
+
<caption aid:pstyle="box-title">this is <b>test</b><&>_</caption></box>
|
527
657
|
EOS
|
528
658
|
assert_equal expected, actual
|
529
659
|
end
|
@@ -569,6 +699,10 @@ EOS
|
|
569
699
|
|
570
700
|
actual = compile_block("//image[sampleimg][sample photo]{\n//}\n")
|
571
701
|
assert_equal %Q(<img><Image href="file://images/chap1-sampleimg.png" /><caption>図1.1 sample photo</caption></img>), actual
|
702
|
+
|
703
|
+
@config['caption_position']['image'] = 'top'
|
704
|
+
actual = compile_block("//image[sampleimg][sample photo]{\n//}\n")
|
705
|
+
assert_equal %Q(<img><caption>図1.1 sample photo</caption><Image href="file://images/chap1-sampleimg.png" /></img>), actual
|
572
706
|
end
|
573
707
|
|
574
708
|
def test_image_with_metric
|
@@ -602,6 +736,10 @@ EOS
|
|
602
736
|
|
603
737
|
actual = compile_block("//indepimage[sampleimg][sample photo]\n")
|
604
738
|
assert_equal %Q(<img><Image href="file://images/chap1-sampleimg.png" /><caption>sample photo</caption></img>), actual
|
739
|
+
|
740
|
+
@config['caption_position']['image'] = 'top'
|
741
|
+
actual = compile_block("//indepimage[sampleimg][sample photo]\n")
|
742
|
+
assert_equal %Q(<img><caption>sample photo</caption><Image href="file://images/chap1-sampleimg.png" /></img>), actual
|
605
743
|
end
|
606
744
|
|
607
745
|
def test_indepimage_without_caption
|
@@ -972,5 +1110,10 @@ EOS
|
|
972
1110
|
expected = %Q(<p><span type='eq'>式1.1</span></p><equationblock><caption>式1.1 The Equivalence of Mass <i>and</i> Energy</caption><replace idref="texblock-1"><pre>e=mc^2</pre></replace></equationblock>)
|
973
1111
|
actual = compile_block(src)
|
974
1112
|
assert_equal expected, actual
|
1113
|
+
|
1114
|
+
@config['caption_position']['equation'] = 'bottom'
|
1115
|
+
expected = %Q(<p><span type='eq'>式1.1</span></p><equationblock><replace idref="texblock-1"><pre>e=mc^2</pre></replace><caption>式1.1 The Equivalence of Mass <i>and</i> Energy</caption></equationblock>)
|
1116
|
+
actual = compile_block(src)
|
1117
|
+
assert_equal expected, actual
|
975
1118
|
end
|
976
1119
|
end
|
data/test/test_latexbuilder.rb
CHANGED
@@ -432,6 +432,22 @@ bar
|
|
432
432
|
buz
|
433
433
|
\\end{reviewcmd}
|
434
434
|
\\end{reviewlistblock}
|
435
|
+
EOS
|
436
|
+
assert_equal expected, actual
|
437
|
+
|
438
|
+
@config['caption_position']['list'] = 'bottom'
|
439
|
+
actual = compile_block("//cmd[cap1]{\nfoo\nbar\n\nbuz\n//}\n")
|
440
|
+
expected = <<-EOS
|
441
|
+
|
442
|
+
\\begin{reviewlistblock}
|
443
|
+
\\begin{reviewcmd}
|
444
|
+
foo
|
445
|
+
bar
|
446
|
+
|
447
|
+
buz
|
448
|
+
\\end{reviewcmd}
|
449
|
+
\\reviewcmdcaption{cap1}
|
450
|
+
\\end{reviewlistblock}
|
435
451
|
EOS
|
436
452
|
assert_equal expected, actual
|
437
453
|
end
|
@@ -507,6 +523,22 @@ bar
|
|
507
523
|
buz
|
508
524
|
\\end{reviewemlist}
|
509
525
|
\\end{reviewlistblock}
|
526
|
+
EOS
|
527
|
+
assert_equal expected, actual
|
528
|
+
|
529
|
+
@config['caption_position']['list'] = 'bottom'
|
530
|
+
actual = compile_block("//emlist[cap1]{\nfoo\nbar\n\nbuz\n//}\n")
|
531
|
+
expected = <<-EOS
|
532
|
+
|
533
|
+
\\begin{reviewlistblock}
|
534
|
+
\\begin{reviewemlist}
|
535
|
+
foo
|
536
|
+
bar
|
537
|
+
|
538
|
+
buz
|
539
|
+
\\end{reviewemlist}
|
540
|
+
\\reviewemlistcaption{cap1}
|
541
|
+
\\end{reviewlistblock}
|
510
542
|
EOS
|
511
543
|
assert_equal expected, actual
|
512
544
|
end
|
@@ -573,6 +605,22 @@ EOS
|
|
573
605
|
4: buz
|
574
606
|
\\end{reviewemlist}
|
575
607
|
\\end{reviewlistblock}
|
608
|
+
EOS
|
609
|
+
assert_equal expected, actual
|
610
|
+
|
611
|
+
@config['caption_position']['list'] = 'bottom'
|
612
|
+
actual = compile_block("//emlistnum[cap1]{\nfoo\nbar\n\nbuz\n//}\n")
|
613
|
+
expected = <<-EOS
|
614
|
+
|
615
|
+
\\begin{reviewlistblock}
|
616
|
+
\\begin{reviewemlist}
|
617
|
+
1: foo
|
618
|
+
2: bar
|
619
|
+
3:
|
620
|
+
4: buz
|
621
|
+
\\end{reviewemlist}
|
622
|
+
\\reviewemlistcaption{cap1}
|
623
|
+
\\end{reviewlistblock}
|
576
624
|
EOS
|
577
625
|
assert_equal expected, actual
|
578
626
|
end
|
@@ -589,6 +637,21 @@ bar
|
|
589
637
|
buz
|
590
638
|
\\end{reviewlist}
|
591
639
|
\\end{reviewlistblock}
|
640
|
+
EOS
|
641
|
+
assert_equal expected, actual
|
642
|
+
|
643
|
+
@config['caption_position']['list'] = 'bottom'
|
644
|
+
actual = compile_block("//list[id1][cap1]{\nfoo\nbar\n\nbuz\n//}\n")
|
645
|
+
expected = <<-EOS
|
646
|
+
\\begin{reviewlistblock}
|
647
|
+
\\begin{reviewlist}
|
648
|
+
foo
|
649
|
+
bar
|
650
|
+
|
651
|
+
buz
|
652
|
+
\\end{reviewlist}
|
653
|
+
\\reviewlistcaption{リスト1.1: cap1}
|
654
|
+
\\end{reviewlistblock}
|
592
655
|
EOS
|
593
656
|
assert_equal expected, actual
|
594
657
|
end
|
@@ -601,6 +664,16 @@ EOS
|
|
601
664
|
\\begin{reviewlistlst}[caption={cap1},language={sql}]
|
602
665
|
SELECT COUNT(*) FROM tests WHERE tests.no > 10 AND test.name LIKE 'ABC%'
|
603
666
|
\\end{reviewlistlst}
|
667
|
+
EOS
|
668
|
+
assert_equal expected, actual
|
669
|
+
|
670
|
+
@config['caption_position']['list'] = 'bottom'
|
671
|
+
# XXX: caption_position won't work with highlight
|
672
|
+
actual = compile_block("//list[id1][cap1][sql]{\nSELECT COUNT(*) FROM tests WHERE tests.no > 10 AND test.name LIKE 'ABC%'\n//}\n")
|
673
|
+
expected = <<-EOS
|
674
|
+
\\begin{reviewlistlst}[caption={cap1},language={sql}]
|
675
|
+
SELECT COUNT(*) FROM tests WHERE tests.no > 10 AND test.name LIKE 'ABC%'
|
676
|
+
\\end{reviewlistlst}
|
604
677
|
EOS
|
605
678
|
assert_equal expected, actual
|
606
679
|
end
|
@@ -633,6 +706,24 @@ EOS
|
|
633
706
|
7: end
|
634
707
|
\\end{reviewlist}
|
635
708
|
\\end{reviewlistblock}
|
709
|
+
EOS
|
710
|
+
assert_equal expected, actual
|
711
|
+
|
712
|
+
@config['caption_position']['list'] = 'bottom'
|
713
|
+
actual = compile_block("//listnum[test1][ruby]{\nclass Foo\n def foo\n bar\n\n buz\n end\nend\n//}\n")
|
714
|
+
expected = <<-EOS
|
715
|
+
\\begin{reviewlistblock}
|
716
|
+
\\begin{reviewlist}
|
717
|
+
1: class Foo
|
718
|
+
2: def foo
|
719
|
+
3: bar
|
720
|
+
4:
|
721
|
+
5: buz
|
722
|
+
6: end
|
723
|
+
7: end
|
724
|
+
\\end{reviewlist}
|
725
|
+
\\reviewlistcaption{リスト1.1: ruby}
|
726
|
+
\\end{reviewlistblock}
|
636
727
|
EOS
|
637
728
|
assert_equal expected, actual
|
638
729
|
end
|
@@ -670,6 +761,22 @@ class Foo
|
|
670
761
|
end
|
671
762
|
end
|
672
763
|
\\end{reviewlistnumlst}
|
764
|
+
EOS
|
765
|
+
assert_equal expected, actual
|
766
|
+
|
767
|
+
@config['caption_position']['list'] = 'bottom'
|
768
|
+
# XXX: caption_position won't work with highlight
|
769
|
+
actual = compile_block("//listnum[test1][ruby]{\nclass Foo\n def foo\n bar\n\n buz\n end\nend\n//}\n")
|
770
|
+
expected = <<-EOS
|
771
|
+
\\begin{reviewlistnumlst}[caption={ruby},language={}]
|
772
|
+
class Foo
|
773
|
+
def foo
|
774
|
+
bar
|
775
|
+
|
776
|
+
buz
|
777
|
+
end
|
778
|
+
end
|
779
|
+
\\end{reviewlistnumlst}
|
673
780
|
EOS
|
674
781
|
assert_equal expected, actual
|
675
782
|
end
|
@@ -704,6 +811,21 @@ bar
|
|
704
811
|
buz
|
705
812
|
\\end{reviewsource}
|
706
813
|
\\end{reviewlistblock}
|
814
|
+
EOS
|
815
|
+
assert_equal expected, actual
|
816
|
+
|
817
|
+
@config['caption_position']['list'] = 'bottom'
|
818
|
+
actual = compile_block("//source[foo/bar/test.rb]{\nfoo\nbar\n\nbuz\n//}\n")
|
819
|
+
expected = <<-EOS
|
820
|
+
\\begin{reviewlistblock}
|
821
|
+
\\begin{reviewsource}
|
822
|
+
foo
|
823
|
+
bar
|
824
|
+
|
825
|
+
buz
|
826
|
+
\\end{reviewsource}
|
827
|
+
\\reviewsourcecaption{foo/bar/test.rb}
|
828
|
+
\\end{reviewlistblock}
|
707
829
|
EOS
|
708
830
|
assert_equal expected, actual
|
709
831
|
end
|
@@ -732,6 +854,19 @@ EOS
|
|
732
854
|
foo
|
733
855
|
bar
|
734
856
|
|
857
|
+
buz
|
858
|
+
\\end{reviewsourcelst}
|
859
|
+
EOS
|
860
|
+
assert_equal expected, actual
|
861
|
+
|
862
|
+
@config['caption_position']['list'] = 'bottom'
|
863
|
+
# XXX: caption_position won't work with highlight
|
864
|
+
actual = compile_block("//source[foo/bar/test.rb]{\nfoo\nbar\n\nbuz\n//}\n")
|
865
|
+
expected = <<-EOS
|
866
|
+
\\begin{reviewsourcelst}[title={foo/bar/test.rb},language={}]
|
867
|
+
foo
|
868
|
+
bar
|
869
|
+
|
735
870
|
buz
|
736
871
|
\\end{reviewsourcelst}
|
737
872
|
EOS
|
@@ -888,6 +1023,18 @@ EOS
|
|
888
1023
|
|
889
1024
|
actual = compile_block("//image[sampleimg][sample photo][]{\n//}\n")
|
890
1025
|
assert_equal expected, actual
|
1026
|
+
|
1027
|
+
@book.config['pdfmaker']['use_original_image_size'] = nil
|
1028
|
+
@config['caption_position']['image'] = 'top'
|
1029
|
+
actual = compile_block("//image[sampleimg][sample photo]{\n//}\n")
|
1030
|
+
expected = <<-EOS
|
1031
|
+
\\begin{reviewimage}%%sampleimg
|
1032
|
+
\\reviewimagecaption{sample photo}
|
1033
|
+
\\label{image:chap1:sampleimg}
|
1034
|
+
\\reviewincludegraphics[width=\\maxwidth]{./images/chap1-sampleimg.png}
|
1035
|
+
\\end{reviewimage}
|
1036
|
+
EOS
|
1037
|
+
assert_equal expected, actual
|
891
1038
|
end
|
892
1039
|
|
893
1040
|
def test_image_with_metric
|
@@ -1008,6 +1155,17 @@ EOS
|
|
1008
1155
|
|
1009
1156
|
actual = compile_block("//indepimage[sampleimg][sample photo][]\n")
|
1010
1157
|
assert_equal expected, actual
|
1158
|
+
|
1159
|
+
@book.config['pdfmaker']['use_original_image_size'] = nil
|
1160
|
+
@config['caption_position']['image'] = 'top'
|
1161
|
+
actual = compile_block("//indepimage[sampleimg][sample photo]\n")
|
1162
|
+
expected = <<-EOS
|
1163
|
+
\\begin{reviewimage}%%sampleimg
|
1164
|
+
\\reviewindepimagecaption{図: sample photo}
|
1165
|
+
\\reviewincludegraphics[width=\\maxwidth]{./images/chap1-sampleimg.png}
|
1166
|
+
\\end{reviewimage}
|
1167
|
+
EOS
|
1168
|
+
assert_equal expected, actual
|
1011
1169
|
end
|
1012
1170
|
|
1013
1171
|
def test_indepimage_without_caption
|
@@ -1134,6 +1292,21 @@ EOS
|
|
1134
1292
|
ccc & ddd\\textless{}\\textgreater{}\\& \\\\ \\hline
|
1135
1293
|
\\end{reviewtable}
|
1136
1294
|
\\end{table}
|
1295
|
+
EOS
|
1296
|
+
assert_equal expected, actual
|
1297
|
+
|
1298
|
+
@config['caption_position']['table'] = 'bottom'
|
1299
|
+
actual = compile_block("//table[foo][FOO]{\naaa\tbbb\n------------\nccc\tddd<>&\n//}\n")
|
1300
|
+
expected = <<-EOS
|
1301
|
+
\\begin{table}%%foo
|
1302
|
+
\\begin{reviewtable}{|l|l|}
|
1303
|
+
\\hline
|
1304
|
+
\\reviewth{aaa} & \\reviewth{bbb} \\\\ \\hline
|
1305
|
+
ccc & ddd\\textless{}\\textgreater{}\\& \\\\ \\hline
|
1306
|
+
\\end{reviewtable}
|
1307
|
+
\\reviewtablecaption{FOO}
|
1308
|
+
\\label{table:chap1:foo}
|
1309
|
+
\\end{table}
|
1137
1310
|
EOS
|
1138
1311
|
assert_equal expected, actual
|
1139
1312
|
end
|
@@ -1240,6 +1413,26 @@ ccc & ddd\\textless{}\\textgreater{}\\& \\\\ \\hline
|
|
1240
1413
|
\\end{reviewtable}
|
1241
1414
|
\\end{table}
|
1242
1415
|
|
1416
|
+
\\begin{reviewtable}{|l|l|}
|
1417
|
+
\\hline
|
1418
|
+
\\reviewth{aaa} & \\reviewth{bbb} \\\\ \\hline
|
1419
|
+
ccc & ddd\\textless{}\\textgreater{}\\& \\\\ \\hline
|
1420
|
+
\\end{reviewtable}
|
1421
|
+
EOS
|
1422
|
+
assert_equal expected, actual
|
1423
|
+
|
1424
|
+
@config['caption_position']['table'] = 'bottom'
|
1425
|
+
actual = compile_block("//emtable[foo]{\naaa\tbbb\n------------\nccc\tddd<>&\n//}\n//emtable{\naaa\tbbb\n------------\nccc\tddd<>&\n//}\n")
|
1426
|
+
expected = <<-EOS
|
1427
|
+
\\begin{table}%%
|
1428
|
+
\\begin{reviewtable}{|l|l|}
|
1429
|
+
\\hline
|
1430
|
+
\\reviewth{aaa} & \\reviewth{bbb} \\\\ \\hline
|
1431
|
+
ccc & ddd\\textless{}\\textgreater{}\\& \\\\ \\hline
|
1432
|
+
\\end{reviewtable}
|
1433
|
+
\\reviewtablecaption*{foo}
|
1434
|
+
\\end{table}
|
1435
|
+
|
1243
1436
|
\\begin{reviewtable}{|l|l|}
|
1244
1437
|
\\hline
|
1245
1438
|
\\reviewth{aaa} & \\reviewth{bbb} \\\\ \\hline
|
@@ -1285,6 +1478,21 @@ EOS
|
|
1285
1478
|
|
1286
1479
|
actual = compile_block("//imgtable[sampleimg][test for imgtable][]{\n//}\n")
|
1287
1480
|
assert_equal expected, actual
|
1481
|
+
|
1482
|
+
@book.config['pdfmaker']['use_original_image_size'] = nil
|
1483
|
+
@config['caption_position']['table'] = 'bottom'
|
1484
|
+
actual = compile_block("//imgtable[sampleimg][test for imgtable]{\n//}\n")
|
1485
|
+
|
1486
|
+
expected = <<-EOS
|
1487
|
+
\\begin{table}[h]%%sampleimg
|
1488
|
+
\\label{table:chap1:sampleimg}
|
1489
|
+
\\begin{reviewimage}%%sampleimg
|
1490
|
+
\\reviewincludegraphics[width=\\maxwidth]{./images/chap1-sampleimg.png}
|
1491
|
+
\\end{reviewimage}
|
1492
|
+
\\reviewimgtablecaption{test for imgtable}
|
1493
|
+
\\end{table}
|
1494
|
+
EOS
|
1495
|
+
assert_equal expected, actual
|
1288
1496
|
end
|
1289
1497
|
|
1290
1498
|
def test_imgtable_with_metrics
|
@@ -2039,6 +2247,21 @@ EOS
|
|
2039
2247
|
e=mc^2
|
2040
2248
|
\\end{equation*}
|
2041
2249
|
\\end{reviewequationblock}
|
2250
|
+
EOS
|
2251
|
+
actual = compile_block(src)
|
2252
|
+
assert_equal expected, actual
|
2253
|
+
|
2254
|
+
@config['caption_position']['equation'] = 'bottom'
|
2255
|
+
expected = <<-EOS
|
2256
|
+
|
2257
|
+
\\reviewequationref{1.1}
|
2258
|
+
|
2259
|
+
\\begin{reviewequationblock}
|
2260
|
+
\\begin{equation*}
|
2261
|
+
e=mc^2
|
2262
|
+
\\end{equation*}
|
2263
|
+
\\reviewequationcaption{式1.1: The Equivalence of Mass \\reviewit{and} Energy}
|
2264
|
+
\\end{reviewequationblock}
|
2042
2265
|
EOS
|
2043
2266
|
actual = compile_block(src)
|
2044
2267
|
assert_equal expected, actual
|