review 3.2.0 → 4.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +26 -4
- data/.travis.yml +1 -1
- data/NEWS.ja.md +97 -1
- data/NEWS.md +97 -1
- data/bin/review-catalog-converter +1 -1
- data/bin/review-check +5 -5
- data/bin/review-checkdep +1 -1
- data/bin/review-compile +5 -5
- data/bin/review-idgxmlmaker +16 -0
- data/bin/review-index +7 -7
- data/bin/review-preproc +9 -9
- data/bin/review-validate +2 -2
- data/bin/review-vol +5 -5
- data/doc/config.yml.sample +14 -6
- data/doc/config.yml.sample-simple +1 -1
- data/doc/format.ja.md +15 -5
- data/doc/format.md +30 -18
- data/doc/pdfmaker.ja.md +1 -1
- data/doc/pdfmaker.md +1 -1
- data/lib/review/book.rb +1 -1
- data/lib/review/book/base.rb +23 -63
- data/lib/review/book/chapter.rb +18 -3
- data/lib/review/book/compilable.rb +5 -0
- data/lib/review/book/index.rb +26 -65
- data/lib/review/book/index/item.rb +40 -0
- data/lib/review/book/part.rb +22 -2
- data/lib/review/builder.rb +60 -40
- data/lib/review/catalog.rb +12 -15
- data/lib/review/compiler.rb +68 -36
- data/lib/review/configure.rb +10 -7
- data/lib/review/epubmaker.rb +5 -2
- data/lib/review/htmlbuilder.rb +24 -71
- data/lib/review/htmlutils.rb +2 -3
- data/lib/review/i18n.rb +2 -2
- data/lib/review/idgxmlbuilder.rb +101 -55
- data/lib/review/idgxmlmaker.rb +184 -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 +110 -26
- data/lib/review/latexbuilder.rb +76 -54
- data/lib/review/lineinput.rb +1 -1
- data/lib/review/logger.rb +4 -8
- data/lib/review/makerhelper.rb +6 -4
- data/lib/review/markdownbuilder.rb +25 -38
- data/lib/review/md2inaobuilder.rb +3 -5
- data/lib/review/pdfmaker.rb +15 -15
- data/lib/review/plaintextbuilder.rb +67 -76
- data/lib/review/preprocessor.rb +13 -13
- data/lib/review/rstbuilder.rb +31 -31
- data/lib/review/textmaker.rb +13 -3
- data/lib/review/textutils.rb +77 -2
- data/lib/review/tocparser.rb +17 -17
- data/lib/review/tocprinter.rb +8 -8
- data/lib/review/topbuilder.rb +76 -57
- data/lib/review/update.rb +16 -16
- data/lib/review/version.rb +1 -1
- data/lib/review/webmaker.rb +2 -2
- data/lib/review/yamlloader.rb +3 -0
- data/review.gemspec +4 -3
- data/samples/sample-book/README.md +7 -2
- data/samples/sample-book/src/.gitignore +153 -0
- data/samples/sample-book/src/config-jlreq.yml +6 -0
- data/samples/sample-book/src/lib/tasks/review.rake +20 -9
- data/samples/sample-book/src/lib/tasks/z01_copy_sty.rake +14 -8
- data/samples/syntax-book/ch03.re +3 -6
- data/samples/syntax-book/config-jlreq.yml +5 -0
- data/samples/syntax-book/lib/tasks/review.rake +7 -7
- data/samples/syntax-book/lib/tasks/z01_copy_sty.rake +14 -8
- data/templates/latex/config.erb +6 -0
- data/templates/latex/layout.tex.erb +1 -0
- data/templates/latex/review-jlreq/review-base.sty +93 -31
- data/templates/latex/review-jlreq/review-jlreq.cls +6 -0
- data/templates/latex/review-jlreq/review-style.sty +3 -0
- data/templates/latex/review-jsbook/README.md +39 -0
- data/templates/latex/review-jsbook/review-base.sty +65 -10
- data/templates/latex/review-jsbook/review-jsbook.cls +4 -0
- data/templates/latex/review-jsbook/review-style.sty +4 -1
- data/test/assets/test_template.tex +11 -3
- data/test/assets/test_template_backmatter.tex +11 -3
- data/test/test_book.rb +65 -19
- data/test/test_catalog.rb +18 -42
- data/test/test_catalog_converter_cmd.rb +1 -1
- data/test/test_epubmaker_cmd.rb +2 -2
- data/test/test_helper.rb +1 -1
- data/test/test_htmlbuilder.rb +144 -55
- data/test/test_i18n.rb +25 -25
- data/test/test_idgxmlbuilder.rb +60 -18
- data/test/test_image_finder.rb +6 -6
- data/test/test_latexbuilder.rb +128 -24
- data/test/test_latexbuilder_v2.rb +23 -23
- data/test/test_logger.rb +14 -1
- data/test/test_makerhelper.rb +3 -3
- data/test/test_markdownbuilder.rb +45 -4
- data/test/test_md2inaobuilder.rb +12 -2
- data/test/test_pdfmaker.rb +1 -1
- data/test/test_pdfmaker_cmd.rb +1 -1
- data/test/test_plaintextbuilder.rb +31 -6
- data/test/test_rstbuilder.rb +33 -4
- data/test/test_textutils.rb +109 -2
- data/test/test_topbuilder.rb +35 -7
- data/test/test_update.rb +17 -8
- data/test/test_yamlloader.rb +13 -0
- metadata +26 -2
@@ -4,7 +4,7 @@ require 'fileutils'
|
|
4
4
|
require 'yaml'
|
5
5
|
require 'rbconfig'
|
6
6
|
|
7
|
-
load
|
7
|
+
load(File.expand_path('../bin/review-catalog-converter', File.dirname(__FILE__)))
|
8
8
|
|
9
9
|
class CatalogConverterCmdTest < Test::Unit::TestCase
|
10
10
|
def test_parse_chaps
|
data/test/test_epubmaker_cmd.rb
CHANGED
data/test/test_helper.rb
CHANGED
@@ -16,7 +16,7 @@ def prepare_samplebook(srcdir)
|
|
16
16
|
# copy from review-jsbook
|
17
17
|
template_dir = File.expand_path('../templates/latex/review-jsbook/', File.dirname(__FILE__))
|
18
18
|
FileUtils.cp(Dir.glob(File.join(template_dir, '*')), File.join(srcdir, 'sty'))
|
19
|
-
YAML.
|
19
|
+
YAML.safe_load(File.open(File.join(srcdir, 'config.yml')), [Date])
|
20
20
|
end
|
21
21
|
|
22
22
|
def compile_inline(text)
|
data/test/test_htmlbuilder.rb
CHANGED
@@ -61,7 +61,7 @@ class HTMLBuidlerTest < Test::Unit::TestCase
|
|
61
61
|
Dir.mktmpdir do |dir|
|
62
62
|
Dir.chdir(dir) do
|
63
63
|
file = File.join(dir, 'locale.yml')
|
64
|
-
File.open(file, 'w') { |f| f.write
|
64
|
+
File.open(file, 'w') { |f| f.write "locale: ja\nappendix: 付録%pR" }
|
65
65
|
I18n.setup('ja')
|
66
66
|
@chapter.instance_eval do
|
67
67
|
def on_appendix?
|
@@ -82,7 +82,7 @@ class HTMLBuidlerTest < Test::Unit::TestCase
|
|
82
82
|
Dir.mktmpdir do |dir|
|
83
83
|
Dir.chdir(dir) do
|
84
84
|
file = File.join(dir, 'locale.yml')
|
85
|
-
File.open(file, 'w') { |f| f.write
|
85
|
+
File.open(file, 'w') { |f| f.write "locale: ja\nappendix: 付録%pA" }
|
86
86
|
I18n.setup('ja')
|
87
87
|
@chapter.instance_eval do
|
88
88
|
def on_appendix?
|
@@ -244,7 +244,7 @@ EOS
|
|
244
244
|
|
245
245
|
def test_inline_hd_chap
|
246
246
|
def @chapter.headline_index
|
247
|
-
items = [Book::
|
247
|
+
items = [Book::Index::Item.new('chap1|test', [1, 1], 'te_st')]
|
248
248
|
Book::HeadlineIndex.new(items, self)
|
249
249
|
end
|
250
250
|
|
@@ -261,7 +261,7 @@ EOS
|
|
261
261
|
Dir.mktmpdir do |dir|
|
262
262
|
Dir.chdir(dir) do
|
263
263
|
file = File.join(dir, 'locale.yml')
|
264
|
-
File.open(file, 'w') { |f| f.write
|
264
|
+
File.open(file, 'w') { |f| f.write "locale: ja\nappendix: 付録%pR" }
|
265
265
|
I18n.setup('ja')
|
266
266
|
@chapter.instance_eval do
|
267
267
|
def on_appendix?
|
@@ -270,7 +270,7 @@ EOS
|
|
270
270
|
end
|
271
271
|
|
272
272
|
def @chapter.headline_index
|
273
|
-
items = [Book::
|
273
|
+
items = [Book::Index::Item.new('test', [1], 'te_st')]
|
274
274
|
Book::HeadlineIndex.new(items, self)
|
275
275
|
end
|
276
276
|
|
@@ -284,7 +284,7 @@ EOS
|
|
284
284
|
Dir.mktmpdir do |dir|
|
285
285
|
Dir.chdir(dir) do
|
286
286
|
file = File.join(dir, 'locale.yml')
|
287
|
-
File.open(file, 'w') { |f| f.write
|
287
|
+
File.open(file, 'w') { |f| f.write "locale: ja\nappendix: 付録%pA" }
|
288
288
|
I18n.setup('ja')
|
289
289
|
@chapter.instance_eval do
|
290
290
|
def on_appendix?
|
@@ -293,7 +293,7 @@ EOS
|
|
293
293
|
end
|
294
294
|
|
295
295
|
def @chapter.headline_index
|
296
|
-
items = [Book::
|
296
|
+
items = [Book::Index::Item.new('test', [1], 'te_st')]
|
297
297
|
Book::HeadlineIndex.new(items, self)
|
298
298
|
end
|
299
299
|
|
@@ -343,36 +343,36 @@ EOS
|
|
343
343
|
|
344
344
|
def test_inline_img
|
345
345
|
def @chapter.image(_id)
|
346
|
-
item = Book::
|
346
|
+
item = Book::Index::Item.new('sampleimg', 1, 'sample photo')
|
347
347
|
item.instance_eval { @path = './images/chap1-sampleimg.png' }
|
348
348
|
item
|
349
349
|
end
|
350
350
|
|
351
|
-
actual = compile_block
|
351
|
+
actual = compile_block("@<img>{sampleimg}\n")
|
352
352
|
expected = %Q(<p><span class="imgref">図1.1</span></p>\n)
|
353
353
|
assert_equal expected, actual
|
354
354
|
end
|
355
355
|
|
356
356
|
def test_inline_imgref
|
357
357
|
def @chapter.image(_id)
|
358
|
-
item = Book::
|
358
|
+
item = Book::Index::Item.new('sampleimg', 1, 'sample photo')
|
359
359
|
item.instance_eval { @path = './images/chap1-sampleimg.png' }
|
360
360
|
item
|
361
361
|
end
|
362
362
|
|
363
|
-
actual = compile_block
|
363
|
+
actual = compile_block("@<imgref>{sampleimg}\n")
|
364
364
|
expected = %Q(<p><span class="imgref">図1.1</span>「sample photo」</p>\n)
|
365
365
|
assert_equal expected, actual
|
366
366
|
end
|
367
367
|
|
368
368
|
def test_inline_imgref2
|
369
369
|
def @chapter.image(_id)
|
370
|
-
item = Book::
|
370
|
+
item = Book::Index::Item.new('sampleimg', 1)
|
371
371
|
item.instance_eval { @path = './images/chap1-sampleimg.png' }
|
372
372
|
item
|
373
373
|
end
|
374
374
|
|
375
|
-
actual = compile_block
|
375
|
+
actual = compile_block("@<imgref>{sampleimg}\n")
|
376
376
|
expected = %Q(<p><span class="imgref">図1.1</span></p>\n)
|
377
377
|
assert_equal expected, actual
|
378
378
|
end
|
@@ -386,11 +386,11 @@ EOS
|
|
386
386
|
re1 = File.join(dir, 'sample1.re')
|
387
387
|
cat = File.join(dir, 'catalog.yml')
|
388
388
|
FileUtils.mkdir_p(File.join(dir, 'images'))
|
389
|
-
File.open(file1, 'w') { |f| f.write
|
390
|
-
File.open(filet1, 'w') { |f| f.write
|
391
|
-
File.open(file2, 'w') { |f| f.write
|
392
|
-
File.open(cat, 'w') { |f| f.write
|
393
|
-
File.open(re1, 'w') { |f| f.write
|
389
|
+
File.open(file1, 'w') { |f| f.write '' }
|
390
|
+
File.open(filet1, 'w') { |f| f.write '' }
|
391
|
+
File.open(file2, 'w') { |f| f.write '' }
|
392
|
+
File.open(cat, 'w') { |f| f.write "CHAPS:\n - sample1.re\n" }
|
393
|
+
File.open(re1, 'w') { |f| f.write <<EOF }
|
394
394
|
= test
|
395
395
|
|
396
396
|
tbl1 is @<table>{tbl1}.
|
@@ -441,6 +441,14 @@ EOS
|
|
441
441
|
expected = <<-EOS
|
442
442
|
<blockquote><p>foobar</p>
|
443
443
|
<p>buz</p></blockquote>
|
444
|
+
EOS
|
445
|
+
assert_equal expected, actual
|
446
|
+
|
447
|
+
@book.config['join_lines_by_lang'] = true
|
448
|
+
actual = compile_block("//quote{\nfoo\nbar\n\nbuz\n//}\n")
|
449
|
+
expected = <<-EOS
|
450
|
+
<blockquote><p>foo bar</p>
|
451
|
+
<p>buz</p></blockquote>
|
444
452
|
EOS
|
445
453
|
assert_equal expected, actual
|
446
454
|
end
|
@@ -471,6 +479,14 @@ EOS
|
|
471
479
|
expected = <<-EOS
|
472
480
|
<p class="noindent">foobar</p>
|
473
481
|
<p>foo2bar2</p>
|
482
|
+
EOS
|
483
|
+
assert_equal expected, actual
|
484
|
+
|
485
|
+
@book.config['join_lines_by_lang'] = true
|
486
|
+
actual = compile_block("//noindent\nfoo\nbar\n\nfoo2\nbar2\n")
|
487
|
+
expected = <<-EOS
|
488
|
+
<p class="noindent">foo bar</p>
|
489
|
+
<p>foo2 bar2</p>
|
474
490
|
EOS
|
475
491
|
assert_equal expected, actual
|
476
492
|
end
|
@@ -480,6 +496,14 @@ EOS
|
|
480
496
|
expected = <<-EOS
|
481
497
|
<p class="flushright">foobar</p>
|
482
498
|
<p class="flushright">buz</p>
|
499
|
+
EOS
|
500
|
+
assert_equal expected, actual
|
501
|
+
|
502
|
+
@book.config['join_lines_by_lang'] = true
|
503
|
+
actual = compile_block("//flushright{\nfoo\nbar\n\nbuz\n//}\n")
|
504
|
+
expected = <<-EOS
|
505
|
+
<p class="flushright">foo bar</p>
|
506
|
+
<p class="flushright">buz</p>
|
483
507
|
EOS
|
484
508
|
assert_equal expected, actual
|
485
509
|
end
|
@@ -489,13 +513,21 @@ EOS
|
|
489
513
|
expected = <<-EOS
|
490
514
|
<p class="center">foobar</p>
|
491
515
|
<p class="center">buz</p>
|
516
|
+
EOS
|
517
|
+
assert_equal expected, actual
|
518
|
+
|
519
|
+
@book.config['join_lines_by_lang'] = true
|
520
|
+
actual = compile_block("//centering{\nfoo\nbar\n\nbuz\n//}\n")
|
521
|
+
expected = <<-EOS
|
522
|
+
<p class="center">foo bar</p>
|
523
|
+
<p class="center">buz</p>
|
492
524
|
EOS
|
493
525
|
assert_equal expected, actual
|
494
526
|
end
|
495
527
|
|
496
528
|
def test_image
|
497
529
|
def @chapter.image(_id)
|
498
|
-
item = Book::
|
530
|
+
item = Book::Index::Item.new('sampleimg', 1)
|
499
531
|
item.instance_eval { @path = './images/chap1-sampleimg.png' }
|
500
532
|
item
|
501
533
|
end
|
@@ -514,7 +546,7 @@ EOS
|
|
514
546
|
|
515
547
|
def test_image_with_metric
|
516
548
|
def @chapter.image(_id)
|
517
|
-
item = Book::
|
549
|
+
item = Book::Index::Item.new('sampleimg', 1)
|
518
550
|
item.instance_eval { @path = './images/chap1-sampleimg.png' }
|
519
551
|
item
|
520
552
|
end
|
@@ -533,7 +565,7 @@ EOS
|
|
533
565
|
|
534
566
|
def test_image_with_metric2
|
535
567
|
def @chapter.image(_id)
|
536
|
-
item = Book::
|
568
|
+
item = Book::Index::Item.new('sampleimg', 1)
|
537
569
|
item.instance_eval { @path = './images/chap1-sampleimg.png' }
|
538
570
|
item
|
539
571
|
end
|
@@ -552,7 +584,7 @@ EOS
|
|
552
584
|
|
553
585
|
def test_image_with_tricky_id
|
554
586
|
def @chapter.image(_id)
|
555
|
-
item = Book::
|
587
|
+
item = Book::Index::Item.new('123 あ_;', 1)
|
556
588
|
item.instance_eval { @path = './images/chap1-123 あ_;.png' }
|
557
589
|
item
|
558
590
|
end
|
@@ -571,7 +603,7 @@ EOS
|
|
571
603
|
|
572
604
|
def test_indepimage
|
573
605
|
def @chapter.image(_id)
|
574
|
-
item = Book::
|
606
|
+
item = Book::Index::Item.new('sampleimg', 1)
|
575
607
|
item.instance_eval { @path = './images/chap1-sampleimg.png' }
|
576
608
|
item
|
577
609
|
end
|
@@ -590,7 +622,7 @@ EOS
|
|
590
622
|
|
591
623
|
def test_indepimage_without_caption
|
592
624
|
def @chapter.image(_id)
|
593
|
-
item = Book::
|
625
|
+
item = Book::Index::Item.new('sampleimg', 1)
|
594
626
|
item.instance_eval { @path = './images/chap1-sampleimg.png' }
|
595
627
|
item
|
596
628
|
end
|
@@ -606,7 +638,7 @@ EOS
|
|
606
638
|
|
607
639
|
def test_indepimage_with_metric
|
608
640
|
def @chapter.image(_id)
|
609
|
-
item = Book::
|
641
|
+
item = Book::Index::Item.new('sampleimg', 1)
|
610
642
|
item.instance_eval { @path = './images/chap1-sampleimg.png' }
|
611
643
|
item
|
612
644
|
end
|
@@ -625,7 +657,7 @@ EOS
|
|
625
657
|
|
626
658
|
def test_indepimage_with_metric2
|
627
659
|
def @chapter.image(_id)
|
628
|
-
item = Book::
|
660
|
+
item = Book::Index::Item.new('sampleimg', 1)
|
629
661
|
item.instance_eval { @path = './images/chap1-sampleimg.png' }
|
630
662
|
item
|
631
663
|
end
|
@@ -644,7 +676,7 @@ EOS
|
|
644
676
|
|
645
677
|
def test_indepimage_without_caption_but_with_metric
|
646
678
|
def @chapter.image(_id)
|
647
|
-
item = Book::
|
679
|
+
item = Book::Index::Item.new('sampleimg', 1)
|
648
680
|
item.instance_eval { @path = './images/chap1-sampleimg.png' }
|
649
681
|
item
|
650
682
|
end
|
@@ -659,29 +691,49 @@ EOS
|
|
659
691
|
end
|
660
692
|
|
661
693
|
def test_dlist
|
662
|
-
actual = compile_block(": foo\n foo.\n bar.\n")
|
694
|
+
actual = compile_block(" : foo\n foo.\n bar.\n")
|
663
695
|
expected = <<-EOS
|
664
696
|
<dl>
|
665
697
|
<dt>foo</dt>
|
666
698
|
<dd>foo.bar.</dd>
|
667
699
|
</dl>
|
700
|
+
EOS
|
701
|
+
assert_equal expected, actual
|
702
|
+
|
703
|
+
@book.config['join_lines_by_lang'] = true
|
704
|
+
actual = compile_block(" : foo\n foo.\n bar.\n")
|
705
|
+
expected = <<-EOS
|
706
|
+
<dl>
|
707
|
+
<dt>foo</dt>
|
708
|
+
<dd>foo. bar.</dd>
|
709
|
+
</dl>
|
668
710
|
EOS
|
669
711
|
assert_equal expected, actual
|
670
712
|
end
|
671
713
|
|
672
714
|
def test_dlist_with_bracket
|
673
|
-
actual = compile_block(": foo[bar]\n foo.\n bar.\n")
|
715
|
+
actual = compile_block(" : foo[bar]\n foo.\n bar.\n")
|
674
716
|
expected = <<-EOS
|
675
717
|
<dl>
|
676
718
|
<dt>foo[bar]</dt>
|
677
719
|
<dd>foo.bar.</dd>
|
678
720
|
</dl>
|
721
|
+
EOS
|
722
|
+
assert_equal expected, actual
|
723
|
+
|
724
|
+
@book.config['join_lines_by_lang'] = true
|
725
|
+
actual = compile_block(" : foo[bar]\n foo.\n bar.\n")
|
726
|
+
expected = <<-EOS
|
727
|
+
<dl>
|
728
|
+
<dt>foo[bar]</dt>
|
729
|
+
<dd>foo. bar.</dd>
|
730
|
+
</dl>
|
679
731
|
EOS
|
680
732
|
assert_equal expected, actual
|
681
733
|
end
|
682
734
|
|
683
735
|
def test_dlist_with_comment
|
684
|
-
source = ": title\n body\n\#@ comment\n\#@ comment\n: title2\n body2\n"
|
736
|
+
source = " : title\n body\n\#@ comment\n\#@ comment\n : title2\n body2\n"
|
685
737
|
actual = compile_block(source)
|
686
738
|
expected = <<-EOS
|
687
739
|
<dl>
|
@@ -722,7 +774,7 @@ EOS
|
|
722
774
|
|
723
775
|
def test_list
|
724
776
|
def @chapter.list(_id)
|
725
|
-
Book::
|
777
|
+
Book::Index::Item.new('samplelist', 1)
|
726
778
|
end
|
727
779
|
actual = compile_block("//list[samplelist][this is @<b>{test}<&>_]{\ntest1\ntest1.5\n\ntest@<i>{2}\n//}\n")
|
728
780
|
expected = <<-EOS
|
@@ -740,7 +792,7 @@ EOS
|
|
740
792
|
|
741
793
|
def test_inline_list
|
742
794
|
def @chapter.list(_id)
|
743
|
-
Book::
|
795
|
+
Book::Index::Item.new('samplelist', 1)
|
744
796
|
end
|
745
797
|
actual = compile_block("@<list>{sampletest}\n")
|
746
798
|
assert_equal %Q(<p><span class="listref">リスト1.1</span></p>\n), actual
|
@@ -764,7 +816,7 @@ EOS
|
|
764
816
|
|
765
817
|
def test_list_pygments
|
766
818
|
def @chapter.list(_id)
|
767
|
-
Book::
|
819
|
+
Book::Index::Item.new('samplelist', 1)
|
768
820
|
end
|
769
821
|
begin
|
770
822
|
require 'pygments'
|
@@ -791,7 +843,7 @@ test<i>2</i>
|
|
791
843
|
|
792
844
|
def test_list_pygments_lang
|
793
845
|
def @chapter.list(_id)
|
794
|
-
Book::
|
846
|
+
Book::Index::Item.new('samplelist', 1)
|
795
847
|
end
|
796
848
|
begin
|
797
849
|
require 'pygments'
|
@@ -819,7 +871,7 @@ EOS
|
|
819
871
|
|
820
872
|
def test_list_pygments_nulllang
|
821
873
|
def @chapter.list(_id)
|
822
|
-
Book::
|
874
|
+
Book::Index::Item.new('samplelist', 1)
|
823
875
|
end
|
824
876
|
begin
|
825
877
|
require 'pygments'
|
@@ -852,7 +904,7 @@ end
|
|
852
904
|
return true
|
853
905
|
end
|
854
906
|
def @chapter.list(_id)
|
855
|
-
Book::
|
907
|
+
Book::Index::Item.new('samplelist', 1)
|
856
908
|
end
|
857
909
|
@book.config['highlight'] = {}
|
858
910
|
@book.config['highlight']['html'] = 'rouge'
|
@@ -879,7 +931,7 @@ EOS
|
|
879
931
|
return true
|
880
932
|
end
|
881
933
|
def @chapter.list(_id)
|
882
|
-
Book::
|
934
|
+
Book::Index::Item.new('samplelist', 1)
|
883
935
|
end
|
884
936
|
@book.config['highlight'] = {}
|
885
937
|
@book.config['highlight']['html'] = 'rouge'
|
@@ -907,7 +959,7 @@ EOS
|
|
907
959
|
return true
|
908
960
|
end
|
909
961
|
def @chapter.list(_id)
|
910
|
-
Book::
|
962
|
+
Book::Index::Item.new('samplelist', 1)
|
911
963
|
end
|
912
964
|
@book.config['highlight'] = {}
|
913
965
|
@book.config['highlight']['html'] = 'rouge'
|
@@ -929,7 +981,7 @@ EOS
|
|
929
981
|
|
930
982
|
def test_listnum
|
931
983
|
def @chapter.list(_id)
|
932
|
-
Book::
|
984
|
+
Book::Index::Item.new('samplelist', 1)
|
933
985
|
end
|
934
986
|
|
935
987
|
@book.config['highlight'] = false
|
@@ -958,7 +1010,7 @@ EOS
|
|
958
1010
|
|
959
1011
|
def test_listnum_linenum
|
960
1012
|
def @chapter.list(_id)
|
961
|
-
Book::
|
1013
|
+
Book::Index::Item.new('samplelist', 1)
|
962
1014
|
end
|
963
1015
|
|
964
1016
|
@book.config['highlight'] = false
|
@@ -988,7 +1040,7 @@ EOS
|
|
988
1040
|
|
989
1041
|
def test_listnum_pygments_lang
|
990
1042
|
def @chapter.list(_id)
|
991
|
-
Book::
|
1043
|
+
Book::Index::Item.new('samplelist', 1)
|
992
1044
|
end
|
993
1045
|
begin
|
994
1046
|
require 'pygments'
|
@@ -1015,7 +1067,7 @@ EOS
|
|
1015
1067
|
|
1016
1068
|
def test_listnum_pygments_lang_linenum
|
1017
1069
|
def @chapter.list(_id)
|
1018
|
-
Book::
|
1070
|
+
Book::Index::Item.new('samplelist', 1)
|
1019
1071
|
end
|
1020
1072
|
begin
|
1021
1073
|
require 'pygments'
|
@@ -1043,7 +1095,7 @@ EOS
|
|
1043
1095
|
|
1044
1096
|
def test_listnum_pygments_lang_without_lang
|
1045
1097
|
def @chapter.list(_id)
|
1046
|
-
Book::
|
1098
|
+
Book::Index::Item.new('samplelist', 1)
|
1047
1099
|
end
|
1048
1100
|
begin
|
1049
1101
|
require 'pygments'
|
@@ -1077,7 +1129,7 @@ EOS
|
|
1077
1129
|
return true
|
1078
1130
|
end
|
1079
1131
|
def @chapter.list(_id)
|
1080
|
-
Book::
|
1132
|
+
Book::Index::Item.new('samplelist', 1)
|
1081
1133
|
end
|
1082
1134
|
@book.config['highlight'] = {}
|
1083
1135
|
@book.config['highlight']['html'] = 'rouge'
|
@@ -1111,7 +1163,7 @@ EOS
|
|
1111
1163
|
return true
|
1112
1164
|
end
|
1113
1165
|
def @chapter.list(_id)
|
1114
|
-
Book::
|
1166
|
+
Book::Index::Item.new('samplelist', 1)
|
1115
1167
|
end
|
1116
1168
|
@book.config['highlight'] = {}
|
1117
1169
|
@book.config['highlight']['html'] = 'rouge'
|
@@ -1402,7 +1454,7 @@ EOS
|
|
1402
1454
|
|
1403
1455
|
def test_bib
|
1404
1456
|
def @chapter.bibpaper(_id)
|
1405
|
-
Book::
|
1457
|
+
Book::Index::Item.new('samplebib', 1, 'sample bib')
|
1406
1458
|
end
|
1407
1459
|
|
1408
1460
|
assert_equal %Q(<a href="bib.html#bib-samplebib">[1]</a>), compile_inline('@<bib>{samplebib}')
|
@@ -1410,7 +1462,7 @@ EOS
|
|
1410
1462
|
|
1411
1463
|
def test_bib_noramlized
|
1412
1464
|
def @chapter.bibpaper(_id)
|
1413
|
-
Book::
|
1465
|
+
Book::Index::Item.new('sampleb=ib', 1, 'sample bib')
|
1414
1466
|
end
|
1415
1467
|
|
1416
1468
|
assert_equal %Q(<a href="bib.html#bib-id_sample_3Dbib">[1]</a>), compile_inline('@<bib>{sample=bib}')
|
@@ -1418,7 +1470,7 @@ EOS
|
|
1418
1470
|
|
1419
1471
|
def test_bib_htmlext
|
1420
1472
|
def @chapter.bibpaper(_id)
|
1421
|
-
Book::
|
1473
|
+
Book::Index::Item.new('samplebib', 1, 'sample bib')
|
1422
1474
|
end
|
1423
1475
|
|
1424
1476
|
@config['htmlext'] = 'xhtml'
|
@@ -1427,7 +1479,7 @@ EOS
|
|
1427
1479
|
|
1428
1480
|
def test_bibpaper
|
1429
1481
|
def @chapter.bibpaper(_id)
|
1430
|
-
Book::
|
1482
|
+
Book::Index::Item.new('samplebib', 1, 'sample bib')
|
1431
1483
|
end
|
1432
1484
|
|
1433
1485
|
actual = compile_block("//bibpaper[samplebib][sample bib @<b>{bold}]{\na\nb\n//}\n")
|
@@ -1435,13 +1487,22 @@ EOS
|
|
1435
1487
|
<div class="bibpaper">
|
1436
1488
|
<a id="bib-samplebib">[1]</a> sample bib <b>bold</b>
|
1437
1489
|
<p>ab</p></div>
|
1490
|
+
EOS
|
1491
|
+
assert_equal expected, actual
|
1492
|
+
|
1493
|
+
@book.config['join_lines_by_lang'] = true
|
1494
|
+
actual = compile_block("//bibpaper[samplebib][sample bib @<b>{bold}]{\na\nb\n//}\n")
|
1495
|
+
expected = <<-EOS
|
1496
|
+
<div class="bibpaper">
|
1497
|
+
<a id="bib-samplebib">[1]</a> sample bib <b>bold</b>
|
1498
|
+
<p>a b</p></div>
|
1438
1499
|
EOS
|
1439
1500
|
assert_equal expected, actual
|
1440
1501
|
end
|
1441
1502
|
|
1442
1503
|
def test_bibpaper_normalized
|
1443
1504
|
def @chapter.bibpaper(_id)
|
1444
|
-
Book::
|
1505
|
+
Book::Index::Item.new('sample=bib', 1, 'sample bib')
|
1445
1506
|
end
|
1446
1507
|
|
1447
1508
|
actual = compile_block("//bibpaper[sample=bib][sample bib @<b>{bold}]{\na\nb\n//}\n")
|
@@ -1449,13 +1510,22 @@ EOS
|
|
1449
1510
|
<div class="bibpaper">
|
1450
1511
|
<a id="bib-id_sample_3Dbib">[1]</a> sample bib <b>bold</b>
|
1451
1512
|
<p>ab</p></div>
|
1513
|
+
EOS
|
1514
|
+
assert_equal expected, actual
|
1515
|
+
|
1516
|
+
@book.config['join_lines_by_lang'] = true
|
1517
|
+
actual = compile_block("//bibpaper[sample=bib][sample bib @<b>{bold}]{\na\nb\n//}\n")
|
1518
|
+
expected = <<-EOS
|
1519
|
+
<div class="bibpaper">
|
1520
|
+
<a id="bib-id_sample_3Dbib">[1]</a> sample bib <b>bold</b>
|
1521
|
+
<p>a b</p></div>
|
1452
1522
|
EOS
|
1453
1523
|
assert_equal expected, actual
|
1454
1524
|
end
|
1455
1525
|
|
1456
1526
|
def test_bibpaper_with_anchor
|
1457
1527
|
def @chapter.bibpaper(_id)
|
1458
|
-
Book::
|
1528
|
+
Book::Index::Item.new('samplebib', 1, 'sample bib')
|
1459
1529
|
end
|
1460
1530
|
|
1461
1531
|
actual = compile_block("//bibpaper[samplebib][sample bib @<href>{http://example.jp}]{\na\nb\n//}\n")
|
@@ -1463,6 +1533,15 @@ EOS
|
|
1463
1533
|
<div class="bibpaper">
|
1464
1534
|
<a id="bib-samplebib">[1]</a> sample bib <a href="http://example.jp" class="link">http://example.jp</a>
|
1465
1535
|
<p>ab</p></div>
|
1536
|
+
EOS
|
1537
|
+
assert_equal expected, actual
|
1538
|
+
|
1539
|
+
@book.config['join_lines_by_lang'] = true
|
1540
|
+
actual = compile_block("//bibpaper[samplebib][sample bib @<href>{http://example.jp}]{\na\nb\n//}\n")
|
1541
|
+
expected = <<-EOS
|
1542
|
+
<div class="bibpaper">
|
1543
|
+
<a id="bib-samplebib">[1]</a> sample bib <a href="http://example.jp" class="link">http://example.jp</a>
|
1544
|
+
<p>a b</p></div>
|
1466
1545
|
EOS
|
1467
1546
|
assert_equal expected, actual
|
1468
1547
|
end
|
@@ -1558,7 +1637,7 @@ EOS
|
|
1558
1637
|
|
1559
1638
|
def test_column_in_aother_chapter_ref
|
1560
1639
|
def @chapter.column_index
|
1561
|
-
items = [Book::
|
1640
|
+
items = [Book::Index::Item.new('chap1|column', 1, 'column_cap')]
|
1562
1641
|
Book::ColumnIndex.new(items)
|
1563
1642
|
end
|
1564
1643
|
|
@@ -1594,6 +1673,16 @@ EOS
|
|
1594
1673
|
<li>AAA-AA</li>
|
1595
1674
|
<li>BBB-BB</li>
|
1596
1675
|
</ul>
|
1676
|
+
EOS
|
1677
|
+
actual = compile_block(src)
|
1678
|
+
assert_equal expected, actual
|
1679
|
+
|
1680
|
+
@book.config['join_lines_by_lang'] = true
|
1681
|
+
expected = <<-EOS
|
1682
|
+
<ul>
|
1683
|
+
<li>AAA -AA</li>
|
1684
|
+
<li>BBB -BB</li>
|
1685
|
+
</ul>
|
1597
1686
|
EOS
|
1598
1687
|
actual = compile_block(src)
|
1599
1688
|
assert_equal expected, actual
|
@@ -1977,7 +2066,7 @@ EOS
|
|
1977
2066
|
|
1978
2067
|
def test_inline_table
|
1979
2068
|
def @chapter.table(_id)
|
1980
|
-
Book::
|
2069
|
+
Book::Index::Item.new('sampletable', 1)
|
1981
2070
|
end
|
1982
2071
|
actual = compile_block("@<table>{sampletest}\n")
|
1983
2072
|
assert_equal %Q(<p><span class="tableref">表1.1</span></p>\n), actual
|
@@ -2005,7 +2094,7 @@ EOS
|
|
2005
2094
|
|
2006
2095
|
def test_imgtable
|
2007
2096
|
def @chapter.image(_id)
|
2008
|
-
item = Book::
|
2097
|
+
item = Book::Index::Item.new('sampleimg', 1, 'sample img')
|
2009
2098
|
item.instance_eval { @path = './images/chap1-sampleimg.png' }
|
2010
2099
|
item
|
2011
2100
|
end
|
@@ -2168,7 +2257,7 @@ EOB
|
|
2168
2257
|
@builder.instance_eval{ @logger = ReVIEW::Logger.new(io) }
|
2169
2258
|
actual = compile_block('@<w>{F} @<w>{B} @<wb>{B} @<w>{N}')
|
2170
2259
|
assert_equal %Q(<p>foo bar"\\<>_@<b>{BAZ} <b>bar"\\<>_@<b>{BAZ}</b> [missing word: N]</p>\n), actual
|
2171
|
-
assert_match(/WARN
|
2260
|
+
assert_match(/WARN --: :1: word not bound: N/, io.string)
|
2172
2261
|
end
|
2173
2262
|
end
|
2174
2263
|
|