review 5.0.0 → 5.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (173) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby-tex.yml +35 -0
  3. data/.github/workflows/ruby-win.yml +8 -4
  4. data/.github/workflows/ruby.yml +6 -2
  5. data/.rubocop.yml +24 -9
  6. data/NEWS.ja.md +215 -0
  7. data/NEWS.md +215 -1
  8. data/README.md +7 -6
  9. data/Rakefile +7 -2
  10. data/bin/review +2 -4
  11. data/bin/review-catalog-converter +3 -3
  12. data/bin/review-check +6 -8
  13. data/bin/review-checkdep +1 -4
  14. data/bin/review-compile +10 -20
  15. data/bin/review-epub2html +1 -4
  16. data/bin/review-epubmaker +3 -4
  17. data/bin/review-idgxmlmaker +1 -3
  18. data/bin/review-index +11 -5
  19. data/bin/review-init +1 -4
  20. data/bin/review-pdfmaker +1 -3
  21. data/bin/review-preproc +30 -38
  22. data/bin/review-textmaker +1 -3
  23. data/bin/review-update +1 -4
  24. data/bin/review-validate +3 -3
  25. data/bin/review-vol +1 -4
  26. data/bin/review-webmaker +1 -3
  27. data/doc/config.yml.sample +23 -5
  28. data/doc/config.yml.sample-simple +1 -1
  29. data/doc/format.ja.md +49 -12
  30. data/doc/format.md +52 -12
  31. data/doc/quickstart.ja.md +11 -1
  32. data/doc/quickstart.md +11 -2
  33. data/doc/writing_vertical.ja.md +6 -0
  34. data/lib/review/book/base.rb +4 -0
  35. data/lib/review/book/book_unit.rb +15 -2
  36. data/lib/review/book/chapter.rb +3 -0
  37. data/lib/review/book/index.rb +5 -1
  38. data/lib/review/book/volume.rb +1 -0
  39. data/lib/review/builder.rb +90 -54
  40. data/lib/review/call_hook.rb +20 -0
  41. data/lib/review/catalog.rb +2 -0
  42. data/lib/review/compiler.rb +88 -52
  43. data/lib/review/configure.rb +64 -7
  44. data/lib/review/epubmaker/content.rb +113 -0
  45. data/lib/review/epubmaker/epubcommon.rb +372 -0
  46. data/lib/review/epubmaker/epubv2.rb +178 -0
  47. data/lib/review/epubmaker/epubv3.rb +231 -0
  48. data/lib/review/epubmaker/producer.rb +167 -0
  49. data/lib/review/epubmaker/reviewheaderlistener.rb +12 -2
  50. data/lib/review/epubmaker/zip_exporter.rb +84 -0
  51. data/lib/review/epubmaker.rb +114 -129
  52. data/lib/review/exception.rb +13 -0
  53. data/lib/review/htmlbuilder.rb +109 -67
  54. data/lib/review/htmlutils.rb +1 -1
  55. data/lib/review/i18n.rb +1 -0
  56. data/lib/review/i18n.yml +6 -0
  57. data/lib/review/idgxmlbuilder.rb +72 -48
  58. data/lib/review/idgxmlmaker.rb +15 -14
  59. data/lib/review/img_math.rb +239 -0
  60. data/lib/review/index_builder.rb +90 -32
  61. data/lib/review/init.rb +4 -4
  62. data/lib/review/latexbox.rb +58 -0
  63. data/lib/review/latexbuilder.rb +79 -58
  64. data/lib/review/latexutils.rb +9 -1
  65. data/lib/review/lineinput.rb +112 -2
  66. data/lib/review/loggable.rb +27 -0
  67. data/lib/review/logger.rb +89 -2
  68. data/lib/review/makerhelper.rb +7 -206
  69. data/lib/review/markdownbuilder.rb +44 -4
  70. data/lib/review/pdfmaker.rb +70 -51
  71. data/lib/review/plaintextbuilder.rb +20 -11
  72. data/lib/review/preprocessor/directive.rb +35 -0
  73. data/lib/review/preprocessor/line.rb +34 -0
  74. data/lib/review/preprocessor/repository.rb +177 -0
  75. data/lib/review/preprocessor.rb +105 -301
  76. data/lib/review/rstbuilder.rb +13 -4
  77. data/lib/review/sec_counter.rb +1 -0
  78. data/lib/review/template.rb +11 -1
  79. data/lib/review/textmaker.rb +23 -20
  80. data/lib/review/textutils.rb +10 -17
  81. data/lib/review/tocprinter.rb +93 -71
  82. data/lib/review/topbuilder.rb +44 -19
  83. data/lib/review/update.rb +5 -6
  84. data/lib/review/version.rb +1 -1
  85. data/lib/review/volumeprinter.rb +11 -12
  86. data/lib/review/webmaker.rb +31 -27
  87. data/lib/review/webtocprinter.rb +10 -9
  88. data/lib/review/yamlloader.rb +2 -1
  89. data/lib/review.rb +1 -1
  90. data/review.gemspec +5 -3
  91. data/samples/sample-book/src/config-epub2.yml +1 -1
  92. data/samples/sample-book/src/config.yml +1 -1
  93. data/samples/sample-book/src/lib/tasks/review.rake +19 -1
  94. data/samples/sample-book/src/lib/tasks/z01_copy_sty.rake +2 -1
  95. data/samples/syntax-book/ch01.re +1 -1
  96. data/samples/syntax-book/ch02.re +30 -6
  97. data/samples/syntax-book/ch03.re +1 -1
  98. data/samples/syntax-book/images/img3-2.png +0 -0
  99. data/samples/syntax-book/lib/tasks/z01_copy_sty.rake +2 -1
  100. data/templates/html/_colophon.html.erb +23 -0
  101. data/templates/html/_colophon_history.html.erb +9 -0
  102. data/templates/html/_cover.html.erb +10 -0
  103. data/templates/html/_part_body.html.erb +6 -0
  104. data/templates/html/_titlepage.html.erb +20 -0
  105. data/templates/html/layout-html5.html.erb +6 -0
  106. data/templates/html/layout-xhtml1.html.erb +6 -0
  107. data/templates/latex/config.erb +11 -0
  108. data/templates/latex/review-jlreq/review-base.sty +7 -9
  109. data/templates/latex/review-jlreq/review-jlreq.cls +48 -6
  110. data/templates/latex/review-jlreq/review-style.sty +6 -1
  111. data/templates/latex/review-jlreq/review-tcbox.sty +348 -0
  112. data/templates/latex/review-jlreq/reviewmacro.sty +5 -0
  113. data/templates/latex/review-jsbook/review-base.sty +13 -9
  114. data/templates/latex/review-jsbook/review-jsbook.cls +41 -6
  115. data/templates/latex/review-jsbook/review-style.sty +6 -1
  116. data/templates/latex/review-jsbook/review-tcbox.sty +348 -0
  117. data/templates/latex/review-jsbook/reviewmacro.sty +5 -0
  118. data/templates/opf/epubv2.opf.erb +7 -7
  119. data/templates/opf/epubv3.opf.erb +7 -7
  120. data/templates/opf/opf_manifest_epubv2.opf.erb +10 -0
  121. data/templates/opf/opf_manifest_epubv3.opf.erb +10 -0
  122. data/templates/opf/opf_metainfo_epubv2.opf.erb +17 -0
  123. data/templates/opf/opf_metainfo_epubv3.opf.erb +49 -0
  124. data/templates/opf/opf_tocx_epubv2.opf.erb +9 -0
  125. data/templates/opf/opf_tocx_epubv3.opf.erb +17 -0
  126. data/templates/web/html/layout-html5.html.erb +6 -5
  127. data/templates/web/html/layout-xhtml1.html.erb +6 -0
  128. data/test/assets/header_listener.html +35 -0
  129. data/test/assets/img_math/img1.png +0 -0
  130. data/test/assets/img_math/img2.png +0 -0
  131. data/test/assets/img_math/img3.png +0 -0
  132. data/test/assets/syntax_book_index_detail.txt +60 -0
  133. data/test/assets/test_template.tex +7 -1
  134. data/test/assets/test_template_backmatter.tex +7 -1
  135. data/test/run_test.rb +1 -1
  136. data/test/test_book_chapter.rb +27 -4
  137. data/test/test_builder.rb +10 -8
  138. data/test/test_catalog_converter_cmd.rb +1 -1
  139. data/test/test_epub3maker.rb +168 -124
  140. data/test/test_epubmaker.rb +248 -131
  141. data/test/test_epubmaker_cmd.rb +15 -4
  142. data/test/test_helper.rb +5 -4
  143. data/test/test_htmlbuilder.rb +170 -31
  144. data/test/test_idgxmlbuilder.rb +44 -23
  145. data/test/test_idgxmlmaker_cmd.rb +7 -3
  146. data/test/test_img_math.rb +111 -0
  147. data/test/test_index.rb +30 -4
  148. data/test/test_indexbuilder.rb +5 -5
  149. data/test/test_latexbuilder.rb +151 -26
  150. data/test/test_latexbuilder_v2.rb +18 -10
  151. data/test/test_lineinput.rb +20 -93
  152. data/test/test_markdownbuilder.rb +42 -0
  153. data/test/test_pdfmaker.rb +90 -0
  154. data/test/test_pdfmaker_cmd.rb +2 -2
  155. data/test/test_plaintextbuilder.rb +56 -40
  156. data/test/test_preprocessor.rb +188 -1
  157. data/test/test_reviewheaderlistener.rb +49 -0
  158. data/test/test_rstbuilder.rb +13 -0
  159. data/test/test_template.rb +12 -2
  160. data/test/test_textmaker_cmd.rb +5 -1
  161. data/test/test_tocprinter.rb +46 -0
  162. data/test/test_topbuilder.rb +50 -19
  163. data/test/test_update.rb +34 -34
  164. data/test/test_zip_exporter.rb +5 -6
  165. metadata +95 -17
  166. data/lib/epubmaker/content.rb +0 -111
  167. data/lib/epubmaker/epubcommon.rb +0 -449
  168. data/lib/epubmaker/epubv2.rb +0 -142
  169. data/lib/epubmaker/epubv3.rb +0 -235
  170. data/lib/epubmaker/producer.rb +0 -375
  171. data/lib/epubmaker/zip_exporter.rb +0 -81
  172. data/lib/epubmaker.rb +0 -23
  173. data/lib/lineinput.rb +0 -155
