review 5.2.0 → 5.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby-win.yml +1 -1
  3. data/.rubocop.yml +3 -0
  4. data/NEWS.ja.md +53 -0
  5. data/NEWS.md +53 -0
  6. data/doc/format.ja.md +29 -3
  7. data/doc/format.md +32 -3
  8. data/lib/review/book/book_unit.rb +12 -2
  9. data/lib/review/book/index.rb +4 -1
  10. data/lib/review/builder.rb +51 -16
  11. data/lib/review/catalog.rb +1 -0
  12. data/lib/review/compiler.rb +4 -1
  13. data/lib/review/epubmaker/epubcommon.rb +4 -4
  14. data/lib/review/epubmaker.rb +3 -1
  15. data/lib/review/htmlbuilder.rb +24 -0
  16. data/lib/review/i18n.yml +6 -0
  17. data/lib/review/idgxmlbuilder.rb +21 -1
  18. data/lib/review/img_math.rb +1 -0
  19. data/lib/review/index_builder.rb +84 -18
  20. data/lib/review/latexbuilder.rb +16 -1
  21. data/lib/review/markdownbuilder.rb +10 -2
  22. data/lib/review/pdfmaker.rb +18 -3
  23. data/lib/review/plaintextbuilder.rb +3 -2
  24. data/lib/review/rstbuilder.rb +11 -2
  25. data/lib/review/textutils.rb +8 -7
  26. data/lib/review/tocprinter.rb +11 -6
  27. data/lib/review/topbuilder.rb +19 -1
  28. data/lib/review/version.rb +1 -1
  29. data/lib/review/volumeprinter.rb +9 -9
  30. data/samples/syntax-book/ch02.re +9 -0
  31. data/templates/latex/config.erb +3 -0
  32. data/templates/latex/review-jlreq/review-base.sty +2 -1
  33. data/templates/latex/review-jlreq/review-jlreq.cls +36 -3
  34. data/templates/latex/review-jsbook/review-base.sty +7 -1
  35. data/templates/latex/review-jsbook/review-jsbook.cls +31 -4
  36. data/test/assets/syntax_book_index_detail.txt +10 -8
  37. data/test/assets/test_template.tex +4 -1
  38. data/test/assets/test_template_backmatter.tex +4 -1
  39. data/test/test_book_chapter.rb +25 -2
  40. data/test/test_builder.rb +5 -3
  41. data/test/test_htmlbuilder.rb +42 -3
  42. data/test/test_idgxmlbuilder.rb +3 -3
  43. data/test/test_index.rb +30 -4
  44. data/test/test_latexbuilder.rb +17 -3
  45. data/test/test_markdownbuilder.rb +13 -0
  46. data/test/test_pdfmaker.rb +19 -0
  47. data/test/test_plaintextbuilder.rb +20 -4
  48. data/test/test_rstbuilder.rb +13 -0
  49. data/test/test_topbuilder.rb +18 -0
  50. metadata +2 -2
@@ -762,6 +762,18 @@ EOS
762
762
  assert_equal %Q(\\sin\n1^{2}\n\n), actual
763
763
  end
764
764
 
765
+ def test_endnote
766
+ e = assert_raises(ReVIEW::ApplicationError) { compile_block("//endnote[foo][bar]\n\n@<endnote>{foo}\n") }
767
+ assert_equal ':4: //endnote is found but //printendnotes is not found.', e.message
768
+
769
+ actual = compile_block("@<endnote>{foo}\n//endnote[foo][bar]\n//printendnotes\n")
770
+ expected = <<-'EOS'
771
+ (1)
772
+ (1) bar
773
+ EOS
774
+ assert_equal expected, actual
775
+ end
776
+
765
777
  def test_inline_unknown
766
778
  assert_raises(ReVIEW::ApplicationError) { compile_block("@<img>{n}\n") }
767
779
  assert_match(/unknown image: n/, @log_io.string)
@@ -770,6 +782,10 @@ EOS
770
782
  assert_raises(ReVIEW::ApplicationError) { compile_block("@<fn>{n}\n") }
771
783
  assert_match(/unknown footnote: n/, @log_io.string)
772
784
 
785
+ @log_io.string = ''
786
+ assert_raises(ReVIEW::ApplicationError) { compile_block("@<endnote>{n}\n") }
787
+ assert_match(/unknown endnote: n/, @log_io.string)
788
+
773
789
  @log_io.string = ''
774
790
  assert_raises(ReVIEW::ApplicationError) { compile_block("@<hd>{n}\n") }
775
791
  assert_match(/unknown headline: n/, @log_io.string)
