review 3.0.0 → 4.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (170) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby-win.yml +39 -0
  3. data/.github/workflows/ruby.yml +27 -0
  4. data/.rubocop.yml +50 -12
  5. data/.travis.yml +17 -8
  6. data/Dockerfile +21 -5
  7. data/NEWS.ja.md +358 -0
  8. data/NEWS.md +358 -1
  9. data/README.md +11 -8
  10. data/appveyor.yml +1 -3
  11. data/bin/review-catalog-converter +4 -4
  12. data/bin/review-check +8 -8
  13. data/bin/review-checkdep +1 -1
  14. data/bin/review-compile +12 -12
  15. data/bin/review-epubmaker +3 -35
  16. data/bin/review-idgxmlmaker +16 -0
  17. data/bin/review-index +2 -89
  18. data/bin/review-preproc +14 -19
  19. data/bin/review-validate +3 -3
  20. data/bin/review-vol +4 -78
  21. data/doc/LICENSE +1 -1
  22. data/doc/config.yml.sample +46 -12
  23. data/doc/config.yml.sample-simple +4 -2
  24. data/doc/format.ja.md +37 -13
  25. data/doc/format.md +35 -20
  26. data/doc/pdfmaker.ja.md +43 -1
  27. data/doc/pdfmaker.md +42 -1
  28. data/doc/quickstart.ja.md +46 -26
  29. data/doc/quickstart.md +38 -17
  30. data/lib/epubmaker/epubcommon.rb +10 -5
  31. data/lib/epubmaker/epubv2.rb +1 -1
  32. data/lib/epubmaker/epubv3.rb +1 -0
  33. data/lib/epubmaker/producer.rb +4 -2
  34. data/lib/review/book.rb +1 -1
  35. data/lib/review/book/base.rb +38 -79
  36. data/lib/review/book/chapter.rb +18 -3
  37. data/lib/review/book/compilable.rb +6 -5
  38. data/lib/review/book/index.rb +69 -101
  39. data/lib/review/book/index/item.rb +40 -0
  40. data/lib/review/book/page_metric.rb +7 -7
  41. data/lib/review/book/part.rb +28 -5
  42. data/lib/review/book/volume.rb +3 -4
  43. data/lib/review/builder.rb +105 -44
  44. data/lib/review/catalog.rb +13 -16
  45. data/lib/review/compiler.rb +84 -72
  46. data/lib/review/configure.rb +19 -8
  47. data/lib/review/epub2html.rb +37 -4
  48. data/lib/review/epubmaker.rb +62 -7
  49. data/lib/review/extentions/string.rb +0 -4
  50. data/lib/review/htmlbuilder.rb +102 -115
  51. data/lib/review/htmlutils.rb +2 -3
  52. data/lib/review/i18n.rb +2 -2
  53. data/lib/review/i18n.yml +9 -0
  54. data/lib/review/idgxmlbuilder.rb +153 -74
  55. data/lib/review/idgxmlmaker.rb +191 -0
  56. data/lib/review/init-web/finish.html +10 -0
  57. data/lib/review/init-web/index.html +190 -0
  58. data/lib/review/init-web/review-layout-design.js +691 -0
  59. data/lib/review/init.rb +125 -34
  60. data/lib/review/latexbuilder.rb +199 -88
  61. data/lib/review/lineinput.rb +1 -1
  62. data/lib/review/location.rb +32 -0
  63. data/lib/review/logger.rb +4 -8
  64. data/lib/review/makerhelper.rb +24 -5
  65. data/lib/review/markdownbuilder.rb +31 -37
  66. data/lib/review/md2inaobuilder.rb +3 -5
  67. data/lib/review/pdfmaker.rb +44 -22
  68. data/lib/review/plaintextbuilder.rb +106 -85
  69. data/lib/review/preprocessor.rb +32 -41
  70. data/lib/review/rstbuilder.rb +33 -33
  71. data/lib/review/textmaker.rb +19 -3
  72. data/lib/review/textutils.rb +76 -2
  73. data/lib/review/tocprinter.rb +231 -102
  74. data/lib/review/topbuilder.rb +114 -61
  75. data/lib/review/update.rb +19 -19
  76. data/lib/review/version.rb +1 -1
  77. data/lib/review/volumeprinter.rb +99 -0
  78. data/lib/review/webmaker.rb +11 -4
  79. data/lib/review/webtocprinter.rb +38 -35
  80. data/lib/review/yamlloader.rb +26 -16
  81. data/review.gemspec +6 -4
  82. data/samples/sample-book/README.md +7 -2
  83. data/samples/sample-book/src/.gitignore +154 -0
  84. data/samples/sample-book/src/config-ebook.yml +4 -0
  85. data/samples/sample-book/src/config-jlreq-ebook.yml +4 -0
  86. data/samples/sample-book/src/config-jlreq.yml +6 -0
  87. data/samples/sample-book/src/config.yml +2 -2
  88. data/samples/sample-book/src/lib/tasks/review.rake +29 -14
  89. data/samples/sample-book/src/lib/tasks/z01_copy_sty.rake +14 -8
  90. data/samples/syntax-book/ch01.re +4 -2
  91. data/samples/syntax-book/ch02.re +8 -16
  92. data/samples/syntax-book/ch03.re +3 -6
  93. data/samples/syntax-book/config-jlreq-lualatex.yml +4 -0
  94. data/samples/syntax-book/config-jlreq.yml +5 -0
  95. data/samples/syntax-book/config-print.yml +3 -0
  96. data/samples/syntax-book/config.yml +1 -1
  97. data/samples/syntax-book/lib/tasks/review.rake +30 -15
  98. data/samples/syntax-book/lib/tasks/z01_copy_sty.rake +14 -8
  99. data/templates/latex/config.erb +16 -0
  100. data/templates/latex/layout.tex.erb +4 -0
  101. data/templates/latex/review-jlreq/review-base.sty +150 -61
  102. data/templates/latex/review-jlreq/review-jlreq.cls +74 -8
  103. data/templates/latex/review-jlreq/review-style.sty +4 -1
  104. data/templates/latex/review-jsbook/README.md +39 -0
  105. data/templates/latex/review-jsbook/review-base.sty +101 -23
  106. data/templates/latex/review-jsbook/review-jsbook.cls +28 -5
  107. data/templates/latex/review-jsbook/review-style.sty +5 -2
  108. data/templates/opf/epubv3.opf.erb +1 -0
  109. data/templates/web/html/layout-html5.html.erb +2 -2
  110. data/test/assets/test_template.tex +24 -3
  111. data/test/assets/test_template_backmatter.tex +24 -3
  112. data/test/test_book.rb +75 -21
  113. data/test/test_book_chapter.rb +4 -2
  114. data/test/test_book_part.rb +3 -3
  115. data/test/test_builder.rb +16 -0
  116. data/test/test_catalog.rb +24 -42
  117. data/test/test_catalog_converter_cmd.rb +1 -1
  118. data/test/test_epubmaker_cmd.rb +14 -7
  119. data/test/test_helper.rb +15 -7
  120. data/test/test_htmlbuilder.rb +909 -159
  121. data/test/test_i18n.rb +25 -25
  122. data/test/test_idgxmlbuilder.rb +395 -38
  123. data/test/test_idgxmlmaker_cmd.rb +46 -0
  124. data/test/test_image_finder.rb +52 -70
  125. data/test/test_index.rb +50 -10
  126. data/test/test_latexbuilder.rb +1194 -106
  127. data/test/test_latexbuilder_v2.rb +628 -97
  128. data/test/test_logger.rb +14 -1
  129. data/test/test_makerhelper.rb +3 -3
  130. data/test/test_markdownbuilder.rb +134 -16
  131. data/test/test_md2inaobuilder.rb +32 -9
  132. data/test/test_pdfmaker.rb +18 -1
  133. data/test/test_pdfmaker_cmd.rb +100 -6
  134. data/test/test_plaintextbuilder.rb +371 -25
  135. data/test/test_preprocessor.rb +2 -16
  136. data/test/test_rstbuilder.rb +249 -26
  137. data/test/test_textmaker_cmd.rb +54 -0
  138. data/test/test_textutils.rb +109 -2
  139. data/test/test_topbuilder.rb +546 -31
  140. data/test/test_update.rb +17 -8
  141. data/test/test_webtocprinter.rb +66 -34
  142. data/test/test_yamlloader.rb +13 -0
  143. data/vendor/jsclasses/LICENSE +1 -1
  144. data/vendor/jsclasses/jis/jsarticle.cls +53 -14
  145. data/vendor/jsclasses/jis/jsbook.cls +53 -14
  146. data/vendor/jsclasses/jis/jsclasses.dtx +84 -25
  147. data/vendor/jsclasses/jis/jslogo.dtx +4 -4
  148. data/vendor/jsclasses/jis/jslogo.sty +3 -3
  149. data/vendor/jsclasses/jis/jspf.cls +52 -13
  150. data/vendor/jsclasses/jis/jsreport.cls +53 -14
  151. data/vendor/jsclasses/jis/kiyou.cls +53 -14
  152. data/vendor/jsclasses/jis/okumacro.dtx +4 -5
  153. data/vendor/jsclasses/jis/okumacro.sty +3 -4
  154. data/vendor/jsclasses/jsarticle.cls +53 -14
  155. data/vendor/jsclasses/jsbook.cls +53 -14
  156. data/vendor/jsclasses/jsclasses.dtx +84 -25
  157. data/vendor/jsclasses/jsclasses.pdf +0 -0
  158. data/vendor/jsclasses/jslogo.dtx +4 -4
  159. data/vendor/jsclasses/jslogo.pdf +0 -0
  160. data/vendor/jsclasses/jslogo.sty +3 -3
  161. data/vendor/jsclasses/jspf.cls +52 -13
  162. data/vendor/jsclasses/jsreport.cls +53 -14
  163. data/vendor/jsclasses/kiyou.cls +53 -14
  164. data/vendor/jsclasses/okumacro.dtx +4 -5
  165. data/vendor/jsclasses/okumacro.pdf +0 -0
  166. data/vendor/jsclasses/okumacro.sty +3 -4
  167. metadata +55 -10
  168. data/lib/review/tocparser.rb +0 -271
  169. data/samples/syntax-book/review-ext.rb +0 -14
  170. data/test/test_tocparser.rb +0 -25