data/NEWS.md CHANGED
@@ -1,3 +1,218 @@
1
+ # Version 5.3.0
2
+ ## New Features
3
+ * add the future of endnote. `//endnote` specifies the content of the endnote, `@<endnote>` specifies the reference to the endnote, and `//printendnotes` places endnotes ([#1724])
4
+
5
+ ## Bug Fixes
6
+ * fixed an error in new jlreq that caused it to become independent of ifthen package ([#1718])
7
+ * fixed an issue with hidden folio being set to all 1 when using review-jsbook with TeXLive 2020 or later ([#1720])
8
+ * fixed an error that occurred when a non-existent file was specified in the coverimage parameter ([#1726], [#1729])
9
+ * it now warns when a non-existent file is specified in the titlefile, creditfile, and profile parameters ([#1730])
10
+ * fixed `@<tcy>` op error in review-jlreq. this op will be expanded into `\reviewtcy` macro ([#1733])
11
+ * fixed exception errors in review-vol and review-index ([#1740])
12
+ * fixed forgetting to copy `__IMGMATH_BODY__.tex` when math compiling error occurs ([#1747])
13
+ * fixed the problem that the position of `//beginchild` and `//endchild` is not displayed when an error occurs ([#1742])
14
+ * fixed a build error when using `//graph` op ([#1744])
15
+ * fixed undefined variable in epubmaker.rb ([#1755])
16
+ * fixed execution error in review-catalog-converter ([#1753])
17
+
18
+ ## Enhancements
19
+ * warnings are now given when footnotes (`//footnote`) and endnotes (`//endnote`) are defined but not referenced (`@<fn>`, `@<endnote>`) ([#1725])
20
+ * `\includefullpagegraphics` macro that pastes an image over the entire page now supports vertical writing ([#1734])
21
+ * try to find plantuml.jar from the working folder, `/usr/share/plantuml`, or `/usr/share/java` ([#1760])
22
+
23
+ ## Docs
24
+ * format.ja.md, format.md: fixed a mistake in the command line for creating SVG formulas ([#1748])
25
+
26
+ ## Others
27
+ * added tests for Ruby 2.7 for Windows ([#1743])
28
+ * refactor code with Rubocop 1.22.1 ([#1759])
29
+
30
+ ## Contributors
31
+ * [@munepi](https://github.com/munepi)
32
+ * [@huideyeren](https://github.com/huideyeren)
33
+
34
+ [#1718]: https://github.com/kmuto/review/issues/1718
35
+ [#1720]: https://github.com/kmuto/review/issues/1720
36
+ [#1724]: https://github.com/kmuto/review/issues/1724
37
+ [#1725]: https://github.com/kmuto/review/issues/1725
38
+ [#1726]: https://github.com/kmuto/review/issues/1726
39
+ [#1729]: https://github.com/kmuto/review/pull/1729
40
+ [#1730]: https://github.com/kmuto/review/pull/1730
41
+ [#1733]: https://github.com/kmuto/review/issues/1733
42
+ [#1734]: https://github.com/kmuto/review/issues/1734
43
+ [#1740]: https://github.com/kmuto/review/pull/1740
44
+ [#1742]: https://github.com/kmuto/review/pull/1742
45
+ [#1743]: https://github.com/kmuto/review/pull/1743
46
+ [#1744]: https://github.com/kmuto/review/issues/1744
47
+ [#1747]: https://github.com/kmuto/review/pull/1747
48
+ [#1748]: https://github.com/kmuto/review/pull/1748
49
+ [#1753]: https://github.com/kmuto/review/issues/1753
50
+ [#1755]: https://github.com/kmuto/review/issues/1755
51
+ [#1759]: https://github.com/kmuto/review/pull/1759
52
+ [#1760]: https://github.com/kmuto/review/pull/1760
53
+
54
+ # Version 5.2.0
55
+ ## New Features
56
+ * EPUBMaker: added `<section>` based on heading level for CSS formatting, when the `epubmaker/use_section` parameter is set to `true` ([#1685])
57
+
58
+ ## Bug Fixes
59
+ * PDFMaker: fixed a problem that caused a warning in templates for Ruby 2.6 and above ([#1683])
60
+ * EPUBMaker: fixed an issue that caused copied files to be empty in Docker environments ([#1686])
61
+ * added CSS style for correct displaying horizontal characters in vertical typesetting ([#1688])
62
+ * PDFMaker: fixed the pxjahyper option conflict error on latest TeXLive ([#1690])
63
+ * PDFMaker: fixed compile error when image is not found ([#1706])
64
+
65
+ ## Enhancements
66
+ * improve around warn and error handling ([#1674])
67
+ * PDFMaker: introduced `pdfmaker/use_symlink` parameter to speed up the process by using symbolic links instead of actual copies. This may not work on some operating systems such as Windows ([#1696])
68
+ * PDFMaker: don't insert empty page after frontmatter when using review-jlreq with `serial_pagination=true, openany` ([#1711])
69
+
70
+ ## Others
71
+ * fixed related to GitHub Actions ([#1684], [#1691])
72
+ * review-preproc: refactored ([#1697])
73
+ * refactored nested lists handling ([#1698])
74
+ * refactor code with Rubocop 1.12 ([#1689], [#1692], [#1699], [#1700])
75
+ * The `builder_init_file` method of each builder now executes `super` first to use base builder's `builder_init_file` ([#1702])
76
+ * PDFMaker: Stopped implicitly including FileUtils library ([#1704])
77
+
78
+ ## Contributors
79
+ * [@odaki](https://github.com/odaki)
80
+ * [@imamurayusuke](https://github.com/imamurayusuke)
81
+
82
+ [#1674]: https://github.com/kmuto/review/issues/1674
83
+ [#1683]: https://github.com/kmuto/review/pulls/1683
84
+ [#1684]: https://github.com/kmuto/review/pulls/1684
85
+ [#1685]: https://github.com/kmuto/review/pulls/1685
86
+ [#1686]: https://github.com/kmuto/review/issues/1686
87
+ [#1688]: https://github.com/kmuto/review/pulls/1688
88
+ [#1689]: https://github.com/kmuto/review/pulls/1689
89
+ [#1690]: https://github.com/kmuto/review/pulls/1690
90
+ [#1691]: https://github.com/kmuto/review/pulls/1691
91
+ [#1692]: https://github.com/kmuto/review/pulls/1692
92
+ [#1696]: https://github.com/kmuto/review/issues/1696
93
+ [#1697]: https://github.com/kmuto/review/pulls/1697
94
+ [#1698]: https://github.com/kmuto/review/pulls/1698
95
+ [#1699]: https://github.com/kmuto/review/pulls/1699
96
+ [#1700]: https://github.com/kmuto/review/pulls/1700
97
+ [#1702]: https://github.com/kmuto/review/pulls/1702
98
+ [#1704]: https://github.com/kmuto/review/pulls/1704
99
+ [#1706]: https://github.com/kmuto/review/issues/1706
100
+ [#1711]: https://github.com/kmuto/review/issues/1711
101
+
102
+ # Version 5.1.1
103
+ ## Bug Fixes
104
+ * Fix the runtime error of `review-preproc` ([#1679])
105
+
106
+ [#1679]: https://github.com/kmuto/review/issues/1679
107
+
108
+ # Version 5.1.0
109
+ ## New Features
110
+ * added Rake rule to call [Vivliostyle-CLI](https://github.com/vivliostyle/vivliostyle-cli), CSS typesetting formatter. Create a PDF with `rake vivliostyle:build` or `rake vivliostyle`, and open a preview with `rake vivliostyle:preview` ([#1663])
111
+ * PDFMaker: introduced `boxsetting` parameter to choose and customize the decorations for column, note, memo, tip, info, warning, important, caution and notice ([#1637])
112
+ * added inline op, `@<ins>` (indicates an insertion) and `@<del>` (indicates a deletion) ([#1630])
113
+ * EPUBMaker, WebMaker: MathJax is now supported. Added `math_format` parameter to choose the mathematical expression method ([#1587], [#1614])
114
+
115
+ ## Breaking Changes
116
+ * EPUBMaker: changed the default value of the `urnid` parameter from `urn:uid` to `urn:uuid` ([#1658])
117
+ * PDFMaker: footnotes are no longer broken up by a page ([#1607])
118
+
119
+ ## Bug Fixes
120
+ * fixed WebMaker, review-vol and review-index errors when `contentdir` is defined ([#1633])
121
+ * WebMaker: fixed `images/html` foder not being found ([#1623])
122
+ * PDFMaker: fixed chapterlink in term list ([#1619])
123
+ * PDFMaker: fixed errors when index contains `{`, `}`, or `|` ([#1611])
124
+ * review-vol: valid error messages will be displayed when invalid headings are found ([#1604])
125
+ * PDFMaker: `after_makeindex` hook to be executed after `mendex` execution, not after LaTeX compilation ([#1605])
126
+ * PDFMaker: if the caption of `//image` is empty, the figure number will be printed instead of an internal error ([#1666])
127
+ * fixed review-vol and review-index errors when a file is invalid ([#1671])
128
+ * EPUBMaker: fixed an error when static file is missing ([#1670])
129
+
130
+ ## Enhancements
131
+ * Maker commands now display with nice colors and icons for their progress status when tty-logger gem is installed ([#1660])
132
+ * PDFMaker: added `\RequirePackage{plautopatch}` definition to class files ([#1644])
133
+ * MARKDOWNBuilder: supported `@<hd>` ([#1629])
134
+ * Re:VIEW now reports an error when a document file contains invalid escape sequence characters ([#1596], [#1602])
135
+ * an error is raised when there are more than 6 `=` in a heading ([#1591])
136
+
137
+ ## Docs
138
+ * documented the name of the image folder referenced by Makers ([#1626])
139
+
140
+ ## Others
141
+ * EPUBMaker: moved EPUB library from `lib/epubmaker` to `lib/review/epubmaker` and refactored it ([#1575], [#1617], [#1635], [#1640], [#1641], [#1650], [#1653], [#1655])
142
+ * EPUBMaker: added tests ([#1656])
143
+ * PDFMaker: refactored some ([#1664])
144
+ * introduced `ReVIEW::ImgMath` class to handle mathematic images ([#1642], [#1649], [#1659], [#1662])
145
+ * IDGXMLMaker: refactored some ([#1654])
146
+ * MakerHelper: refactored some ([#1652])
147
+ * introduced `ReVIEW::Template.generate` class to handle the templates ([#1648])
148
+ * added a test of TeX compilation to GitHub Actions ([#1643])
149
+ * refactored codes according to Rubocop 1.10 ([#1593], [#1598], [#1613], [#1636], [#1647], [#1669])
150
+ * fixed duplicate IDs of syntax-book sample ([#1646])
151
+ * refactored the way to reference relative pathes ([#1639])
152
+ * refactored `ReVIEW::LineInput` class ([#1638])
153
+ * update Copyright to 2021 ([#1632])
154
+ * added Ruby 3.0 to the test platform ([#1622])
155
+ * suppressed tests for Pygments ([#1610], [#1618])
156
+ * WebTocPrinter: fixed an error of test ([#1606])
157
+ * improved to make it easier to specify the target of the test ([#1594])
158
+
159
+ [#1671]: https://github.com/kmuto/review/issues/1671
160
+ [#1670]: https://github.com/kmuto/review/pull/1670
161
+ [#1669]: https://github.com/kmuto/review/pull/1669
162
+ [#1666]: https://github.com/kmuto/review/issues/1666
163
+ [#1664]: https://github.com/kmuto/review/pull/1664
164
+ [#1663]: https://github.com/kmuto/review/pull/1663
165
+ [#1662]: https://github.com/kmuto/review/issues/1662
166
+ [#1660]: https://github.com/kmuto/review/issues/1660
167
+ [#1659]: https://github.com/kmuto/review/pull/1659
168
+ [#1658]: https://github.com/kmuto/review/pull/1658
169
+ [#1656]: https://github.com/kmuto/review/pull/1656
170
+ [#1655]: https://github.com/kmuto/review/pull/1655
171
+ [#1654]: https://github.com/kmuto/review/pull/1654
172
+ [#1653]: https://github.com/kmuto/review/pull/1653
173
+ [#1652]: https://github.com/kmuto/review/pull/1652
174
+ [#1650]: https://github.com/kmuto/review/pull/1650
175
+ [#1649]: https://github.com/kmuto/review/pull/1649
176
+ [#1648]: https://github.com/kmuto/review/pull/1648
177
+ [#1647]: https://github.com/kmuto/review/pull/1647
178
+ [#1646]: https://github.com/kmuto/review/pull/1646
179
+ [#1644]: https://github.com/kmuto/review/issues/1644
180
+ [#1643]: https://github.com/kmuto/review/pull/1643
181
+ [#1642]: https://github.com/kmuto/review/pull/1642
182
+ [#1641]: https://github.com/kmuto/review/pull/1641
183
+ [#1640]: https://github.com/kmuto/review/pull/1640
184
+ [#1639]: https://github.com/kmuto/review/pull/1639
185
+ [#1638]: https://github.com/kmuto/review/pull/1638
186
+ [#1637]: https://github.com/kmuto/review/pull/1637
187
+ [#1636]: https://github.com/kmuto/review/pull/1636
188
+ [#1635]: https://github.com/kmuto/review/pull/1635
189
+ [#1633]: https://github.com/kmuto/review/issues/1633
190
+ [#1632]: https://github.com/kmuto/review/issues/1632
191
+ [#1630]: https://github.com/kmuto/review/issues/1630
192
+ [#1629]: https://github.com/kmuto/review/pull/1629
193
+ [#1626]: https://github.com/kmuto/review/pull/1626
194
+ [#1623]: https://github.com/kmuto/review/issues/1623
195
+ [#1622]: https://github.com/kmuto/review/pull/1622
196
+ [#1619]: https://github.com/kmuto/review/issues/1619
197
+ [#1618]: https://github.com/kmuto/review/pull/1618
198
+ [#1617]: https://github.com/kmuto/review/pull/1617
199
+ [#1614]: https://github.com/kmuto/review/pull/1614
200
+ [#1613]: https://github.com/kmuto/review/pull/1613
201
+ [#1611]: https://github.com/kmuto/review/issues/1611
202
+ [#1610]: https://github.com/kmuto/review/pull/1610
203
+ [#1607]: https://github.com/kmuto/review/issues/1607
204
+ [#1606]: https://github.com/kmuto/review/issues/1606
205
+ [#1605]: https://github.com/kmuto/review/issues/1605
206
+ [#1604]: https://github.com/kmuto/review/issues/1604
207
+ [#1602]: https://github.com/kmuto/review/pull/1602
208
+ [#1598]: https://github.com/kmuto/review/pull/1598
209
+ [#1596]: https://github.com/kmuto/review/issues/1596
210
+ [#1594]: https://github.com/kmuto/review/pull/1594
211
+ [#1593]: https://github.com/kmuto/review/pull/1593
212
+ [#1591]: https://github.com/kmuto/review/issues/1591
213
+ [#1587]: https://github.com/kmuto/review/issues/1587
214
+ [#1575]: https://github.com/kmuto/review/issues/1575
215
+
1
216
  # Version 5.0.0
2
217
  ## New Features
3
218
  * added `cover_fit_page` option to review-jsbook / review-jlreq classes. When `cover_fit_page=true` is specified in the `texdocumentclass` parameter, the cover image is scaled to paper size. Note: it is recommended that the images should be created at actual size ([#1534])
@@ -1694,4 +1909,3 @@ To support language parameter for syntax highlighting, if you use review-ext.rb
1694
1909
  * add headline level 5 and 6 (paragraph, subparagraph)
1695
1910
  * escape all dash
1696
1911
  * add ``begin{alltt}..\end{alltt}`` into ``\reviewemlist``, ``\reviewlist`` and ``\reviewcmd``
1697
-
data/README.md CHANGED
@@ -62,11 +62,12 @@ $ echo "export PATH=PATH_OF_REVIEW/bin:$PATH" >> ~/.profile
62
62
  $ review-init hello
63
63
  $ cd hello
64
64
  $ (... add and edit *.re file, config.yml and catalog.yml ...)
65
- $ rake epub ## generating EPUB
66
- $ rake pdf ## generating PDF (Requirement TeXLive)
67
- $ rake text ## generating texts
68
- $ rake web ## generating Web pages
69
- $ rake idgxml ## generating InDesign XML files
65
+ $ rake epub ## generating EPUB
66
+ $ rake pdf ## generating PDF (Requirement TeXLive)
67
+ $ rake text ## generating texts
68
+ $ rake web ## generating Web pages
69
+ $ rake idgxml ## generating InDesign XML files
70
+ $ rake vivliostyle ## generating PDF using Vivliostyle-CLI (Requirement Vivliostyle-CLI)
70
71
  ```
71
72
 
72
73
  For further information, see [doc/quickstart.md](https://github.com/kmuto/review/blob/master/doc/quickstart.md)
@@ -115,4 +116,4 @@ Exception:
115
116
 
116
117
  ## Copyright
117
118
 
118
- Copyright (c) 2006-2020 Minero Aoki, Kenshi Muto, Masayoshi Takahashi, Masanori Kado.
119
+ Copyright (c) 2006-2021 Minero Aoki, Kenshi Muto, Masayoshi Takahashi, Masanori Kado.
data/Rakefile CHANGED
@@ -21,8 +21,13 @@ task :rubocop do
21
21
  end
22
22
  end
23
23
 
24
- task :test do
25
- ruby('test/run_test.rb')
24
+ desc 'Run tests'
25
+ task :test, :target do |_, argv|
26
+ if argv[:target].nil?
27
+ ruby('test/run_test.rb')
28
+ else
29
+ ruby('test/run_test.rb', "--pattern=#{argv[:target]}")
30
+ end
26
31
  end
27
32
 
28
33
  begin
data/bin/review CHANGED
@@ -13,9 +13,7 @@
13
13
  # the GNU LGPL, Lesser General Public License version 2.1.
14
14
  # For details of the GNU LGPL, see the file "COPYING".
15
15
 
16
- require 'pathname'
17
- bindir = Pathname.new(__FILE__).realpath.dirname
18
- $LOAD_PATH.unshift((bindir + '../lib').realpath)
16
+ $LOAD_PATH.unshift(File.realpath('../lib', __dir__))
19
17
 
20
18
  require 'review'
21
19
 
@@ -52,7 +50,7 @@ if ARGV[0] == 'version'
52
50
  end
53
51
 
54
52
  command = "review-#{ARGV.shift}"
55
- bindir = Pathname.new(__FILE__).realpath.dirname
53
+ bindir = File.realpath(__dir__)
56
54
  command_path = File.join(bindir, command)
57
55
 
58
56
  unless File.exist?(command_path)
@@ -9,10 +9,9 @@
9
9
  #
10
10
  # Convert old PREDEF/CHAPS/PART/POSTDEF files into catalog.yml.
11
11
 
12
- require 'pathname'
12
+ $LOAD_PATH.unshift(File.realpath('../lib', __dir__))
13
+
13
14
  require 'optparse'
14
- bindir = Pathname.new(__FILE__).realpath.dirname
15
- $LOAD_PATH.unshift((bindir + '../lib').realpath)
16
15
  require 'review/version'
17
16
  require 'review/extentions'
18
17
  require 'review/logger'
@@ -158,6 +157,7 @@ def replace_old_style_part(dir)
158
157
  end
159
158
 
160
159
  next unless allow_overwrite
160
+
161
161
  File.write("#{dir}/#{part_name}", "= #{part}")
162
162
  catalog.replace_part(part, part_name)
163
163
  end
data/bin/review-check CHANGED
@@ -9,10 +9,7 @@
9
9
  # For details of the GNU LGPL, see the file "COPYING".
10
10
  #
11
11
 
12
- require 'pathname'
13
-
14
- bindir = Pathname.new(__FILE__).realpath.dirname
15
- $LOAD_PATH.unshift((bindir + '../lib').realpath)
12
+ $LOAD_PATH.unshift(File.realpath('../lib', __dir__))
16
13
 
17
14
  require 'review'
18
15
  require 'optparse'
@@ -86,6 +83,7 @@ def check_text(files)
86
83
  m = re.match(s)
87
84
  next if m.nil? || m[0] == @review_utils_word_ok
88
85
  next if neg && neg =~ s
86
+
89
87
  str, offset = find_line(para, re)
90
88
  out = sprintf("%s:%d: %s\n", path, lineno + offset, str)
91
89
  print out
@@ -107,6 +105,7 @@ def find_line(lines, re)
107
105
  while i < lines.size - 1
108
106
  str = lines[i] + lines[i + 1]
109
107
  return str.gsub(re, '<<<\&>>>'), i if re =~ str
108
+
110
109
  i += 1
111
110
  end
112
111
 
@@ -118,6 +117,7 @@ def words_re(rc)
118
117
  nega = []
119
118
  File.foreach(rc) do |line|
120
119
  next if line[0, 1] == '#'
120
+
121
121
  if / !/ =~ line
122
122
  line, n = *line.split('!', 2)
123
123
  nega.push(n.strip)
@@ -134,7 +134,7 @@ def each_paragraph(f)
134
134
  case line
135
135
  when /\A\#@ok\((.*)\)/
136
136
  @review_utils_word_ok = $1
137
- when /\A\#@/
137
+ when /\A\#@/, /\A\s*\z/
138
138
  # do nothing
139
139
  next
140
140
  when %r{\A//caption\{(.*?)//\}}
@@ -145,9 +145,6 @@ def each_paragraph(f)
145
145
  end
146
146
  when /\A=/
147
147
  yield [line.slice(/\A=+(?:\[.*?\])?\s+(.*)/, 1).strip], f.lineno
148
- when /\A\s*\z/
149
- # skip
150
- next
151
148
  else
152
149
  buf = [line.strip]
153
150
  lineno = f.lineno
@@ -155,6 +152,7 @@ def each_paragraph(f)
155
152
  break if line.strip.empty?
156
153
  break if %r{\A(?:=|//[\w\}])} =~ line
157
154
  next if /\A\#@/ =~ line
155
+
158
156
  buf.push(line.strip)
159
157
  end
160
158
  yield buf, lineno
data/bin/review-checkdep CHANGED
@@ -9,10 +9,7 @@
9
9
  # For details of the GNU LGPL, see the file "COPYING".
10
10
  #
11
11
 
12
- require 'pathname'
13
-
14
- bindir = Pathname.new(__FILE__).realpath.dirname
15
- $LOAD_PATH.unshift((bindir + '../lib').realpath)
12
+ $LOAD_PATH.unshift(File.realpath('../lib', __dir__))
16
13
 
17
14
  PREDEF_FILE = 'PREDEF'.freeze
18
15
 
data/bin/review-compile CHANGED
@@ -9,16 +9,15 @@
9
9
  # For details of the GNU LGPL, see the file "COPYING".
10
10
  #
11
11
 
12
- require 'pathname'
13
-
14
- bindir = Pathname.new(__FILE__).realpath.dirname
15
- $LOAD_PATH.unshift((bindir + '../lib').realpath)
12
+ $LOAD_PATH.unshift(File.realpath('../lib', __dir__))
16
13
 
17
14
  require 'review'
18
15
  require 'fileutils'
19
16
  require 'optparse'
20
17
  require 'yaml'
21
18
 
19
+ include ReVIEW::Loggable
20
+
22
21
  DEFAULT_CONFIG_FILENAME = 'config.yml'.freeze
23
22
 
24
23
  def main
@@ -50,17 +49,17 @@ def _main
50
49
  begin
51
50
  loader = ReVIEW::YAMLLoader.new
52
51
  if @config['yaml']
53
- error "#{@config['yaml']} not found." unless File.exist?(@config['yaml'])
52
+ error! "#{@config['yaml']} not found." unless File.exist?(@config['yaml'])
54
53
  begin
55
54
  @config.deep_merge!(loader.load_file(@config['yaml']))
56
55
  rescue => e
57
- error "yaml error #{e.message}"
56
+ error! "yaml error #{e.message}"
58
57
  end
59
58
  elsif File.exist?(DEFAULT_CONFIG_FILENAME)
60
59
  begin
61
60
  @config.deep_merge!(loader.load_file(DEFAULT_CONFIG_FILENAME))
62
61
  rescue => e
63
- error "yaml error #{e.message}"
62
+ error! "yaml error #{e.message}"
64
63
  end
65
64
  end
66
65
 
@@ -76,12 +75,12 @@ def _main
76
75
 
77
76
  case @mode
78
77
  when :files
79
- error('no input') if ARGV.empty?
78
+ error!('no input') if ARGV.empty?
80
79
 
81
80
  @basedir = File.dirname(ARGV[0])
82
81
  book = ReVIEW::Book::Base.new(@basedir, config: @config)
83
82
  ARGV.each do |item|
84
- error("file not found: #{item}") unless File.exist?(File.join(book.config['contentdir'], item))
83
+ error!("file not found: #{item}") unless File.exist?(File.join(book.config['contentdir'], item))
85
84
  chap_name = File.basename(item, '.*')
86
85
  chap = book.chapter(chap_name)
87
86
  compiler = ReVIEW::Compiler.new(load_builder_class(@target, @check_only))
@@ -108,7 +107,7 @@ def _main
108
107
  raise "must not happen: #{@mode}"
109
108
  end
110
109
  rescue ReVIEW::ApplicationError => e
111
- error(e.message)
110
+ error! e.message
112
111
  end
113
112
  end
114
113
 
@@ -126,7 +125,7 @@ def parse_opts
126
125
  opts.on('--chapref="before,middle,after"', 'Chapref decoration. (idgxml)') { |cdec| @config['chapref'] = cdec }
127
126
  opts.on('--chapterlink', 'make chapref hyperlink') { @config['chapterlink'] = true }
128
127
  opts.on('--stylesheet=file', 'Stylesheet file for HTML (comma separated)') { |files| @config['stylesheet'] = files.split(/\s*,\s*/) }
129
- opts.on('--mathml', 'Use MathML for TeX equation in HTML') { @config['mathml'] = true }
128
+ opts.on('--mathml', 'Use MathML for TeX equation in HTML') { @config['math_format'] = 'mathml' }
130
129
  opts.on('--htmlversion=VERSION', 'HTML version.') do |v|
131
130
  v = v.to_i
132
131
  @config['htmlversion'] = v if [4, 5].include?(v)
@@ -167,15 +166,6 @@ def parse_opts
167
166
  end
168
167
  end
169
168
 
170
- def error(msg)
171
- @logger.error msg
172
- exit 1
173
- end
174
-
175
- def warn(msg)
176
- @logger.warn msg
177
- end
178
-
179
169
  def load_builder_class(target, strict)
180
170
  require "review/#{target}builder"
181
171
  ReVIEW.const_get("#{target.upcase}Builder").new(strict)
data/bin/review-epub2html CHANGED
@@ -7,10 +7,7 @@
7
7
  # the GNU LGPL, Lesser General Public License version 2.1.
8
8
  # For details of the GNU LGPL, see the file "COPYING".
9
9
 
10
- require 'pathname'
11
-
12
- bindir = Pathname.new(__FILE__).realpath.dirname
13
- $LOAD_PATH.unshift((bindir + '../lib').realpath)
10
+ $LOAD_PATH.unshift(File.realpath('../lib', __dir__))
14
11
 
15
12
  require 'review/epub2html'
16
13
 
data/bin/review-epubmaker CHANGED
@@ -6,11 +6,10 @@
6
6
  # the GNU LGPL, Lesser General Public License version 2.1.
7
7
  # For details of the GNU LGPL, see the file "COPYING".
8
8
  #
9
- require 'pathname'
10
- require 'optparse'
11
- bindir = Pathname.new(__FILE__).realpath.dirname
12
- $LOAD_PATH.unshift((bindir + '../lib').realpath)
13
9
 
10
+ $LOAD_PATH.unshift(File.realpath('../lib', __dir__))
11
+
12
+ require 'optparse'
14
13
  require 'review/epubmaker'
15
14
 
16
15
  ReVIEW::EPUBMaker.execute(*ARGV)
@@ -7,9 +7,7 @@
7
7
  # For details of the GNU LGPL, see the file "COPYING".
8
8
  #
9
9
 
10
- require 'pathname'
11
- bindir = Pathname.new(__FILE__).realpath.dirname
12
- $LOAD_PATH.unshift((bindir + '../lib').realpath)
10
+ $LOAD_PATH.unshift(File.realpath('../lib', __dir__))
13
11
 
14
12
  require 'review/idgxmlmaker'
15
13
 
data/bin/review-index CHANGED
@@ -9,11 +9,17 @@
9
9
  # For details of the GNU LGPL, see the file "COPYING".
10
10
  #
11
11
 
12
- require 'pathname'
13
-
14
- bindir = Pathname.new(__FILE__).realpath.dirname
15
- $LOAD_PATH.unshift((bindir + '../lib').realpath)
12
+ $LOAD_PATH.unshift(File.realpath('../lib', __dir__))
16
13
 
17
14
  require 'review/tocprinter'
18
15
 
19
- ReVIEW::TOCPrinter.execute(*ARGV)
16
+ begin
17
+ Signal.trap(:INT) { exit 1 }
18
+ if RUBY_PLATFORM !~ /mswin(?!ce)|mingw|cygwin|bccwin/
19
+ Signal.trap(:PIPE, 'IGNORE')
20
+ end
21
+
22
+ ReVIEW::TOCPrinter.execute(*ARGV)
23
+ rescue Errno::EPIPE
24
+ exit 0
25
+ end
data/bin/review-init CHANGED
@@ -7,10 +7,7 @@
7
7
  # the GNU LGPL, Lesser General Public License version 2.1.
8
8
  # For details of the GNU LGPL, see the file "COPYING".
9
9
 
10
- require 'pathname'
11
-
12
- bindir = Pathname.new(__FILE__).realpath.dirname
13
- $LOAD_PATH.unshift((bindir + '../lib').realpath)
10
+ $LOAD_PATH.unshift(File.realpath('../lib', __dir__))
14
11
 
15
12
  require 'review/init'
16
13
 
data/bin/review-pdfmaker CHANGED
@@ -7,9 +7,7 @@
7
7
  # For details of the GNU LGPL, see the file "COPYING".
8
8
  #
9
9
 
10
- require 'pathname'
11
- bindir = Pathname.new(__FILE__).realpath.dirname
12
- $LOAD_PATH.unshift((bindir + '../lib').realpath)
10
+ $LOAD_PATH.unshift(File.realpath('../lib', __dir__))
13
11
 
14
12
  require 'review/pdfmaker'
15
13