review 5.1.1 → 5.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (114) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby-tex.yml +6 -2
  3. data/.github/workflows/ruby-win.yml +6 -2
  4. data/.github/workflows/ruby.yml +6 -2
  5. data/.rubocop.yml +5 -319
  6. data/NEWS.ja.md +149 -0
  7. data/NEWS.md +149 -1
  8. data/README.md +9 -8
  9. data/bin/review +1 -1
  10. data/bin/review-catalog-converter +15 -15
  11. data/bin/review-check +7 -7
  12. data/bin/review-compile +14 -23
  13. data/bin/review-index +1 -1
  14. data/bin/review-preproc +29 -35
  15. data/bin/review-validate +2 -2
  16. data/doc/config.yml.sample +9 -1
  17. data/doc/config.yml.sample-simple +1 -1
  18. data/doc/format.ja.md +29 -3
  19. data/doc/format.md +32 -3
  20. data/doc/writing_vertical.ja.md +6 -0
  21. data/lib/review/book/base.rb +3 -3
  22. data/lib/review/book/book_unit.rb +13 -3
  23. data/lib/review/book/chapter.rb +1 -1
  24. data/lib/review/book/index.rb +7 -4
  25. data/lib/review/book/part.rb +12 -13
  26. data/lib/review/book/volume.rb +1 -1
  27. data/lib/review/builder.rb +92 -65
  28. data/lib/review/catalog.rb +6 -5
  29. data/lib/review/compiler.rb +76 -57
  30. data/lib/review/configure.rb +5 -2
  31. data/lib/review/epub2html.rb +12 -12
  32. data/lib/review/epubmaker/content.rb +1 -1
  33. data/lib/review/epubmaker/epubcommon.rb +47 -45
  34. data/lib/review/epubmaker/epubv2.rb +2 -1
  35. data/lib/review/epubmaker/epubv3.rb +5 -4
  36. data/lib/review/epubmaker/producer.rb +6 -7
  37. data/lib/review/epubmaker/reviewheaderlistener.rb +1 -1
  38. data/lib/review/epubmaker.rb +56 -67
  39. data/lib/review/exception.rb +7 -0
  40. data/lib/review/extentions/string.rb +1 -1
  41. data/lib/review/htmlbuilder.rb +90 -34
  42. data/lib/review/htmlutils.rb +17 -17
  43. data/lib/review/i18n.rb +3 -3
  44. data/lib/review/i18n.yml +6 -0
  45. data/lib/review/idgxmlbuilder.rb +61 -39
  46. data/lib/review/idgxmlmaker.rb +27 -26
  47. data/lib/review/img_math.rb +12 -18
  48. data/lib/review/index_builder.rb +94 -53
  49. data/lib/review/init.rb +4 -4
  50. data/lib/review/latexbuilder.rb +84 -76
  51. data/lib/review/lineinput.rb +3 -3
  52. data/lib/review/location.rb +1 -1
  53. data/lib/review/loggable.rb +27 -0
  54. data/lib/review/logger.rb +69 -21
  55. data/lib/review/makerhelper.rb +8 -4
  56. data/lib/review/markdownbuilder.rb +21 -12
  57. data/lib/review/pdfmaker.rb +63 -42
  58. data/lib/review/plaintextbuilder.rb +16 -15
  59. data/lib/review/preprocessor/directive.rb +35 -0
  60. data/lib/review/preprocessor/line.rb +34 -0
  61. data/lib/review/preprocessor/repository.rb +177 -0
  62. data/lib/review/preprocessor.rb +94 -296
  63. data/lib/review/rstbuilder.rb +12 -3
  64. data/lib/review/template.rb +5 -1
  65. data/lib/review/textmaker.rb +32 -31
  66. data/lib/review/textutils.rb +5 -6
  67. data/lib/review/tocprinter.rb +12 -7
  68. data/lib/review/topbuilder.rb +96 -19
  69. data/lib/review/update.rb +16 -8
  70. data/lib/review/version.rb +1 -1
  71. data/lib/review/volumeprinter.rb +9 -9
  72. data/lib/review/webmaker.rb +45 -46
  73. data/lib/review/webtocprinter.rb +10 -10
  74. data/lib/review/yamlloader.rb +35 -2
  75. data/review.gemspec +2 -1
  76. data/samples/sample-book/src/config.yml +0 -1
  77. data/samples/sample-book/src/lib/tasks/review.rake +3 -1
  78. data/samples/sample-book/src/lib/tasks/z01_copy_sty.rake +2 -1
  79. data/samples/syntax-book/ch02.re +9 -0
  80. data/samples/syntax-book/lib/tasks/z01_copy_sty.rake +2 -1
  81. data/templates/html/_titlepage.html.erb +9 -17
  82. data/templates/latex/config.erb +3 -0
  83. data/templates/latex/review-jlreq/review-base.sty +4 -5
  84. data/templates/latex/review-jlreq/review-jlreq.cls +39 -5
  85. data/templates/latex/review-jsbook/review-base.sty +9 -3
  86. data/templates/latex/review-jsbook/review-jsbook.cls +32 -5
  87. data/templates/opf/opf_manifest_epubv2.opf.erb +1 -1
  88. data/templates/opf/opf_manifest_epubv3.opf.erb +1 -1
  89. data/test/assets/syntax_book_index_detail.txt +10 -8
  90. data/test/assets/test_template.tex +4 -1
  91. data/test/assets/test_template_backmatter.tex +4 -1
  92. data/test/book_test_helper.rb +10 -10
  93. data/test/test_book_chapter.rb +25 -2
  94. data/test/test_builder.rb +10 -8
  95. data/test/test_epub3maker.rb +3 -3
  96. data/test/test_epubmaker.rb +27 -37
  97. data/test/test_epubmaker_cmd.rb +14 -3
  98. data/test/test_htmlbuilder.rb +111 -31
  99. data/test/test_idgxmlbuilder.rb +41 -33
  100. data/test/test_idgxmlmaker_cmd.rb +1 -1
  101. data/test/test_img_math.rb +11 -2
  102. data/test/test_index.rb +30 -4
  103. data/test/test_latexbuilder.rb +46 -25
  104. data/test/test_latexbuilder_v2.rb +18 -10
  105. data/test/test_markdownbuilder.rb +13 -0
  106. data/test/test_pdfmaker.rb +19 -0
  107. data/test/test_pdfmaker_cmd.rb +10 -10
  108. data/test/test_plaintextbuilder.rb +46 -22
  109. data/test/test_preprocessor.rb +188 -1
  110. data/test/test_rstbuilder.rb +13 -0
  111. data/test/test_textmaker_cmd.rb +1 -1
  112. data/test/test_topbuilder.rb +195 -29
  113. data/test/test_yamlloader.rb +28 -42
  114. metadata +11 -6