@@ -84,6 +84,47 @@ Since Re:VIEW 3.0, review-jlreq.cls is also provided. This class file extends jl
84
84
 
85
85
  `review-init --latex-template=review-jlreq` command copies the review-jlreq.cls set to `sty` folder.
86
86
 
87
+ ### Handing over custom parameters
88
+
89
+ For technical reasons, only a small part of the YAML parameters in config.yml is converted to TeX macros. Re:VIEW's internal `config.erb` ( https://github.com/ kmuto/review/blob/master/templates/latex/ config.erb ) ERB script manages this. You cannot change this script.
90
+
91
+ If you want to give YAML parameters to TeX, you can use your own ERB script that do the YAML to TeX conversion. This is done by creating `layouts/config-local.tex.erb` in the project folder.
92
+
93
+ After evaluation and embedding of `config.erb`, `config-local.tex. erb` will be evaluated and embedded as well. For example,
94
+
95
+ `config.yml`:
96
+
97
+ ```
98
+ mycustom:
99
+ mystring: HELLO_#1
100
+ mybool: true
101
+ ```
102
+
103
+ `layouts/config-local.tex.erb`:
104
+
105
+ ```
106
+ \def\mystring{<%= escape(@config['mycustom']['mystring']) %>}
107
+ <%- if @config['mycustom']['mybool'] -%>
108
+ \def\mybool{true}
109
+ <%- end -%>
110
+ ```
111
+
112
+ will be parsed:
113
+
114
+ ```
115
+
116
+ \makeatother
117
+ %% BEGIN: config-local.tex.erb
118
+ \def\mystring{HELLO\textunderscore{}\#1}
119
+ \def\mybool{true}
120
+ %% END: config-local.tex.erb
121
+
122
+ \usepackage{reviewmacro}
123
+
124
+ ```
125
+
126
+ Refer to these macros in your sty file.
127
+
87
128
  ## Important Changes about LaTeX in Re:VIEW 2.0