@@ -899,7 +915,7 @@ EOS
899
915
  //endchild
900
916
  EOS
901
917
  e = assert_raises(ReVIEW::ApplicationError) { compile_block(src) }
902
- assert_equal "//endchild is shown, but any opened //beginchild doesn't exist", e.message
918
+ assert_equal ":1: //endchild is shown, but any opened //beginchild doesn't exist", e.message
903
919
  end
904
920
 
905
921
  def test_nest_error_close1
@@ -907,7 +923,7 @@ EOS
907
923
  //beginchild
908
924
  EOS
909
925
  e = assert_raises(ReVIEW::ApplicationError) { compile_block(src) }
910
- assert_equal "//beginchild is shown, but previous element isn't ul, ol, or dl", e.message
926
+ assert_equal ":1: //beginchild is shown, but previous element isn't ul, ol, or dl", e.message
911
927
  end
912
928
 
913
929
  def test_nest_error_close2
@@ -925,7 +941,7 @@ EOS
925
941
  //beginchild
926
942
  EOS
927
943
  e = assert_raises(ReVIEW::ApplicationError) { compile_block(src) }
928
- assert_equal '//beginchild of dl,ol,ul misses //endchild', e.message
944
+ assert_equal ':12: //beginchild of dl,ol,ul misses //endchild', e.message
929
945
  end
930
946
 
931
947
  def test_nest_error_close3
@@ -945,7 +961,7 @@ EOS
945
961
  //endchild
946
962
  EOS
947
963
  e = assert_raises(ReVIEW::ApplicationError) { compile_block(src) }
948
- assert_equal '//beginchild of ol,ul misses //endchild', e.message
964
+ assert_equal ':14: //beginchild of ol,ul misses //endchild', e.message
949
965
  end
950
966
 
951
967
  def test_nest_ul
@@ -513,6 +513,19 @@ EOS
513
513
 
514
514
  \\sin 1^{2}
515
515
 
516
+ EOS
517
+ assert_equal expected, actual
518
+ end
519
+
520
+ def test_endnote
521
+ e = assert_raises(ReVIEW::ApplicationError) { compile_block("//endnote[foo][bar]\n\n@<endnote>{foo}\n") }
522
+ assert_equal ':4: //endnote is found but //printendnotes is not found.', e.message
523
+
524
+ actual = compile_block("@<endnote>{foo}\n//endnote[foo][bar]\n//printendnotes\n")
525
+ expected = <<-'EOS'
526
+ [(1)]_
527
+
528
+ .. [(1)] bar
516
529
  EOS
517
530
  assert_equal expected, actual
518
531
  end
@@ -999,6 +999,20 @@ EOB
999
999
  end
1000
1000
  end
1001
1001
 
1002
+ def test_endnote
1003
+ e = assert_raises(ReVIEW::ApplicationError) { compile_block("//endnote[foo][bar]\n\n@<endnote>{foo}\n") }
1004
+ assert_equal ':4: //endnote is found but //printendnotes is not found.', e.message
1005
+
1006
+ actual = compile_block("@<endnote>{foo}\n//endnote[foo][bar]\n//printendnotes\n")
1007
+ expected = <<-'EOS'
1008
+ 【後注1】
1009
+ ◆→開始:後注←◆
1010
+ 【後注1】bar
1011
+ ◆→終了:後注←◆
1012
+ EOS
1013
+ assert_equal expected, actual
1014
+ end
1015
+
1002
1016
  def test_inline_unknown
1003
1017
  assert_raises(ReVIEW::ApplicationError) { compile_block("@<img>{n}\n") }
1004
1018
  assert_match(/unknown image: n/, @log_io.string)
@@ -1007,6 +1021,10 @@ EOB
1007
1021
  assert_raises(ReVIEW::ApplicationError) { compile_block("@<fn>{n}\n") }
1008
1022
  assert_match(/unknown footnote: n/, @log_io.string)
1009
1023
 
1024
+ @log_io.string = ''
1025
+ assert_raises(ReVIEW::ApplicationError) { compile_block("@<endnote>{n}\n") }
1026
+ assert_match(/unknown endnote: n/, @log_io.string)
1027
+
1010
1028
  @log_io.string = ''
1011
1029
  assert_raises(ReVIEW::ApplicationError) { compile_block("@<hd>{n}\n") }
1012
1030
  assert_match(/unknown headline: n/, @log_io.string)
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.2.0
4
+ version: 5.3.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-06-29 00:00:00.000000000 Z
12
+ date: 2021-10-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: image_size