@@ -14,6 +14,8 @@ class TOPBuidlerTest < Test::Unit::TestCase
14
14
  @config['language'] = 'ja'
15
15
  @book = Book::Base.new
16
16
  @book.config = @config
17
+ @log_io = StringIO.new
18
+ ReVIEW.logger = ReVIEW::Logger.new(@log_io)
17
19
  @compiler = ReVIEW::Compiler.new(@builder)
18
20
  @chapter = Book::Chapter.new(@book, 1, '-', nil, StringIO.new)
19
21
  location = Location.new(nil, nil)
@@ -149,7 +151,8 @@ class TOPBuidlerTest < Test::Unit::TestCase
149
151
  actual = compile_block("//table{\n★1☆\t▲2☆\n------------\n★3☆\t▲4☆<>&\n//}\n")
150
152
  expected = <<-EOS
151
153
  ◆→開始:表←◆
152
- ★★1☆☆\t★▲2☆☆
154
+ 1☆\t2
155
+ ------------
153
156
  ★3☆\t▲4☆<>&
154
157
  ◆→終了:表←◆
155
158
 
@@ -504,7 +507,8 @@ EOS
504
507
  actual = compile_block("//table{\naaa\tbbb\n------------\nccc\tddd<>&\n//}\n")
505
508
  expected = <<-EOS