88
129
 
89
130
  * Default LaTeX compiler is upLaTeX, not pLaTeX.
@@ -100,7 +141,7 @@ Default settings of Re:VIEW is below:
100
141
 
101
142
  ```yaml
102
143
  texcommand: uplatex
103
- texoptions: "-interaction=nonstopmode -file-line-error"
144
+ texoptions: "-interaction=nonstopmode -file-line-error -halt-on-error"
104
145
  texdocumentclass: ["review-jsbook", "uplatex,twoside"]
105
146
  dvicommand: dvipdfmx
106
147
  dvioptions: "-d 5"
@@ -8,11 +8,11 @@ Re:VIEW は GNU Lesser General Public License Version 2.1 に基づいて配布
8
8
 
9
9
  このドキュメントでは、Re:VIEW のセットアップから変換の例までを簡単に説明します。
10
10
 
11
- このドキュメントは、Re:VIEW 3.0 に基づいています。
11
+ このドキュメントは、Re:VIEW 4.2 に基づいています。
12
12
 
13
13
  ## セットアップ
14
14
 
15
- Re:VIEW は Ruby 言語で記述されており、Linux/Unix 互換システムで動作します。macOS および Windows Cygwin でも動作可能です。Ruby gem あるいは Git のいずれかを使ってダウンロード・展開します。
15
+ Re:VIEW は Ruby 言語で記述されており、Linux/Unix 互換システムで動作します。macOS および Windows でも動作可能です。Ruby gem あるいは Git のいずれかを使ってダウンロード・展開します。
16
16
 
17
17
  なお、Re:VIEW フォーマット自体は文字で表現されたタグが付いている以外は単なるテキストファイルなので、エディタ、OS については UTF-8 文字エンコーディングさえ使用できれば制限はありません。
18
18
 
@@ -34,7 +34,7 @@ Ruby gem の bin ディレクトリにパスを通すようにしておいてく
34
34
  $ gem update review
35
35
  ```
36
36
 
37
- Gemfile を使っている場合は、以下の行を Gemfile に追加して、`bundle`コマンドを実行します。
37
+ Gemfile を使っている場合は、以下の行を Gemfile に追加して、`bundle` コマンドを実行します。
38
38
 
39
39
  ```Gemfile
40
40
  gem 'review'
@@ -58,29 +58,37 @@ review というディレクトリに展開されるので、review/bin にパ
58
58
  $ git pull
59
59
  ```
60
60
 
61
- ## Re:VIEW ドキュメントの作成
61
+ ## Re:VIEW プロジェクトの作成
62
62
 
63
63
  ### 雛型の作成
64
- review-init コマンドを使って、雛型となる作業フォルダを作成できます。
64
+ review-init コマンドを使って、雛型となるプロジェクトフォルダを作成できます。
65
65
 
66
66
  ```
67
- $ review-init ドキュメント名
67
+ $ review-init プロジェクト名
68
68
  ```
69
69
 
70
- これで指定のドキュメント名のフォルダが用意され、中に次のようなファイルが置かれます。
70
+ TeX を利用した PDF 作成を目的としているならば、雛型の作成時に、Web ブラウザによるウィザードモードで基本版面設計を行うことができます。これには `-w` オプションを付けます。
71
71
 
72
- * ドキュメント名を冠した「.re」拡張子を持つファイル(Re:VIEW フォーマットテキストファイル)
72
+ ```
73
+ $ review-init -w プロジェクト名
74
+ ```
75
+
76
+ 「http://localhost:18000」に Web ブラウザでアクセスし、文字数×行数および余白を調整できます。
77
+
78
+ これで指定のプロジェクト名のフォルダが用意され、中に次のようなファイルが置かれます。
79
+
80
+ * プロジェクト名を冠した「.re」拡張子を持つファイル(Re:VIEW フォーマットテキストファイル)
73
81
  * config.yml : 設定ファイル
82
+ * config-ebook.yml : 電子ブック用設定ファイル(ウィザードモード使用時)
74
83
  * catalog.yml : カタログファイル(目次構成)
75
84
  * Rakefile : rake コマンドのルールファイル
76
85
  * images : 画像の配置フォルダ
77
- * layouts : レイアウトファイルの配置フォルダ
78
86
  * style.css : サンプルスタイルシート
79
87
  * sty : スタイルファイル配置フォルダ(TeX 用)
80
88
  * doc : 本ドキュメントを含む使い方のドキュメント
81
89
  * lib : 主に rake コマンドの詳細ルールファイル
82
90
 
83
- review-init コマンドによらず、独自に作業フォルダを作成してもかまいません。
91
+ review-init コマンドによらず、独自にプロジェクトフォルダを作成してもかまいません。
84
92
 
85
93
  ### Re:VIEW テキストの作成と変換
86
94
 
@@ -115,28 +123,37 @@ review-init コマンドによらず、独自に作業フォルダを作成し
115
123
 
116
124
  テキストファイルの文字エンコーディングには、UTF-8 を使用してください。
117
125
 
118
- ### PDF 化と EPUB 化、プレインテキスト化
126
+ ### PDF 化と EPUB 化、プレインテキスト化、XML 化
127
+
128
+ review-*maker コマンドで一括して変換作成ができます。
119
129
 