506
509
  ◆→開始:表←◆
507
- aaa☆\t★bbb☆
510
+ aaa\tbbb
511
+ ------------
508
512
  ccc\tddd<>&
509
513
  ◆→終了:表←◆
510
514
 
@@ -516,7 +520,8 @@ EOS
516
520
  ◆→開始:表←◆
517
521
  表1.1 FOO
518
522
 
519
- aaa☆\t★bbb☆
523
+ aaa\tbbb
524
+ ------------
520
525
  ccc\tddd<>&
521
526
  ◆→終了:表←◆
522
527
 
@@ -527,22 +532,46 @@ EOS
527
532
  actual = compile_block("//table[foo][FOO]{\naaa\tbbb\n------------\nccc\tddd<>&\n//}\n")
528
533
  expected = <<-EOS
529
534
  ◆→開始:表←◆
530
- aaa☆\t★bbb☆
535
+ aaa\tbbb
536
+ ------------
531
537
  ccc\tddd<>&
532
538
 
533
539
  表1.1 FOO
534
540
  ◆→終了:表←◆
535
541
 
542
+ EOS
543
+ assert_equal expected, actual
544
+ end
545
+
546
+ def test_table_th_bold
547
+ @config['textmaker']['th_bold'] = true
548
+ actual = compile_block("//table{\naaa\tbbb\n------------\nccc\tddd<>&\n//}\n")
549
+ expected = <<-EOS
550
+ ◆→開始:表←◆
551
+ ★aaa☆\t★bbb☆
552
+ ccc\tddd<>&
553
+ ◆→終了:表←◆
554
+
555
+ EOS
556
+ assert_equal expected, actual
557
+
558
+ actual = compile_block("//table{\naaa\tbbb\nccc\tddd<>&\n//}\n")
559
+ expected = <<-EOS
560
+ ◆→開始:表←◆
561
+ ★aaa☆\tbbb
562
+ ★ccc☆\tddd<>&
563
+ ◆→終了:表←◆
564
+
536
565
  EOS
537
566
  assert_equal expected, actual
538
567
  end
539
568
 
540
569
  def test_empty_table
541
570
  e = assert_raises(ReVIEW::ApplicationError) { compile_block("//table{\n//}\n") }
542
- assert_equal ':2: error: no rows in the table', e.message
571
+ assert_equal 'no rows in the table', e.message
543
572
 
544
573
  e = assert_raises(ReVIEW::ApplicationError) { compile_block("//table{\n------------\n//}\n") }
545
- assert_equal ':3: error: no rows in the table', e.message
574
+ assert_equal 'no rows in the table', e.message
546
575
  end
547
576
 
548
577
  def test_inline_table
@@ -559,6 +588,28 @@ EOS
559
588
  ◆→開始:表←◆
560
589
  foo
561
590
 
591
+ aaa\tbbb
592
+ ------------
593
+ ccc\tddd<>&
594
+ ◆→終了:表←◆
595
+
596
+ ◆→開始:表←◆
597
+ aaa\tbbb
598
+ ------------
599
+ ccc\tddd<>&
600
+ ◆→終了:表←◆
601
+
602
+ EOS
603
+ assert_equal expected, actual
604
+ end
605
+
606
+ def test_emtable_thbold
607
+ @config['textmaker']['th_bold'] = true
608
+ actual = compile_block("//emtable[foo]{\naaa\tbbb\n------------\nccc\tddd<>&\n//}\n//emtable{\naaa\tbbb\n------------\nccc\tddd<>&\n//}\n")
609
+ expected = <<-EOS
610
+ ◆→開始:表←◆
611
+ foo
612
+
562
613
  ★aaa☆\t★bbb☆
563
614
  ccc\tddd<>&
564
615
  ◆→終了:表←◆
@@ -568,6 +619,37 @@ ccc\tddd<>&
568
619
  ccc\tddd<>&
569
620
  ◆→終了:表←◆
570
621
 
622
+ EOS
623
+ assert_equal expected, actual
624
+ end
625
+
626
+ def test_imgtable
627
+ def @chapter.image(_id)
628
+ item = Book::Index::Item.new('sampleimg', 1)
629
+ item.instance_eval { @path = './images/chap1-sampleimg.png' }
630
+ item
631
+ end
632
+
633
+ actual = compile_block("//imgtable[sampleimg][sample photo]{\nfoo\n//}\n")
634
+ expected = <<-EOS
635
+ ◆→開始:表←◆
636
+ 表1.1 sample photo
637
+
638
+ ◆→./images/chap1-sampleimg.png←◆
639
+ ◆→終了:表←◆
640
+
641
+ EOS
642
+ assert_equal expected, actual
643
+
644
+ @config['caption_position']['table'] = 'bottom'
645
+ actual = compile_block("//imgtable[sampleimg][sample photo]{\nfoo\n//}\n")
646
+ expected = <<-EOS
647
+ ◆→開始:表←◆
648
+ ◆→./images/chap1-sampleimg.png←◆
649
+
650
+ 表1.1 sample photo
651
+ ◆→終了:表←◆
652
+
571
653
  EOS
572
654
  assert_equal expected, actual
573
655
  end
@@ -576,7 +658,8 @@ EOS
576
658
  src = "//table{\n1\t2\t\t3 4| 5\n------------\na b\tc d |e\n//}\n"
577
659
  expected = <<-EOS
578
660
  ◆→開始:表←◆
579
- 1 2 3 4| 5
661
+ 1 2 3 4| 5
662
+ ------------
580
663
  a b c d |e
581
664
  ◆→終了:表←◆
582
665
 
@@ -588,7 +671,8 @@ EOS
588
671
  actual = compile_block(src)
589
672
  expected = <<-EOS
590
673
  ◆→開始:表←◆
591
- 1 2☆ ★☆ ★3 4| 5
674
+ 1 2 3 4| 5
675
+ ------------
592
676
  a b c d |e
593
677
  ◆→終了:表←◆
594
678
 
@@ -599,7 +683,8 @@ EOS
599
683
  actual = compile_block(src)
600
684
  expected = <<-EOS
601
685
  ◆→開始:表←◆
602
- 1 2 3 4|☆ 5
686
+ 1 2 3 4| 5
687
+ ------------
603
688
  a b c d |e
604
689
  ◆→終了:表←◆
605
690
 
@@ -610,7 +695,8 @@ EOS
610
695
  actual = compile_block(src)
611
696
  expected = <<-EOS
612
697
  ◆→開始:表←◆
613
- 1 2 3 4 5
698
+ 1 2 3 4 5
699
+ ------------
614
700
  a b c d e
615
701
  ◆→終了:表←◆
616
702
 
@@ -879,8 +965,8 @@ EOS
879
965
 
880
966
  //}
881
967
  EOS
882
- e = assert_raises(ReVIEW::ApplicationError) { compile_block(src) }
883
- assert_match(/minicolumn cannot be nested:/, e.message)
968
+ assert_raises(ReVIEW::ApplicationError) { compile_block(src) }
969
+ assert_match(/minicolumn cannot be nested:/, @log_io.string)
884
970
  end
885
971
  end
886
972
 
@@ -896,8 +982,8 @@ EOS
896
982
 
897
983
  //}
898
984
  EOS
899
- e = assert_raises(ReVIEW::ApplicationError) { compile_block(src) }
900
- assert_match(/minicolumn cannot be nested:/, e.message)
985
+ assert_raises(ReVIEW::ApplicationError) { compile_block(src) }
986
+ assert_match(/minicolumn cannot be nested:/, @log_io.string)
901
987
  end
902
988
  end
903
989
 
@@ -912,8 +998,8 @@ EOS
912
998
 
913
999
  //}
914
1000
  EOS