120
- review-pdfmaker コマンドで PDF ブックの作成、review-epubmaker コマンドで EPUB ファイルの作成、review-textmaker コマンドでプレインテキストの作成ができます。
130
+ - review-pdfmaker コマンド:PDF ブックの作成
131
+ - review-epubmaker コマンド:EPUB ファイルの作成
132
+ - review-textmaker コマンド:プレインテキストの作成
133
+ - review-idgxmlmaker コマンド:InDesign XML の作成
121
134
 
122
135
  PDF を作成するには、TeXLive2012 以上の環境が必要です。EPUB を作成するには、rubyzip gem あるいは zip コマンドが必要です(MathML も使いたいときには、 [MathML ライブラリ](http://www.hinet.mydns.jp/?mathml.rb)も必要です)。
123
136
 
124
137
  いずれのコマンドも、必要な設定情報を記した YAML 形式ファイルを引数に指定して実行します。review-init コマンドで作成した環境には、デフォルトで config.yml として用意されているので、これを利用します。
125
138
 
126
139
  ```bash
127
- $ review-pdfmaker config.yml ←PDFの作成
128
- $ review-epubmaker config.yml ←EPUBの作成
129
- $ review-textmaker config.yml ←テキストの作成(装飾情報あり)
130
- $ review-textmaker -n config.yml ←テキストの作成(装飾情報なし)
140
+ $ review-pdfmaker config.yml ←PDFの作成
141
+ $ review-pdfmaker config-ebook.yml ←電子ブック設定でのPDFの作成
142
+ $ review-epubmaker config.yml ←EPUBの作成
143
+ $ review-textmaker config.yml ←テキストの作成(装飾情報あり)
144
+ $ review-textmaker -n config.yml ←テキストの作成(装飾情報なし)
145
+ $ review-idgxmlmaker config.yml ←InDesign XMLの作成
131
146
  ```
132
147
 
133
148
  rake コマンドを利用できるなら、次のように実行することもできます。
134
149
 
135
150
  ```bash
136
151
  $ rake pdf ←PDFの作成
152
+ $ REVIEW_CONFIG_FILE=config-ebook.yml rake pdf ←電子ブック設定でのPDFの作成
137
153
  $ rake epub ←EPUBの作成
138
154
  $ rake text ←テキストの作成(装飾情報あり)
139
155
  $ rake plaintext ←テキストの作成(装飾情報なし)
156
+ $ rake idgxml ←InDesign XMLの作成
140
157
  ```
141
158
 
142
159
  config.yml のサンプルについては以下を参照してください。
@@ -177,7 +194,7 @@ Re:VIEW の使用実例については、https://github.com/reviewml/review-samp
177
194
  $ review-compile --target text sample.re > sample.txt ←テキストにする
178
195
  $ review-compile --target html sample.re > sample.html ←HTMLにする
179
196
  $ review-compile --target latex sample.re > sample.tex ←LaTeXにする
180
- $ review-compile --target idgxml sample.re > sample.xml ←XMLにする
197
+ $ review-compile --target idgxml sample.re > sample.xml ←InDesign XMLにする
181
198
  $ review-compile --target markdown sample.re > sample.md ←Markdownにする
182
199
  ```
183
200
 
@@ -200,20 +217,23 @@ $ review-preproc --replace ファイル ←ファイルを更新したもので
200
217
  $ review-vol
201
218
  ```
202
219
 
203
- より細かな見出し一覧などを出したいときには、review-index コマンドを使うのもよいでしょう。
220
+ より細かな見出し一覧などを出したいときには、review-index コマンドを使うとよいでしょう。
204
221
 
205
222
  ```bash
206
- $ review-index --level 掘り下げる見出しレベル数 -a
223
+ $ review-index -l 掘り下げる見出しレベル数
224
+ $ review-index -l 掘り下げる見出しレベル数 -d ←分量の詳細を表示
207
225
  ```
208
226
 
209
- ## ドキュメントフォルダを新しい Re:VIEW バージョンに追従する方法
227
+ review-vol review-index では、文字数や行数、見込みページなど各値に大きな差が出ることがあります。これは、review-vol がごく簡単にファイルから概算しているのに対し、review-index は実際に内部でコンパイルして比較的精密に計量しているからです。
228
+
229
+ ## プロジェクトフォルダを新しい Re:VIEW バージョンに追従する方法
210
230
 
211
- Re:VIEW は定期的に更新されています。おおむね後方互換性を保持していますが、新しいバージョン固有の機能を利用したいときには、ドキュメントフォルダを新しいバージョンに更新する review-update コマンドを利用します。
231
+ Re:VIEW は定期的に更新されています。おおむね後方互換性を保持していますが、新しいバージョン固有の機能を利用したいときには、プロジェクトフォルダを新しいバージョンに更新する review-update コマンドを利用します。
212
232
 
213
233
  ```bash
214
234
  $ review-update
215
- ** review-update はプロジェクトを 3.0.0 に更新します **
216
- config.yml: 'review_version' を '3.0' に更新しますか? [y]/n ←Enterで実行
235
+ ** review-update はプロジェクトを 4.1.0 に更新します **
236
+ config.yml: 'review_version' を '4.0' に更新しますか? [y]/n ←Enterで実行
217
237
  Rakefile は Re:VIEW バージョンのもの (/.../review/samples/sample-book/src/Rakefile) で置き換えられます。本当に進めますか? [y]/n
218
238
  lib/tasks/review.rake は Re:VIEW バージョンのもの (/.../review/samples/sample-book/src/lib/tasks/review.rake) で置き換えられます。本当に進めますか? [y]/n
219
239
  INFO: 新しいファイル /.../sty/plistings.sty が作成されました。
@@ -223,15 +243,15 @@ INFO: 新しいファイル /.../sty/review-custom.sty が作成されました
223
243
  INFO: 新しいファイル /.../sty/review-jsbook.cls が作成されました。
224
244
  INFO: 新しいファイル /.../sty/review-style.sty が作成されました。
225
245
  INFO: 新しいファイル /.../sty/review-base.sty が作成されました。
226
- INFO: 新しいファイル /.../sty/gentombow09j.sty が作成されました。
246
+ INFO: 新しいファイル /.../sty/gentombow.sty が作成されました。
227
247
  完了しました。
228
248
  ```
229
249
 
230
250
  ## クレジット
231
251
 
232
- Re:VIEW は、青木峰郎によって最初に作成されました。武藤健志がこの開発・保守を引き継ぎ、201811月時点では、武藤健志、高橋征義、角征典が開発・保守を継続しています。
252
+ Re:VIEW は、青木峰郎によって最初に作成されました。武藤健志がこの開発・保守を引き継ぎ、20203月時点では、武藤健志、高橋征義、角征典が開発・保守を継続しています。
233
253
 
234
- バグ・パッチの報告、開発者用メーリングリストなどについての情報は、
254
+ バグ・パッチの報告、その他の情報は、
235
255
 
236
256
  * http://reviewml.org/
237
257
  * https://github.com/kmuto/review/wiki
@@ -9,7 +9,7 @@ Re:VIEW is free software under the terms of the GNU Lesser General Public Licens
9
9
 
10
10
  This article describes how to setup Re:VIEW and use it.
11
11
 
12
- The supported version of the article is Re:VIEW 3.0.
12
+ The supported version of the article is Re:VIEW 4.2.
13
13
 
14
14
  ## Set up Re:VIEW
15
15
 
@@ -59,7 +59,7 @@ $ git pull
59
59
 
60
60
  ## Writing Re:VIEW Document
61
61
 
62
- ### Generating template fiels
62
+ ### Generating template files
63
63
 
64
64
  After setup, you can use `review-init` command to generate Re:VIEW project directory.
65
65
 
@@ -72,14 +72,23 @@ $ ls hello
72
72
  Rakefile catalog.yml config.yml hello.re images/ layouts/ sty/ style.css
73
73
  ```
74
74
 
75
+ If your purpose is to create a PDF using TeX, it is a good idea to use the wizard mode for basic layouting in a web browser. Add `-w` option to review-init.
76
+
77
+ (notice: currently wizard UI supports only Japanese language)
78
+
79
+ ```bash
80
+ $ review-init -w hello
81
+ (access http://localhost:18000 on Web browser)
82
+ ```
83
+
75
84
  In `hello` directory, many files are generated.
76
85
 
77
86
  * `*.re` : Re:VIEW format file.
78
87
  * config.yml : configuration file
88
+ * config-ebook.yml : configuration file for ebook (when using the wizard mode)
79
89
  * catalog.yml : catalog file (for TOC)
80
90
  * Rakefile : rule file for `rake` command
81
91
  * images : folder for images
82
- * layouts : forlder for layout files
83
92
  * style.css : sample stylesheet
84
93
  * sty : style files for LaTeX
85
94
  * doc : various documents (including this document)
@@ -116,29 +125,38 @@ The web site of Re:VIEW is @{https://reviewml.org/}.
116
125
 
117
126
  You should use UTF-8 as encodings in text files.
118
127
 
119
- ### generating PDF, EPUB, and plain-text
128
+ ### generating PDF, EPUB, plain-text, and InDesign XML
129
+
130
+ To convert files in the project, use review-*maker command.
120
131
 
121
- You can generate a PDF file with `review-pdfmaker` command. Also you can generate an EPUB file with `review-epubmaker` command, and can generate an plain-text file with 'review-textmaker' command.
132
+ - review-pdfmaker: generate PDF
133
+ - review-epubmaker: generate EPUB
134
+ - review-textmaker: genrate plaintext
135
+ - review-idgxmlmaker: genrate InDesign XML
122
136
 
123
- To generate PDF, you should install TeXLive 2012 or later. To generate EPUB, you should install zip command.
137
+ To generate PDF, you should install TeXLive 2012 or later. To generate EPUB, you should install zip command.
124
138
  When you want to use MathML, you should install [MathML library](http://www.hinet.mydns.jp/?mathml.rb)
125
139
 
126
- Each maker need `config.yml`, configuration YAML files. `review-init` command generates `config.yml` in default.
140
+ Each maker need `config.yml`, configuration YAML files. `review-init` command generates `config.yml` in default.
127
141
 
128
142
  ```bash
129
- $ review-pdfmaker config.yml ## generate PDF
130
- $ review-epubmaker config.yml ## generate EPUB
131
- $ review-textmaker config.yml ## generate text with decoration
132
- $ review-textmaker -n config.yml ## generate text without decoration
143
+ $ review-pdfmaker config.yml ## generate PDF
144
+ $ review-pdfmaker config-ebook.yml ## generate PDF (for ebook)
145
+ $ review-epubmaker config.yml ## generate EPUB
146
+ $ review-textmaker config.yml ## generate text with decoration
147
+ $ review-textmaker -n config.yml ## generate text without decoration
148
+ $ review-idgxmlmaker config.yml ## generate InDesign XML
133
149
  ```
134
150
 
135
151
  You also can generate them with Rake.
136
152
 
137
153
  ```bash
138
154
  $ rake pdf ## generate PDF
155
+ $ REVIEW_CONFIG_FILE=config-ebook.yml rake pdf ## generate PDF (for ebook)
139
156
  $ rake epub ## generate EPUB
140
157
  $ rake text ## generate text with decoration
141
158
  $ rake plaintext ## generate text without decoration
159
+ $ rake idgxml ## generate InDesign XML
142
160
  ```
143
161
 
144
162
  There is a sample YAML file [config.yml.sample](https://github.com/kmuto/review/blob/master/doc/config.yml.sample) in the same directory of this document.
@@ -205,17 +223,20 @@ $ review-vol
205
223
  You can also use `review-index` command to generate header list.
206
224
 
207
225
  ```bash
208
- $ review-index --level <heading level> -a
226
+ $ review-index --level <heading level>
227
+ $ review-index --level <heading level> -d ## show volumes also
209
228
  ```
210
229
 
230
+ review-vol and review-index can have large differences in the number of characters, lines, and pages. While review-vol only estimates from the file, review-index actually compiles and calculates.
231
+
211
232
  ## how to update the document folder to the new Re:VIEW version
212
233
 
213
- Re:VIEW is updated regularly. We Re:VIEW team watch the backward compatibility carefully, but if you want to use the features in the new version, you can use review-update command to update the document folder.
234
+ Re:VIEW is updated regularly. We Re:VIEW team watch the backward compatibility carefully, but if you want to use the features in the new version, you can use review-update command to update the project folder.
214
235
 
215
236
  ```bash
216
237
  $ review-update
217
- ** review-update updates your project to 3.0.0 **
218
- config.yml: Update 'review_version' to '3.0'? [y]/n
238
+ ** review-update updates your project to 4.1.0 **
239
+ config.yml: Update 'review_version' to '4.0'? [y]/n
219
240
  Rakefile will be overridden with Re:VIEW version (/.../review/samples/sample-book/src/Rakefile). Do you really proceed? [y]/n
220
241
  lib/tasks/review.rake will be overridden with Re:VIEW version (/.../review/samples/sample-book/src/lib/tasks/review.rake). Do you really proceed? [y]/n
221
242
  INFO: new file /.../sty/plistings.sty is created.
@@ -225,13 +246,13 @@ INFO: new file /.../sty/review-custom.sty is created.
225
246
  INFO: new file /.../sty/review-jsbook.cls is created.
226
247
  INFO: new file /.../sty/review-style.sty is created.
227
248
  INFO: new file /.../sty/review-base.sty is created.
228
- INFO: new file /.../sty/gentombow09j.sty is created.
249
+ INFO: new file /.../sty/gentombow.sty is created.
229
250
  Finished.
230
251
  ```
231
252
 
232
253
  ## Copyright
233
254
 
234
- The original author of Re:VIEW is Minero Aoki. The current maintainer is Kenshi Muto(@kmuto), and committers are Masayoshi Takahashi and Masanori Kado (September 2018).
255
+ The original author of Re:VIEW is Minero Aoki. The current maintainer is Kenshi Muto(@kmuto), and committers are Masayoshi Takahashi and Masanori Kado (March 2020).
235
256
 
236
257
  If you want to report bugs and patches, or to get more information, see:
237
258
 
@@ -1,6 +1,6 @@
1
1
  # = epubcommon.rb -- super class for EPUBv2 and EPUBv3
2
2
  #
3
- # Copyright (c) 2010-2017 Kenshi Muto and Masayoshi Takahashi
3
+ # Copyright (c) 2010-2019 Kenshi Muto and Masayoshi Takahashi
4
4
  #
5
5
  # This program is free software.
6
6
  # You can distribute or modify this program under the terms of
@@ -36,10 +36,9 @@ module EPUBMaker
36
36
  if @producer.config['coverimage']
37
37
  file = nil
38
38
  @producer.contents.each do |item|
39
- if !item.media.start_with?('image') || item.file !~ /#{@producer.config["coverimage"]}\Z/
39
+ if !item.media.start_with?('image') || item.file !~ /#{@producer.config['coverimage']}\Z/
40
40
  next
41
41
  end
42
-
43
42
  s << %Q( <meta name="cover" content="#{item.id}"/>\n)
44
43
  file = item.file
45
44
  break
@@ -327,8 +326,14 @@ EOT
327
326
 
328
327
  if has_part
329
328
  @producer.contents.each do |item|
330
- item.level += 1 if item.chaptype == 'part' || item.chaptype == 'body'
331
- item.notoc = true if (item.chaptype == 'pre' || item.chaptype == 'post') && !item.level.nil? && (item.level + 1 == toclevel) # FIXME: part processing
329
+ if item.chaptype == 'part' && item.level > 0
330
+ # sections in part
331
+ item.level -= 1
332
+ end
333
+ # down level for part and chaps. pre, appendix, post are preserved
334
+ if item.chaptype == 'part' || item.chaptype == 'body'
335
+ item.level += 1
336
+ end
332
337
  end
333
338
  toclevel += 1
334
339
  end
@@ -39,7 +39,7 @@ module EPUBMaker
39
39
  if @producer.config[item].is_a?(Array)
40
40
  s << @producer.config.names_of(item).map { |i| %Q( <dc:#{item}>#{CGI.escapeHTML(i)}</dc:#{item}>\n) }.join
41
41
  else
42
- s << %Q( <dc:#{item}>#{CGI.escapeHTML(@producer.config.name_of(item))}</dc:#{item}>\n)
42
+ s << %Q( <dc:#{item}>#{CGI.escapeHTML(@producer.config.name_of(item).to_s)}</dc:#{item}>\n)
43
43
  end
44
44
  end
45
45
 
@@ -26,6 +26,7 @@ module EPUBMaker
26
26
  # Return opf file content.
27
27
  def opf
28
28
  @opf_metainfo = opf_metainfo
29
+ @opf_coverimage = opf_coverimage
29
30
  @opf_manifest = opf_manifest
30
31
  @opf_toc = opf_tocx
31
32
  @package_attrs = ''
@@ -192,7 +192,8 @@ module EPUBMaker
192
192
  current = Dir.pwd
193
193
  basedir ||= current
194
194
 
195
- new_tmpdir = tmpdir.nil? ? Dir.mktmpdir : tmpdir
195
+ # use Dir to solve a path for Windows (see #1011)
196
+ new_tmpdir = Dir[File.join(tmpdir.nil? ? Dir.mktmpdir : tmpdir)][0]
196
197
  if epubfile !~ %r{\A/}
197
198
  epubfile = "#{current}/#{epubfile}"
198
199
  end
@@ -269,7 +270,8 @@ module EPUBMaker
269
270
  'rename_for_legacy' => nil,
270
271
  'verify_target_images' => nil,
271
272
  'force_include_images' => [],
272
- 'cover_linear' => nil
273
+ 'cover_linear' => nil,
274
+ 'back_footnote' => nil
273
275
  },
274
276
  'externallink' => true,
275
277
  'contentdir' => '.',
@@ -19,7 +19,7 @@ require 'review/book/index'
19
19
  module ReVIEW
20
20
  module Book
21
21
  def self.load(dir)
22
- Base.load dir
22
+ Base.load(dir)
23
23
  end
24
24
  end
25
25
  end
@@ -1,5 +1,5 @@
1
1
  #
2
- # Copyright (c) 2009-2018 Minero Aoki, Kenshi Muto
2
+ # Copyright (c) 2009-2019 Minero Aoki, Kenshi Muto
3
3
  # 2002-2008 Minero Aoki
4
4
  #
5
5
  # This program is free software.
@@ -29,7 +29,6 @@ module ReVIEW
29
29
  @chapter_index = nil
30
30
  @config = ReVIEW::Configure.values
31
31
  @catalog = nil
32
- @read_part = nil
33
32
  @warn_old_files = {} # XXX for checking CHAPS, PREDEF, POSTDEF
34
33
  @basedir_seen = {}
35
34
  update_rubyenv
@@ -80,7 +79,7 @@ module ReVIEW
80
79
  def page_metric
81
80
  if config['page_metric'].respond_to?(:downcase) && config['page_metric'].upcase =~ /\A[A-Z0-9_]+\Z/
82
81
  ReVIEW::Book::PageMetric.const_get(config['page_metric'].upcase)
83
- elsif config['page_metric'].is_a?(Array) && config['page_metric'].size == 5
82
+ elsif config['page_metric'].is_a?(Array) && (config['page_metric'].size == 5 || config['page_metric'].size == 4)
84
83
  ReVIEW::Book::PageMetric.new(*config['page_metric'])
85
84
  else
86
85
  config['page_metric']
@@ -137,19 +136,20 @@ module ReVIEW
137
136
 
138
137
  def chapter_index
139
138
  return @chapter_index if @chapter_index
140
-
141
- contents = chapters
142
- # TODO: contents += parts.find_all { |prt| prt.id.present? }
139
+ @chapter_index = ChapterIndex.new
140
+ each_chapter do |chap|
141
+ @chapter_index.add_item(Index::Item.new(chap.id, chap.number, chap))
142
+ end
143
143
  parts.each do |prt|
144
144
  if prt.id.present?
145
- contents << prt
145
+ @chapter_index.add_item(Index::Item.new(prt.id, prt.number, prt))
146
146
  end
147
147
  end
148
- @chapter_index = ChapterIndex.new(contents)
148
+ @chapter_index
149
149
  end
150
150
 
151
151
  def chapter(id)
152
- chapter_index[id]
152
+ chapter_index[id].content
153
153
  end
154
154
 
155
155
  def next_chapter(chapter)
@@ -175,9 +175,7 @@ module ReVIEW
175
175
  end
176
176
 
177
177
  def volume
178
- vol = Volume.sum(chapters.map(&:volume))
179
- vol.page_per_kbyte = page_metric.page_per_kbyte
180
- vol
178
+ Volume.sum(parts.map(&:volume) + chapters.map(&:volume))
181
179
  end
182
180
 
183
181
  def load_config(filename)
@@ -189,8 +187,8 @@ module ReVIEW
189
187
  return @catalog if @catalog.present?
190
188
 
191
189
  catalogfile_path = filename_join(@basedir, config['catalogfile'])
192
- if File.file? catalogfile_path
193
- @catalog = File.open(catalogfile_path, 'r:BOM|utf-8') { |f| Catalog.new(f) }
190
+ if File.file?(catalogfile_path)
191
+ @catalog = File.open(catalogfile_path, 'rt:BOM|utf-8') { |f| Catalog.new(f) }
194
192
  end
195
193
  if @catalog
196
194
  @catalog.validate!(@config, basedir)
@@ -202,7 +200,7 @@ module ReVIEW
202
200
  if catalog
203
201
  catalog.chaps
204
202
  else
205
- read_file(config['chapter_file'])
203
+ read_file(config['chapter_file']).split("\n")
206
204
  end
207
205
  end
208
206
 
@@ -210,7 +208,7 @@ module ReVIEW
210
208
  if catalog
211
209
  catalog.predef
212
210
  else
213
- read_file(config['predef_file'])
211
+ read_file(config['predef_file']).split("\n")
214
212
  end
215
213
  end
216
214
 
@@ -218,7 +216,7 @@ module ReVIEW
218
216
  if catalog
219
217
  catalog.appendix
220
218
  else
221
- read_file(config['postdef_file']) # for backward compatibility
219
+ read_file(config['postdef_file']).split("\n") # for backward compatibility
222
220
  end
223
221
  end
224
222
 
@@ -226,17 +224,15 @@ module ReVIEW
226
224
  if catalog
227
225
  catalog.postdef
228
226
  else
229
- ''
227
+ []
230
228
  end
231
229
  end
232
230
 
233
231
  def read_part
234
- return @read_part if @read_part
235
-
236
232
  if catalog
237
- @read_part = catalog.parts
233
+ catalog.parts
238
234
  else
239
- @read_part = File.read(File.join(@basedir, config['part_file']))
235
+ File.read(File.join(@basedir, config['part_file'])).split("\n")
240
236
  end
241
237
  end
242
238
 
@@ -258,39 +254,39 @@ module ReVIEW
258
254
 
259
255
  def prefaces
260
256
  if catalog
261
- return mkpart_from_namelist(catalog.predef.split("\n"))
257
+ return Part.mkpart_from_namelist(self, catalog.predef)
262
258
  end
263
259
 
264
260
  begin
265
261
  predef_file = filename_join(@basedir, config['predef_file'])
266
262
  if File.file?(predef_file)
267
- mkpart_from_namelistfile(predef_file)
263
+ Part.mkpart_from_namelistfile(self, predef_file)
268
264
  end
269
- rescue FileNotFound => err
270
- raise FileNotFound, "preface #{err.message}"
265
+ rescue FileNotFound => e
266
+ raise FileNotFound, "preface #{e.message}"
271
267
  end
272
268
  end
273
269
 
274
270
  def appendix
275
271
  if catalog
276
- names = catalog.appendix.split("\n")
277
- chaps = names.each_with_index.map { |n, idx| mkchap_ifexist(n, idx) }.compact
278
- return mkpart(chaps)
272
+ names = catalog.appendix
273
+ chaps = names.each_with_index.map { |name, number| Chapter.mkchap_ifexist(self, name, number + 1) }.compact
274
+ return Part.mkpart(chaps)
279
275
  end
280
276
 
281
277
  begin
282
278
  postdef_file = filename_join(@basedir, config['postdef_file'])
283
279
  if File.file?(postdef_file)
284
- mkpart_from_namelistfile(postdef_file)
280
+ Part.mkpart_from_namelistfile(self, postdef_file)
285
281
  end
286
- rescue FileNotFound => err
287
- raise FileNotFound, "postscript #{err.message}"
282
+ rescue FileNotFound => e
283
+ raise FileNotFound, "postscript #{e.message}"
288
284
  end
289
285
  end
290
286
 
291
287
  def postscripts
292
288
  if catalog
293
- mkpart_from_namelist(catalog.postdef.split("\n"))
289
+ Part.mkpart_from_namelist(self, catalog.postdef)
294
290
  end
295
291
  end
296
292
 
@@ -300,13 +296,13 @@ module ReVIEW
300
296
  list = parse_chapters
301
297
  # NOTE: keep this = style to work this logic.
302
298
  if pre = prefaces
303
- list.unshift pre
299
+ list.unshift(pre)
304
300
  end
305
301
  if app = appendix
306
- list.push app
302
+ list.push(app)
307
303
  end
308
304
  if post = postscripts
309
- list.push post
305
+ list.push(post)
310
306
  end
311
307
  list
312
308
  end
@@ -324,7 +320,7 @@ module ReVIEW
324
320
  chap = Chapter.new(self, num += 1, chap, File.join(contentdir, chap))
325
321
  chap
326
322
  end
327
- Part.new(self, part += 1, chaps, read_part.split("\n")[part - 1])
323
+ Part.new(self, part += 1, chaps, read_part[part - 1])
328
324
  else
329
325
  chap = Chapter.new(self, num += 1, entry, File.join(contentdir, entry))
330
326
  if chap.number
@@ -337,12 +333,11 @@ module ReVIEW
337
333
  end
338
334
  end
339
335
 
340
- chap = read_chaps.
341
- strip.lines.map(&:strip).join("\n").split(/\n{2,}/).
336
+ chap = read_chaps.map(&:strip).join("\n").split(/\n{2,}/).
342
337
  map do |part_chunk|
343
338
  chaps = part_chunk.split.map { |chapid| Chapter.new(self, num += 1, chapid, File.join(contentdir, chapid)) }
344
- if part_exist? && read_part.split("\n").size > part
345
- Part.new(self, part += 1, chaps, read_part.split("\n")[part - 1])
339
+ if part_exist? && read_part.size > part
340
+ Part.new(self, part += 1, chaps, read_part[part - 1])
346
341
  else
347
342
  Part.new(self, nil, chaps)
348
343
  end
@@ -350,42 +345,6 @@ module ReVIEW
350
345
  chap
351
346
  end
352
347
 
353
- def mkpart_from_namelistfile(path)
354
- chaps = []
355
- File.read(path, mode: 'r:BOM|utf-8').split.each_with_index do |name, idx|
356
- if path =~ /PREDEF/
357
- chaps << mkchap(name)
358
- else
359
- chaps << mkchap(name, idx + 1)
360
- end
361
- end
362
- mkpart(chaps)
363
- end
364
-
365
- def mkpart_from_namelist(names)
366
- mkpart(names.map { |n| mkchap_ifexist(n) }.compact)
367
- end
368
-
369
- def mkpart(chaps)
370
- chaps.empty? ? nil : Part.new(self, nil, chaps)
371
- end
372
-
373
- def mkchap(name, number = nil)
374
- name += ext if File.extname(name).empty?
375
- path = File.join(contentdir, name)
376
- raise FileNotFound, "file not exist: #{path}" unless File.file?(path)
377
- Chapter.new(self, number, name, path)
378
- end
379
-
380
- def mkchap_ifexist(name, idx = nil)
381
- name += ext if File.extname(name).empty?
382
- path = File.join(contentdir, name)
383
- if File.file?(path)
384
- idx += 1 if idx
385
- Chapter.new(self, idx, name, path)
386
- end
387
- end
388
-
389
348
  def read_file(filename)
390
349
  unless @warn_old_files[filename]
391
350
  @warn_old_files[filename] = true
@@ -394,9 +353,9 @@ module ReVIEW
394
353
  end
395
354
  end
396
355
  res = ''
397
- File.open(filename_join(@basedir, filename), 'r:BOM|utf-8') do |f|
356
+ File.open(filename_join(@basedir, filename), 'rt:BOM|utf-8') do |f|
398
357
  f.each_line do |line|
399
- next if /\A#/ =~ line
358
+ next if line.start_with?('#')
400
359
  line.gsub!(/#.*\Z/, '')
401
360
  res << line
402
361
  end