915
- e = assert_raises(ReVIEW::ApplicationError) { compile_block(src) }
916
- assert_match(/minicolumn cannot be nested:/, e.message)
1001
+ assert_raises(ReVIEW::ApplicationError) { compile_block(src) }
1002
+ assert_match(/minicolumn cannot be nested:/, @log_io.string)
917
1003
  end
918
1004
  end
919
1005
 
@@ -963,6 +1049,63 @@ EOS
963
1049
  図1.1 sample photo
964
1050
  ◆→終了:図←◆
965
1051
 
1052
+ EOS
1053
+ assert_equal expected, actual
1054
+ end
1055
+
1056
+ def test_image_dummy
1057
+ actual = compile_block("//image[dummy][sample photo]{\nDUMMY\n//}\n")
1058
+ expected = <<-EOS
1059
+ ◆→開始:図←◆
1060
+ DUMMY
1061
+
1062
+ 図1.1 sample photo
1063
+ ◆→終了:図←◆
1064
+
1065
+ EOS
1066
+ assert_equal expected, actual
1067
+ end
1068
+
1069
+ def test_indepimage
1070
+ def @chapter.image(_id)
1071
+ item = Book::Index::Item.new('sampleimg', 1)
1072
+ item.instance_eval { @path = './images/chap1-sampleimg.png' }
1073
+ item
1074
+ end
1075
+
1076
+ actual = compile_block("//indepimage[sampleimg][sample photo]{\nfoo\n//}\n")
1077
+ expected = <<-EOS
1078
+ ◆→開始:図←◆
1079
+ ◆→./images/chap1-sampleimg.png←◆
1080
+
1081
+ 図 sample photo
1082
+ ◆→終了:図←◆
1083
+
1084
+ EOS
1085
+ assert_equal expected, actual
1086
+
1087
+ @config['caption_position']['image'] = 'top'
1088
+ actual = compile_block("//indepimage[sampleimg][sample photo]{\nfoo\n//}\n")
1089
+ expected = <<-EOS
1090
+ ◆→開始:図←◆
1091
+ 図 sample photo
1092
+
1093
+ ◆→./images/chap1-sampleimg.png←◆
1094
+ ◆→終了:図←◆
1095
+
1096
+ EOS
1097
+ assert_equal expected, actual
1098
+ end
1099
+
1100
+ def test_indepimage_dummy
1101
+ actual = compile_block("//indepimage[dummy][sample photo]{\nDUMMY\n//}\n")
1102
+ expected = <<-EOS
1103
+ ◆→開始:図←◆
1104
+ DUMMY
1105
+
1106
+ 図 sample photo
1107
+ ◆→終了:図←◆
1108
+
966
1109
  EOS
967
1110
  assert_equal expected, actual
968
1111
  end
@@ -981,12 +1124,11 @@ EOS
981
1124
 
982
1125
  def test_inline_w
983
1126
  Dir.mktmpdir do |dir|
984
- File.open(File.join(dir, 'words.csv'), 'w') do |f|
985
- f.write <<EOB
1127
+ File.write(File.join(dir, 'words.csv'), <<EOB
986
1128
  "F","foo"
987
1129
  "B","bar""\\<>_@<b>{BAZ}"
988
1130
  EOB
989
- end
1131
+ )
990
1132
  @book.config['words_file'] = File.join(dir, 'words.csv')
991
1133
 
992
1134
  io = StringIO.new
@@ -997,20 +1139,44 @@ EOB
997
1139
  end
998
1140
  end
999
1141
 
1142
+ def test_endnote
1143
+ e = assert_raises(ReVIEW::ApplicationError) { compile_block("//endnote[foo][bar]\n\n@<endnote>{foo}\n") }
1144
+ assert_equal ':4: //endnote is found but //printendnotes is not found.', e.message
1145
+
1146
+ actual = compile_block("@<endnote>{foo}\n//endnote[foo][bar]\n//printendnotes\n")
1147
+ expected = <<-'EOS'
1148
+ 【後注1】
1149
+ ◆→開始:後注←◆
1150
+ 【後注1】bar
1151
+ ◆→終了:後注←◆
1152
+ EOS
1153
+ assert_equal expected, actual
1154
+ end
1155
+
1000
1156
  def test_inline_unknown
1001
- e = assert_raises(ReVIEW::ApplicationError) { compile_block("@<img>{n}\n") }
1002
- assert_equal ':1: error: unknown image: n', e.message
1003
- e = assert_raises(ReVIEW::ApplicationError) { compile_block("@<fn>{n}\n") }
1004
- assert_equal ':1: error: unknown footnote: n', e.message
1005
- e = assert_raises(ReVIEW::ApplicationError) { compile_block("@<hd>{n}\n") }
1006
- assert_equal ':1: error: unknown headline: n', e.message
1157
+ assert_raises(ReVIEW::ApplicationError) { compile_block("@<img>{n}\n") }
1158
+ assert_match(/unknown image: n/, @log_io.string)
1159
+
1160
+ @log_io.string = ''
1161
+ assert_raises(ReVIEW::ApplicationError) { compile_block("@<fn>{n}\n") }
1162
+ assert_match(/unknown footnote: n/, @log_io.string)
1163
+
1164
+ @log_io.string = ''
1165
+ assert_raises(ReVIEW::ApplicationError) { compile_block("@<endnote>{n}\n") }
1166
+ assert_match(/unknown endnote: n/, @log_io.string)
1167
+
1168
+ @log_io.string = ''
1169
+ assert_raises(ReVIEW::ApplicationError) { compile_block("@<hd>{n}\n") }
1170
+ assert_match(/unknown headline: n/, @log_io.string)
1007
1171
  %w[list table column].each do |name|
1008
- e = assert_raises(ReVIEW::ApplicationError) { compile_block("@<#{name}>{n}\n") }
1009
- assert_equal ":1: error: unknown #{name}: n", e.message
1172
+ @log_io.string = ''
1173
+ assert_raises(ReVIEW::ApplicationError) { compile_block("@<#{name}>{n}\n") }
1174
+ assert_match(/unknown #{name}: n/, @log_io.string)
1010
1175
  end
1011
1176
  %w[chap chapref title].each do |name|
1012
- e = assert_raises(ReVIEW::ApplicationError) { compile_block("@<#{name}>{n}\n") }
1013
- assert_equal ':1: error: key not found: "n"', e.message
1177
+ @log_io.string = ''
1178
+ assert_raises(ReVIEW::ApplicationError) { compile_block("@<#{name}>{n}\n") }
1179
+ assert_match(/key not found: "n"/, @log_io.string)
1014
1180
  end
1015
1181
  end
1016
1182
 
@@ -14,12 +14,11 @@ class YAMLLoaderTest < Test::Unit::TestCase
14
14
  def test_load_file
15
15
  Dir.mktmpdir do |dir|
16
16
  yaml_file = File.join(dir, 'test.yml')
17
- File.open(yaml_file, 'w') do |f|
18
- f.write <<EOB
17
+ File.write(yaml_file, <<EOB
19
18
  foo:
20
19
  bar: "test"
21
20
  EOB
22
- end
21
+ )
23
22
  yaml = @loader.load_file(yaml_file)
24
23
  assert_equal yaml, 'foo' => { 'bar' => 'test' }
25
24
  end
@@ -29,24 +28,22 @@ EOB
29
28
  Dir.mktmpdir do |dir|
30
29
  yaml_file = File.join(dir, 'test.yml')
31
30
  yaml_file2 = File.join(dir, 'test2.yml')
32
- File.open(yaml_file, 'w') do |f|
33
- f.write <<EOB
31
+ File.write(yaml_file, <<EOB
34
32
  k0: 2
35
33
  k1:
36
34
  name: "test"
37
35
  array: [{name: "N", val: "V"}]
38
36
  inherit: ["test2.yml"]
39
37
  EOB
40
- end
41
- File.open(yaml_file2, 'w') do |f|
42
- f.write <<EOB
38
+ )
39
+ File.write(yaml_file2, <<EOB
43
40
  k1:
44
41
  name: "test2"
45
42
  name2: "value2"
46
43
  array: [{name: "shoudoverridden_name", val: "shouldoverridden_val"}]
47
44
  k2: "3"
48
45
  EOB
49
- end
46
+ )
50
47
  yaml = @loader.load_file(yaml_file)
51
48
  assert_equal({ 'k0' => 2,
52
49
  'k1' => { 'name' => 'test', 'name2' => 'value2',
@@ -61,31 +58,28 @@ EOB
61
58
  yaml_file = File.join(dir, 'test.yml')
62
59
  yaml_file2 = File.join(dir, 'test2.yml')
63
60
  yaml_file3 = File.join(dir, 'test3.yml')
64
- File.open(yaml_file, 'w') do |f|
65
- f.write <<EOB
61
+ File.write(yaml_file, <<EOB
66
62
  k0: 2
67
63
  k1:
68
64
  name1: "value1-1"
69
65
  inherit: ["test3.yml", "test2.yml"]
70
66
  EOB
71
- end
72
- File.open(yaml_file2, 'w') do |f|
73
- f.write <<EOB
67
+ )
68
+ File.write(yaml_file2, <<EOB
74
69
  k1:
75
70
  name1: "value1-2"
76
71
  name2: "value2-2"
77
72
  k2: "B"
78
73
  EOB
79
- end
80
- File.open(yaml_file3, 'w') do |f|
81
- f.write <<EOB
74
+ )
75
+ File.write(yaml_file3, <<EOB
82
76
  k1:
83
77
  name1: "value1-3"
84
78
  name2: "value2-3"
85
79
  name3: "value3-3"
86
80
  k3: "C"
87
81
  EOB
88
- end
82
+ )
89
83
  yaml = @loader.load_file(yaml_file)
90
84
  assert_equal({
91
85
  'k0' => 2,
@@ -106,40 +100,35 @@ EOB
106
100
  yaml_file5 = File.join(dir, 'test5.yml')
107
101
  yaml_file6 = File.join(dir, 'test6.yml')
108
102
  yaml_file7 = File.join(dir, 'test7.yml')
109
- File.open(yaml_file7, 'w') do |f|
110
- f.write <<EOB
103
+ File.write(yaml_file7, <<EOB
111
104
  k1:
112
105
  name1: "N7"
113
106
  inherit: ["test3.yml", "test6.yml"]
114
107
  EOB
115
- end
116
- File.open(yaml_file6, 'w') do |f|
117
- f.write <<EOB
108
+ )
109
+ File.write(yaml_file6, <<EOB
118
110
  k1:
119
111
  name1: "N6"
120
112
  name2: "N6"
121
113
  inherit: ["test4.yml", "test5.yml"]
122
114
  EOB
123
- end
124
- File.open(yaml_file5, 'w') do |f|
125
- f.write <<EOB
115
+ )
116
+ File.write(yaml_file5, <<EOB
126
117
  k1:
127
118
  name1: "N5"
128
119
  name2: "N5"
129
120
  name3: "N5"
130
121
  EOB
131
- end
132
- File.open(yaml_file4, 'w') do |f|
133
- f.write <<EOB
122
+ )
123
+ File.write(yaml_file4, <<EOB
134
124
  k1:
135
125
  name1: "N4"
136
126
  name2: "N4"
137
127
  name3: "N4"
138
128
  name4: "N4"
139
129
  EOB
140
- end
141
- File.open(yaml_file3, 'w') do |f|
142
- f.write <<EOB
130
+ )
131
+ File.write(yaml_file3, <<EOB
143
132
  k1:
144
133
  name1: "N3"
145
134
  name2: "N3"
@@ -148,9 +137,8 @@ k1:
148
137
  name5: "N3"
149
138
  inherit: ["test1.yml", "test2.yml"]
150
139
  EOB
151
- end
152
- File.open(yaml_file2, 'w') do |f|
153
- f.write <<EOB
140
+ )
141
+ File.write(yaml_file2, <<EOB
154
142
  k1:
155
143
  name1: "N2"
156
144
  name2: "N2"
@@ -159,9 +147,8 @@ k1:
159
147
  name5: "N2"
160
148
  name6: "N2"
161
149
  EOB
162
- end
163
- File.open(yaml_file1, 'w') do |f|
164
- f.write <<EOB
150
+ )
151
+ File.write(yaml_file1, <<EOB
165
152
  k1:
166
153
  name1: "N1"
167
154
  name2: "N1"
@@ -171,7 +158,7 @@ k1:
171
158
  name6: "N1"
172
159
  name7: "N1"
173
160
  EOB
174
- end
161
+ )
175
162
 
176
163
  yaml = @loader.load_file(yaml_file7)
177
164
  assert_equal({ 'k1' => { 'name1' => 'N7',
@@ -188,11 +175,10 @@ EOB
188
175
  def test_empty_file
189
176
  Dir.mktmpdir do |dir|
190
177
  yaml_file = File.join(dir, 'test.yml')
191
- File.open(yaml_file, 'w') do |f|
192
- f.write <<EOB
178
+ File.write(yaml_file, <<EOB
193
179
  #
194
180
  EOB
195
- end
181
+ )
196
182
  e = assert_raise(RuntimeError) { @loader.load_file(yaml_file) }
197
183
  assert_match('test.yml is malformed.', e.message)
198
184
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: review
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.1.1
4
+ version: 5.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - kmuto
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2021-03-04 00:00:00.000000000 Z
12
+ date: 2022-02-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: image_size
@@ -115,14 +115,14 @@ dependencies:
115
115
  requirements:
116
116
  - - "~>"
117
117
  - !ruby/object:Gem::Version
118
- version: 1.10.0
118
+ version: 1.12.0
119
119
  type: :development
120
120
  prerelease: false
121
121
  version_requirements: !ruby/object:Gem::Requirement
122
122
  requirements:
123
123
  - - "~>"
124
124
  - !ruby/object:Gem::Version
125
- version: 1.10.0
125
+ version: 1.12.0
126
126
  - !ruby/object:Gem::Dependency
127
127
  name: rubocop-performance
128
128
  requirement: !ruby/object:Gem::Requirement
@@ -337,6 +337,7 @@ files:
337
337
  - lib/review/latexutils.rb
338
338
  - lib/review/lineinput.rb
339
339
  - lib/review/location.rb
340
+ - lib/review/loggable.rb
340
341
  - lib/review/logger.rb
341
342
  - lib/review/makerhelper.rb
342
343
  - lib/review/markdownbuilder.rb
@@ -344,6 +345,9 @@ files:
344
345
  - lib/review/pdfmaker.rb
345
346
  - lib/review/plaintextbuilder.rb
346
347
  - lib/review/preprocessor.rb
348
+ - lib/review/preprocessor/directive.rb
349
+ - lib/review/preprocessor/line.rb
350
+ - lib/review/preprocessor/repository.rb
347
351
  - lib/review/rstbuilder.rb
348
352
  - lib/review/sec_counter.rb
349
353
  - lib/review/template.rb
@@ -620,7 +624,8 @@ files:
620
624
  homepage: http://github.com/kmuto/review
621
625
  licenses:
622
626
  - LGPL
623
- metadata: {}
627
+ metadata:
628
+ rubygems_mfa_required: 'true'
624
629
  post_install_message:
625
630
  rdoc_options: []
626
631
  require_paths:
@@ -636,7 +641,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
636
641
  - !ruby/object:Gem::Version
637
642
  version: '0'
638
643
  requirements: []
639
- rubygems_version: 3.0.3
644
+ rubygems_version: 3.1.6
640
645
  signing_key:
641
646
  specification_version: 4
642
647
  summary: 'Re:VIEW: a easy-to-use digital publishing system'