review 3.0.0.preview4 → 3.0.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (91) hide show
  1. checksums.yaml +4 -4
  2. data/NEWS.ja.md +61 -4
  3. data/NEWS.md +61 -4
  4. data/README.md +2 -1
  5. data/doc/config.yml.sample +48 -20
  6. data/doc/config.yml.sample-simple +7 -6
  7. data/doc/format_idg.ja.md +6 -2
  8. data/doc/pdfmaker.ja.md +95 -4
  9. data/doc/pdfmaker.md +79 -0
  10. data/doc/quickstart.ja.md +26 -3
  11. data/doc/quickstart.md +25 -3
  12. data/doc/writing_vertical.ja.md +19 -2
  13. data/lib/review/epubmaker.rb +27 -27
  14. data/lib/review/i18n.yml +1 -0
  15. data/lib/review/init.rb +34 -22
  16. data/lib/review/latexbuilder.rb +95 -18
  17. data/lib/review/pdfmaker.rb +1 -0
  18. data/lib/review/update.rb +60 -25
  19. data/lib/review/version.rb +1 -1
  20. data/review.gemspec +1 -1
  21. data/samples/sample-book/src/config.yml +3 -3
  22. data/samples/syntax-book/config.yml +3 -3
  23. data/templates/latex/config.erb +3 -0
  24. data/templates/latex/review-jlreq/README.md +97 -7
  25. data/templates/latex/review-jlreq/review-base.sty +8 -0
  26. data/templates/latex/review-jlreq/review-jlreq.cls +28 -6
  27. data/templates/latex/review-jsbook/README.md +18 -20
  28. data/templates/latex/review-jsbook/review-base.sty +15 -0
  29. data/templates/latex/review-jsbook/review-jsbook.cls +172 -230
  30. data/test/test_epubmaker_cmd.rb +1 -1
  31. data/test/test_helper.rb +3 -3
  32. data/test/test_image_finder.rb +9 -9
  33. data/test/test_latexbuilder.rb +20 -1
  34. data/test/test_makerhelper.rb +12 -12
  35. data/test/test_pdfmaker_cmd.rb +1 -1
  36. data/test/test_update.rb +18 -4
  37. data/test/test_zip_exporter.rb +7 -7
  38. data/vendor/jsclasses/.gitignore +163 -0
  39. data/vendor/jsclasses/LICENSE +25 -0
  40. data/vendor/jsclasses/Makefile +88 -0
  41. data/vendor/jsclasses/README.md +43 -0
  42. data/vendor/jsclasses/create_archive.sh +59 -0
  43. data/vendor/jsclasses/jis/Makefile +62 -0
  44. data/vendor/jsclasses/jis/jsarticle.cls +1935 -0
  45. data/vendor/jsclasses/jis/jsbook.cls +2026 -0
  46. data/vendor/jsclasses/jis/jsclasses.dtx +5961 -0
  47. data/vendor/jsclasses/jis/jsclasses.ins +8 -0
  48. data/vendor/jsclasses/jis/jslogo.dtx +413 -0
  49. data/vendor/jsclasses/jis/jslogo.ins +4 -0
  50. data/vendor/jsclasses/jis/jslogo.sty +223 -0
  51. data/vendor/jsclasses/jis/jspf.cls +1766 -0
  52. data/vendor/jsclasses/jis/jsreport.cls +2020 -0
  53. data/vendor/jsclasses/jis/jsverb.dtx +322 -0
  54. data/vendor/jsclasses/jis/jsverb.ins +4 -0
  55. data/vendor/jsclasses/jis/jsverb.sty +128 -0
  56. data/vendor/jsclasses/jis/kiyou.cls +1882 -0
  57. data/vendor/jsclasses/jis/minijs.sty +52 -0
  58. data/vendor/jsclasses/jis/okumacro.dtx +1179 -0
  59. data/vendor/jsclasses/jis/okumacro.ins +4 -0
  60. data/vendor/jsclasses/jis/okumacro.sty +455 -0
  61. data/vendor/jsclasses/jis/okuverb.dtx +243 -0
  62. data/vendor/jsclasses/jis/okuverb.ins +4 -0
  63. data/vendor/jsclasses/jis/okuverb.sty +102 -0
  64. data/vendor/jsclasses/jis/winjis.sty +87 -0
  65. data/vendor/jsclasses/jsarticle.cls +1938 -0
  66. data/vendor/jsclasses/jsbook.cls +2029 -0
  67. data/vendor/jsclasses/jsclasses.dtx +5966 -0
  68. data/vendor/jsclasses/jsclasses.ins +8 -0
  69. data/vendor/jsclasses/jsclasses.pdf +0 -0
  70. data/vendor/jsclasses/jslogo.dtx +424 -0
  71. data/vendor/jsclasses/jslogo.ins +4 -0
  72. data/vendor/jsclasses/jslogo.pdf +0 -0
  73. data/vendor/jsclasses/jslogo.sty +223 -0
  74. data/vendor/jsclasses/jspf.cls +1769 -0
  75. data/vendor/jsclasses/jsreport.cls +2023 -0
  76. data/vendor/jsclasses/jsverb.dtx +333 -0
  77. data/vendor/jsclasses/jsverb.ins +4 -0
  78. data/vendor/jsclasses/jsverb.pdf +0 -0
  79. data/vendor/jsclasses/jsverb.sty +128 -0
  80. data/vendor/jsclasses/kiyou.cls +1885 -0
  81. data/vendor/jsclasses/minijs.sty +52 -0
  82. data/vendor/jsclasses/okumacro.dtx +1184 -0
  83. data/vendor/jsclasses/okumacro.ins +4 -0
  84. data/vendor/jsclasses/okumacro.pdf +0 -0
  85. data/vendor/jsclasses/okumacro.sty +458 -0
  86. data/vendor/jsclasses/okuverb.dtx +254 -0
  87. data/vendor/jsclasses/okuverb.ins +4 -0
  88. data/vendor/jsclasses/okuverb.pdf +0 -0
  89. data/vendor/jsclasses/okuverb.sty +102 -0
  90. data/vendor/jsclasses/winjis.sty +87 -0
  91. metadata +55 -2
data/doc/pdfmaker.md CHANGED
@@ -4,6 +4,85 @@ The command `review-pdfmaker` in Re:VIEW use [LaTeX](https://en.wikipedia.org/wi
4
4
 
5
5
  To use the command, you need to set up LaTeX system.
6
6
 
7
+ ## About new layout file and review-jsbook.cls
8
+
9
+ Since Re:VIEW 3.0, review-jsbook.cls becomes the default class file.
10
+
11
+ If `texdocumentclass` isn't specified, the layout file is switched based on the value of review_version in config.yml. If `review_version` is 2.0, older layout files and jsbook.cls are used for compatibility.
12
+
13
+ ### Changes in layout file `layout.tex.erb`
14
+
15
+ The new layout file `layout.tex.erb` is incompatible with the Re:VIEW 2 version's.
16
+
17
+ The values of config.yml are converted to a TeX macro, and they are used for class files and style files. This makes it easier (although knowledge of TeX is necessary) to use another compiler other than upLaTeX, or to create your own class files and style files.
18
+
19
+ Conversion from config.yml to TeX macro is executed in `templates/latex/config.erb` of Re:VIEW. As a result, the embedded code of Ruby in `layout.tex.erb` exists only in the following preamble.
20
+
21
+ ```
22
+ \documentclass[<%= @documentclassoption %>]{<%= @documentclass %>}
23
+ <%= latex_config %>
24
+ <%- if @config['texstyle'] -%>
25
+ <%- [@config['texstyle']].flatten.each do |x| -%>
26
+ \usepackage{<%= x %>}
27
+ <%- end -%>
28
+ <%- end -%>
29
+
30
+ \begin{document}
31
+
32
+ ```
33
+
34
+ In the new `layout.tex.erb`, content is constructed by defining or changing the following macros.
35
+
36
+ * `\reviewbegindocumenthook` : hook begining the document
37
+ * `\reviewcoverpagecont` : cover contents
38
+ * `\reviewfrontmatterhook` : hook before frontmatter
39
+ * `\reviewtitlepagecont` : titlepage contents
40
+ * `\revieworiginaltitlepagecont` : original titlepage contents (in the case of a translation)
41
+ * `\reviewcreditfilecont` : credit contents
42
+ * `\reviewprefacefiles` : frontmatter contents (PREDEF)
43
+ * `\reviewtableofcontents` : table of contents
44
+ * `\reviewmainmatterhook` : hook before mainmatter
45
+ * `\reviewchapterfiles` : mainmatter contents (CHAPS)
46
+ * `\reviewappendixhook` : hook before appendix
47
+ * `\reviewappendixfiles` : appendix contents (APPENDIX)
48
+ * `\reviewbackmatterhook` : hook before backmatter
49
+ * `\reviewpostdeffiles` : backmatter contents (POSTDEF)
50
+ * `\reviewprintindex` : index
51
+ * `\reviewprofilepagecont` : profile contents
52
+ * `\reviewadvfilepagecont` : advertisement contents
53
+ * `\reviewcolophonpagecont` : colophon contents
54
+ * `\reviewbackcovercont` : backcover contents
55
+ * `\reviewenddocumenthook` : hook before ending the document
56
+
57
+ It is also possible to continue using your `layouts/layout.tex.erb`.
58
+
59
+ ### structure of review-jsbook.cls set
60
+
61
+ When creating a new document folder with the `review-init` command, the following files are created in `sty` folder.
62
+
63
+ * `review-jsbook.cls` : provides a basic design of paper representation.
64
+ * `jsbook.cls` : is a copy of the upstream jsbook. To avoid differences in version on TeX distribution, Re:VIEW provides a snapshot of `jsbook.cls`.
65
+ * `plistings.sty` : provides highlight expressions of program code.
66
+ * `jumoline.sty` : expresses underlining.
67
+ * `gentombow.sty` : makes bleed box.
68
+ * `reviewmacro.sty` : imports the following style file. By specifying this file with `texstyle` parameter of config.yml, all style files are imported.
69
+ * `review-base.sty` : associates Re:VIEW macro name and TeX macro. Also defines the entity of each macros of `layout.tex.erb`.
70
+ * `review-style.sty` :defines visual decorations.
71
+ * `review-custom.sty` : is empty file. It is assumed that the user adds macros or overwrites existing macros arbitrarily.
72
+
73
+ Default value of texdocumentclass are as follows.
74
+
75
+ ```
76
+ texdocumentclass: ["review-jsbook", "media=print,paper=a4,cover=false"]
77
+
78
+ texdocumentclass: ["review-jsbook", ""] (same effort)
79
+ ```
80
+
81
+ ### About review-jlreq.cls
82
+
83
+ Since Re:VIEW 3.0, review-jlreq.cls is also provided. This class file extends jlreq.cls which makes paper design based on "Requirements for Japanese Text Layout" ( https://www.w3.org/TR/2012/NOTE-jlreq-20120403/ ).
84
+
85
+ `review-init --latex-template=review-jlreq` command copies the review-jlreq.cls set to `sty` folder.
7
86
 
8
87
  ## Important Changes about LaTeX in Re:VIEW 2.0
9
88
 
data/doc/quickstart.ja.md CHANGED
@@ -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 2.0 に基づいています。
11
+ このドキュメントは、Re:VIEW 3.0 に基づいています。
12
12
 
13
13
  ## セットアップ
14
14
 
15
- Re:VIEW は Ruby 言語で記述されており、Linux/Unix 互換システムで動作します。Mac OS X および Windows Cygwin でも動作可能です。Ruby gem あるいは Git のいずれかを使ってダウンロード・展開します。
15
+ Re:VIEW は Ruby 言語で記述されており、Linux/Unix 互換システムで動作します。macOS および Windows Cygwin でも動作可能です。Ruby gem あるいは Git のいずれかを使ってダウンロード・展開します。
16
16
 
17
17
  なお、Re:VIEW フォーマット自体は文字で表現されたタグが付いている以外は単なるテキストファイルなので、エディタ、OS については UTF-8 文字エンコーディングさえ使用できれば制限はありません。
18
18
 
@@ -77,6 +77,8 @@ $ review-init ドキュメント名
77
77
  * layouts : レイアウトファイルの配置フォルダ
78
78
  * style.css : サンプルスタイルシート
79
79
  * sty : スタイルファイル配置フォルダ(TeX 用)
80
+ * doc : 本ドキュメントを含む使い方のドキュメント
81
+ * lib : 主に rake コマンドの詳細ルールファイル
80
82
 
81
83
  review-init コマンドによらず、独自に作業フォルダを作成してもかまいません。
82
84
 
@@ -204,9 +206,30 @@ $ review-vol
204
206
  $ review-index --level 掘り下げる見出しレベル数 -a
205
207
  ```
206
208
 
209
+ ## ドキュメントフォルダを新しい Re:VIEW バージョンに追従する方法
210
+
211
+ Re:VIEW は定期的に更新されています。おおむね後方互換性を保持していますが、新しいバージョン固有の機能を利用したいときには、ドキュメントフォルダを新しいバージョンに更新する review-update コマンドを利用します。
212
+
213
+ ```bash
214
+ $ review-update
215
+ ** review-update はプロジェクトを 3.0.0 に更新します **
216
+ config.yml: 'review_version' を '3.0' に更新しますか? [y]/n ←Enterで実行
217
+ Rakefile は Re:VIEW バージョンのもの (/.../review/samples/sample-book/src/Rakefile) で置き換えられます。本当に進めますか? [y]/n
218
+ lib/tasks/review.rake は Re:VIEW バージョンのもの (/.../review/samples/sample-book/src/lib/tasks/review.rake) で置き換えられます。本当に進めますか? [y]/n
219
+ INFO: 新しいファイル /.../sty/plistings.sty が作成されました。
220
+ /.../sty/reviewmacro.sty は Re:VIEW バージョンのもの (/.../review/templates/latex/review-jsbook/reviewmacro.sty) で置き換えられます。本当に進めますか? [y]/n
221
+ INFO: 新しいファイル /.../sty/README.md が作成されました。
222
+ INFO: 新しいファイル /.../sty/review-custom.sty が作成されました。
223
+ INFO: 新しいファイル /.../sty/review-jsbook.cls が作成されました。
224
+ INFO: 新しいファイル /.../sty/review-style.sty が作成されました。
225
+ INFO: 新しいファイル /.../sty/review-base.sty が作成されました。
226
+ INFO: 新しいファイル /.../sty/gentombow09j.sty が作成されました。
227
+ 完了しました。
228
+ ```
229
+
207
230
  ## クレジット
208
231
 
209
- Re:VIEW は、青木峰郎によって最初に作成されました。武藤健志がこの開発・保守を引き継ぎ、2018年9月時点では、武藤健志、高橋征義、角征典が開発・保守を継続しています。
232
+ Re:VIEW は、青木峰郎によって最初に作成されました。武藤健志がこの開発・保守を引き継ぎ、2018年11月時点では、武藤健志、高橋征義、角征典が開発・保守を継続しています。
210
233
 
211
234
  バグ・パッチの報告、開発者用メーリングリストなどについての情報は、
212
235
 
data/doc/quickstart.md CHANGED
@@ -9,11 +9,11 @@ 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 2.0.
12
+ The supported version of the article is Re:VIEW 3.0.
13
13
 
14
14
  ## Set up Re:VIEW
15
15
 
16
- Re:VIEW is a software in Ruby and worked in Linux/Unix, Mac OS X, and Windows. You can install Re:VIEW with RubyGems or Git.
16
+ Re:VIEW is a software in Ruby and worked in Linux/Unix, macOS, and Windows. You can install Re:VIEW with RubyGems or Git.
17
17
 
18
18
  Note that Re:VIEW format is plain texts with simple markups in UTF-8, so you can write it on any editors and OSes.
19
19
 
@@ -82,7 +82,8 @@ In `hello` directory, many files are generated.
82
82
  * layouts : forlder for layout files
83
83
  * style.css : sample stylesheet
84
84
  * sty : style files for LaTeX
85
-
85
+ * doc : various documents (including this document)
86
+ * lib : detailed rule files of rake command and etc.
86
87
 
87
88
  ### writing Re:VIEW documents and converting them
88
89
 
@@ -207,6 +208,27 @@ You can also use `review-index` command to generate header list.
207
208
  $ review-index --level <heading level> -a
208
209
  ```
209
210
 
211
+ ## how to update the document folder to the new Re:VIEW version
212
+
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.
214
+
215
+ ```bash
216
+ $ review-update
217
+ ** review-update updates your project to 3.0.0 **
218
+ config.yml: Update 'review_version' to '3.0'? [y]/n
219
+ Rakefile will be overridden with Re:VIEW version (/.../review/samples/sample-book/src/Rakefile). Do you really proceed? [y]/n
220
+ 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
+ INFO: new file /.../sty/plistings.sty is created.
222
+ /.../sty/reviewmacro.sty will be overridden with Re:VIEW version (/.../review/templates/latex/review-jsbook/reviewmacro.sty). Do you really proceed? [y]/n
223
+ INFO: new file /.../sty/README.md is created.
224
+ INFO: new file /.../sty/review-custom.sty is created.
225
+ INFO: new file /.../sty/review-jsbook.cls is created.
226
+ INFO: new file /.../sty/review-style.sty is created.
227
+ INFO: new file /.../sty/review-base.sty is created.
228
+ INFO: new file /.../sty/gentombow09j.sty is created.
229
+ Finished.
230
+ ```
231
+
210
232
  ## Copyright
211
233
 
212
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).
@@ -2,7 +2,7 @@
2
2
 
3
3
  Re:VIEW 2.0 より、縦書きの実験的なサポートを含めています。このドキュメントでその利用方法を説明します。
4
4
 
5
- このドキュメントは、Re:VIEW 2.0 に基づいています。
5
+ このドキュメントは、Re:VIEW 3.0 に基づいています。
6
6
 
7
7
  ## Re:VIEW フォーマットテキストファイルでの利用
8
8
  縦書きのドキュメントをサポートするため、次のような機能を提供します。
@@ -52,4 +52,21 @@ review-pdfmaker のバックエンドとなっている TeX で縦書きを利
52
52
  texdocumentclass: ["utbook", "oneside"]
53
53
  ```
54
54
 
55
- utbook クラスは uplatex に合わせた縦書きの紙面デザインを提供します(platex を使用する場合は tbook クラスを使います)。マクロや追加パッケージが縦書きに対応していない場合、エラーあるいは予想外の結果になることがあります。
55
+ utbook クラスは upLaTeX に合わせた縦書きの紙面デザインを提供します。マクロや追加パッケージが縦書きに対応していない場合、エラーあるいは予想外の結果になることがあります。
56
+
57
+ また、表紙・大扉・奥付のように主題とまったく異なる紙面表現の箇所は、TeX のマクロで表現しようとするよりも、Adobe InDesign や Microsoft Word などの別のツールを使って作成した原寸の PDF を用意し、それを貼り付けたほうが思いどおりの結果になるでしょう。`review-custom.sty` に記述する例を以下に示します(各 PDF は `images` フォルダに置いているものとします)。
58
+
59
+ ```
60
+ % 縦書きのため各貼り付けPDFは90度回転させる
61
+ \def\reviewcoverpagecont{% 表紙
62
+ \includefullpagegraphics[angle=90]{images/cover.pdf}
63
+ }
64
+
65
+ \def\reviewtitlepagecont{% 大扉
66
+ \includefullpagegraphics[angle=90]{images/titlepage.pdf}
67
+ }
68
+
69
+ \def\reviewcolophonpagecont{% 奥付
70
+ \includefullpagegraphics[angle=90]{images/colophon.pdf}
71
+ }
72
+ ```
@@ -127,7 +127,7 @@ module ReVIEW
127
127
  copy_backmatter(basetmpdir)
128
128
 
129
129
  math_dir = "./#{@config['imagedir']}/_review_math"
130
- if @config['imgmath'] && File.exist?("#{math_dir}/__IMGMATH_BODY__.tex")
130
+ if @config['imgmath'] && File.exist?(File.join(math_dir, '__IMGMATH_BODY__.tex'))
131
131
  make_math_images(math_dir)
132
132
  end
133
133
  call_hook('hook_afterbackmatter', basetmpdir)
@@ -139,23 +139,23 @@ module ReVIEW
139
139
  verify_target_images(basetmpdir)
140
140
  copy_images(@config['imagedir'], basetmpdir)
141
141
  else
142
- copy_images(@config['imagedir'], "#{basetmpdir}/#{@config['imagedir']}")
142
+ copy_images(@config['imagedir'], File.join(basetmpdir, @config['imagedir']))
143
143
  end
144
144
 
145
- copy_resources('covers', "#{basetmpdir}/#{@config['imagedir']}")
146
- copy_resources('adv', "#{basetmpdir}/#{@config['imagedir']}")
147
- copy_resources(@config['fontdir'], "#{basetmpdir}/fonts", @config['font_ext'])
145
+ copy_resources('covers', File.join(basetmpdir, @config['imagedir']))
146
+ copy_resources('adv', File.join(basetmpdir, @config['imagedir']))
147
+ copy_resources(@config['fontdir'], File.join(basetmpdir, 'fonts'), @config['font_ext'])
148
148
 
149
149
  call_hook('hook_aftercopyimage', basetmpdir)
150
150
 
151
- @producer.import_imageinfo("#{basetmpdir}/#{@config['imagedir']}", basetmpdir)
152
- @producer.import_imageinfo("#{basetmpdir}/fonts", basetmpdir, @config['font_ext'])
151
+ @producer.import_imageinfo(File.join(basetmpdir, @config['imagedir']), basetmpdir)
152
+ @producer.import_imageinfo(File.join(basetmpdir, 'fonts'), basetmpdir, @config['font_ext'])
153
153
 
154
154
  check_image_size(basetmpdir, @config['image_maxpixels'], @config['image_ext'])
155
155
 
156
156
  epubtmpdir = nil
157
157
  if @config['debug'].present?
158
- epubtmpdir = "#{basetmpdir}/#{booktmpname}"
158
+ epubtmpdir = File.join(basetmpdir, booktmpname)
159
159
  Dir.mkdir(epubtmpdir)
160
160
  end
161
161
  log('Call ePUB producer.')
@@ -194,7 +194,7 @@ module ReVIEW
194
194
  end
195
195
  end
196
196
  when 'text/css'
197
- File.open("#{basetmpdir}/#{content.file}") do |f|
197
+ File.open(File.join(basetmpdir, content.file)) do |f|
198
198
  f.each_line do |l|
199
199
  l.scan(/url\((.+?)\)/) do |_m|
200
200
  @config['epubmaker']['force_include_images'].push($1.strip)
@@ -219,9 +219,9 @@ module ReVIEW
219
219
  next
220
220
  end
221
221
  basedir = File.dirname(file)
222
- FileUtils.mkdir_p("#{destdir}/#{basedir}")
222
+ FileUtils.mkdir_p(File.join(destdir, basedir))
223
223
  log("Copy #{file} to the temporary directory.")
224
- FileUtils.cp(file, "#{destdir}/#{basedir}")
224
+ FileUtils.cp(file, File.join(destdir, basedir))
225
225
  end
226
226
  else
227
227
  recursive_copy_files(resdir, destdir, allow_exts)
@@ -239,12 +239,12 @@ module ReVIEW
239
239
  Dir.open(resdir) do |dir|
240
240
  dir.each do |fname|
241
241
  next if fname.start_with?('.')
242
- if FileTest.directory?("#{resdir}/#{fname}")
243
- recursive_copy_files("#{resdir}/#{fname}", "#{destdir}/#{fname}", allow_exts)
242
+ if FileTest.directory?(File.join(resdir, fname))
243
+ recursive_copy_files(File.join(resdir, fname), File.join(destdir, fname), allow_exts)
244
244
  elsif fname =~ /\.(#{allow_exts.join('|')})\Z/i
245
245
  FileUtils.mkdir_p(destdir)
246
246
  log("Copy #{resdir}/#{fname} to the temporary directory.")
247
- FileUtils.cp("#{resdir}/#{fname}", destdir)
247
+ FileUtils.cp(File.join(resdir, fname), destdir)
248
248
  end
249
249
  end
250
250
  end
@@ -298,7 +298,7 @@ module ReVIEW
298
298
 
299
299
  def build_part(part, basetmpdir, htmlfile)
300
300
  log("Create #{htmlfile} from a template.")
301
- File.open("#{basetmpdir}/#{htmlfile}", 'w') do |f|
301
+ File.open(File.join(basetmpdir, htmlfile), 'w') do |f|
302
302
  @body = ''
303
303
  @body << %Q(<div class="part">\n)
304
304
  @body << %Q(<h1 class="part-number">#{CGI.escapeHTML(ReVIEW::I18n.t('part', part.number))}</h1>\n)
@@ -377,7 +377,7 @@ module ReVIEW
377
377
  end
378
378
 
379
379
  def remove_hidden_title(basetmpdir, htmlfile)
380
- File.open("#{basetmpdir}/#{htmlfile}", 'r+') do |f|
380
+ File.open(File.join(basetmpdir, htmlfile), 'r+') do |f|
381
381
  body = f.read.
382
382
  gsub(%r{<h\d .*?hidden=['"]true['"].*?>.*?</h\d>\n}, '').
383
383
  gsub(%r{(<h\d .*?)\s*notoc=['"]true['"]\s*(.*?>.*?</h\d>\n)}, '\1\2')
@@ -469,7 +469,7 @@ module ReVIEW
469
469
  def copy_frontmatter(basetmpdir)
470
470
  if @config['cover'].present? && File.exist?(@config['cover'])
471
471
  FileUtils.cp(@config['cover'],
472
- "#{basetmpdir}/#{File.basename(@config['cover'])}")
472
+ File.join(basetmpdir, File.basename(@config['cover'])))
473
473
  end
474
474
 
475
475
  if @config['titlepage']
@@ -477,7 +477,7 @@ module ReVIEW
477
477
  build_titlepage(basetmpdir, "titlepage.#{@config['htmlext']}")
478
478
  else
479
479
  FileUtils.cp(@config['titlefile'],
480
- "#{basetmpdir}/titlepage.#{@config['htmlext']}")
480
+ File.join(basetmpdir, "titlepage.#{@config['htmlext']}"))
481
481
  end
482
482
  @htmltoc.add_item(1,
483
483
  "titlepage.#{@config['htmlext']}",
@@ -487,7 +487,7 @@ module ReVIEW
487
487
 
488
488
  if @config['originaltitlefile'].present? && File.exist?(@config['originaltitlefile'])
489
489
  FileUtils.cp(@config['originaltitlefile'],
490
- "#{basetmpdir}/#{File.basename(@config['originaltitlefile'])}")
490
+ File.join(basetmpdir, File.basename(@config['originaltitlefile'])))
491
491
  @htmltoc.add_item(1,
492
492
  File.basename(@config['originaltitlefile']),
493
493
  @producer.res.v('originaltitle'),
@@ -496,7 +496,7 @@ module ReVIEW
496
496
 
497
497
  if @config['creditfile'].present? && File.exist?(@config['creditfile'])
498
498
  FileUtils.cp(@config['creditfile'],
499
- "#{basetmpdir}/#{File.basename(@config['creditfile'])}")
499
+ File.join(basetmpdir, File.basename(@config['creditfile'])))
500
500
  @htmltoc.add_item(1,
501
501
  File.basename(@config['creditfile']),
502
502
  @producer.res.v('credittitle'),
@@ -509,7 +509,7 @@ module ReVIEW
509
509
  def build_titlepage(basetmpdir, htmlfile)
510
510
  # TODO: should be created via epubcommon
511
511
  @title = CGI.escapeHTML(@config.name_of('booktitle'))
512
- File.open("#{basetmpdir}/#{htmlfile}", 'w') do |f|
512
+ File.open(File.join(basetmpdir, htmlfile), 'w') do |f|
513
513
  @body = ''
514
514
  @body << %Q(<div class="titlepage">\n)
515
515
  @body << %Q(<h1 class="tp-title">#{CGI.escapeHTML(@config.name_of('booktitle'))}</h1>\n)
@@ -535,7 +535,7 @@ module ReVIEW
535
535
  def copy_backmatter(basetmpdir)
536
536
  if @config['profile']
537
537
  FileUtils.cp(@config['profile'],
538
- "#{basetmpdir}/#{File.basename(@config['profile'])}")
538
+ File.join(basetmpdir, File.basename(@config['profile'])))
539
539
  @htmltoc.add_item(1,
540
540
  File.basename(@config['profile']),
541
541
  @producer.res.v('profiletitle'),
@@ -544,7 +544,7 @@ module ReVIEW
544
544
 
545
545
  if @config['advfile']
546
546
  FileUtils.cp(@config['advfile'],
547
- "#{basetmpdir}/#{File.basename(@config['advfile'])}")
547
+ File.join(basetmpdir, File.basename(@config['advfile'])))
548
548
  @htmltoc.add_item(1,
549
549
  File.basename(@config['advfile']),
550
550
  @producer.res.v('advtitle'),
@@ -554,9 +554,9 @@ module ReVIEW
554
554
  if @config['colophon']
555
555
  if @config['colophon'].is_a?(String) # FIXME: should let obsolete this style?
556
556
  FileUtils.cp(@config['colophon'],
557
- "#{basetmpdir}/colophon.#{@config['htmlext']}")
557
+ File.join(basetmpdir, "colophon.#{@config['htmlext']}"))
558
558
  else
559
- filename = "#{basetmpdir}/colophon.#{@config['htmlext']}"
559
+ filename = File.join(basetmpdir, "colophon.#{@config['htmlext']}")
560
560
  File.open(filename, 'w') do |f|
561
561
  @producer.colophon(f)
562
562
  end
@@ -569,7 +569,7 @@ module ReVIEW
569
569
 
570
570
  if @config['backcover']
571
571
  FileUtils.cp(@config['backcover'],
572
- "#{basetmpdir}/#{File.basename(@config['backcover'])}")
572
+ File.join(basetmpdir, File.basename(@config['backcover'])))
573
573
  @htmltoc.add_item(1,
574
574
  File.basename(@config['backcover']),
575
575
  @producer.res.v('backcovertitle'),
@@ -580,7 +580,7 @@ module ReVIEW
580
580
  end
581
581
 
582
582
  def write_buildlogtxt(basetmpdir, htmlfile, reviewfile)
583
- File.open("#{basetmpdir}/#{@buildlogtxt}", 'a') do |f|
583
+ File.open(File.join(basetmpdir, @buildlogtxt), 'a') do |f|
584
584
  f.puts "#{htmlfile},#{reviewfile}"
585
585
  end
586
586
  end
data/lib/review/i18n.yml CHANGED
@@ -81,6 +81,7 @@ ja:
81
81
  "%s: 'texcommand' has options ('%s'). Move it to 'texoptions'?": "%s: 'texcommand' にオプションがあります ('%s')。'texoptions' に移動しますか?"
82
82
  "%s: 'dvicommand' has options ('%s'). Move it to 'dvioptions'?": "%s: 'dvicommand' にオプションがあります ('%s')。'dvioptions' に移動しますか?"
83
83
  "Finished.": "完了しました。"
84
+ "new file %s is created.": "新しいファイル %s が作成されました。"
84
85
 
85
86
  en:
86
87
  image: "Figure "
data/lib/review/init.rb CHANGED
@@ -18,6 +18,11 @@ module ReVIEW
18
18
  new.execute(*args)
19
19
  end
20
20
 
21
+ TEX_DOCUMENTCLASS_OPTS = {
22
+ 'review-jsbook' => 'media=print,paper=a5',
23
+ 'review-jlreq' => 'media=print,paper=a5'
24
+ }
25
+
21
26
  def initialize
22
27
  @template = 'review-jsbook'
23
28
  @logger = ReVIEW.logger
@@ -100,16 +105,16 @@ module ReVIEW
100
105
 
101
106
  def generate_sample(dir)
102
107
  unless @force
103
- File.write("#{dir}/#{File.basename(dir)}.re", '= ')
108
+ File.write(File.join(dir, "#{File.basename(dir)}.re"), '= ')
104
109
  end
105
110
  end
106
111
 
107
112
  def generate_layout(dir)
108
- FileUtils.mkdir_p dir + '/layouts'
113
+ FileUtils.mkdir_p File.join(dir, 'layouts')
109
114
  end
110
115
 
111
116
  def generate_catalog_file(dir)
112
- File.open(dir + '/catalog.yml', 'w') do |file|
117
+ File.open(File.join(dir, 'catalog.yml'), 'w') do |file|
113
118
  file.write <<-EOS
114
119
  PREDEF:
115
120
 
@@ -125,19 +130,19 @@ EOS
125
130
  end
126
131
 
127
132
  def generate_images_dir(dir)
128
- FileUtils.mkdir_p(dir + '/images')
133
+ FileUtils.mkdir_p(File.join(dir, 'images'))
129
134
  end
130
135
 
131
136
  def generate_cover_image(dir)
132
- FileUtils.cp(@review_dir + '/samples/sample-book/src/images/cover.jpg',
133
- dir + '/images/')
134
- FileUtils.cp(@review_dir + '/samples/sample-book/src/images/cover-a5.ai',
135
- dir + '/images/')
137
+ FileUtils.cp(File.join(@review_dir, 'samples/sample-book/src/images/cover.jpg'),
138
+ File.join(dir, 'images'))
139
+ FileUtils.cp(File.join(@review_dir, 'samples/sample-book/src/images/cover-a5.ai'),
140
+ File.join(dir, 'images'))
136
141
  end
137
142
 
138
143
  def generate_config(dir)
139
144
  today = Time.now.strftime('%Y-%m-%d')
140
- content = File.read(@review_dir + '/doc/config.yml.sample', encoding: 'utf-8')
145
+ content = File.read(File.join(@review_dir, 'doc/config.yml.sample'), encoding: 'utf-8')
141
146
  content.gsub!(/^#\s*coverimage:.*$/, 'coverimage: cover.jpg')
142
147
  content.gsub!(/^ #\s*coverimage:.*$/, ' coverimage: cover-a5.ai')
143
148
  content.gsub!(/^#\s*date:.*$/, "date: #{today}")
@@ -148,27 +153,34 @@ EOS
148
153
  content.gsub!(/^#.*epubversion:.*$/, 'epubversion: 2')
149
154
  content.gsub!(/^#.*htmlversion:.*$/, 'htmlversion: 4')
150
155
  end
156
+
157
+ if TEX_DOCUMENTCLASS_OPTS[@template]
158
+ content.gsub!(/^#\s*texdocumentclass:.*$/, %Q(texdocumentclass: ["#{@template}", "#{TEX_DOCUMENTCLASS_OPTS[@template]}"]))
159
+ end
160
+
151
161
  File.open(File.join(dir, 'config.yml'), 'w') { |f| f.write(content) }
152
162
  end
153
163
 
154
164
  def generate_style(dir)
155
- FileUtils.cp @review_dir + '/samples/sample-book/src/style.css', dir
165
+ FileUtils.cp File.join(@review_dir, 'samples/sample-book/src/style.css'), dir
156
166
  end
157
167
 
158
168
  def generate_texmacro(dir)
159
- texmacrodir = dir + '/sty'
169
+ texmacrodir = File.join(dir, 'sty')
160
170
  FileUtils.mkdir_p texmacrodir
161
- tdir = File.join(@review_dir, '/templates/latex', @template)
171
+ tdir = File.join(@review_dir, 'templates/latex', @template)
162
172
  @logger.error "#{tdir} not found." unless File.exist?(tdir)
163
- FileUtils.cp Dir.glob(tdir + '/*.*'), texmacrodir
173
+ FileUtils.cp Dir.glob(File.join(tdir, '*.*')), texmacrodir
174
+ # provide jsbook from vendor/. current version is 2018/06/23
175
+ FileUtils.cp File.join(@review_dir, 'vendor/jsclasses/jsbook.cls'), File.join(texmacrodir, 'jsbook.cls')
164
176
  # provide gentombow from vendor/. current version is 2018/08/30 v0.9j
165
- FileUtils.cp File.join(@review_dir, '/vendor/gentombow/gentombow.sty'), File.join(texmacrodir, 'gentombow09j.sty')
177
+ FileUtils.cp File.join(@review_dir, 'vendor/gentombow/gentombow.sty'), File.join(texmacrodir, 'gentombow.sty')
166
178
  end
167
179
 
168
180
  def generate_rakefile(dir)
169
- FileUtils.mkdir_p dir + '/lib/tasks'
181
+ FileUtils.mkdir_p File.join(dir, 'lib/tasks')
170
182
 
171
- File.open(dir + '/Rakefile', 'w') do |file|
183
+ File.open(File.join(dir, 'Rakefile'), 'w') do |file|
172
184
  file.write <<-EOS
173
185
  Dir.glob('lib/tasks/*.rake').sort.each do |file|
174
186
  load(file)
@@ -176,16 +188,16 @@ end
176
188
  EOS
177
189
  end
178
190
 
179
- FileUtils.cp(@review_dir + '/samples/sample-book/src/lib/tasks/review.rake',
180
- dir + '/lib/tasks/review.rake')
191
+ FileUtils.cp(File.join(@review_dir, 'samples/sample-book/src/lib/tasks/review.rake'),
192
+ File.join(dir, 'lib/tasks/review.rake'))
181
193
  end
182
194
 
183
195
  def generate_locale(dir)
184
- FileUtils.cp @review_dir + '/lib/review/i18n.yml', dir + '/locale.yml'
196
+ FileUtils.cp File.join(@review_dir, 'lib/review/i18n.yml'), File.join(dir, 'locale.yml')
185
197
  end
186
198
 
187
199
  def generate_gemfile(dir)
188
- File.open(dir + '/Gemfile', 'w') do |file|
200
+ File.open(File.join(dir, 'Gemfile'), 'w') do |file|
189
201
  file.write <<-EOS
190
202
  source 'https://rubygems.org'
191
203
 
@@ -196,9 +208,9 @@ EOS
196
208
  end
197
209
 
198
210
  def generate_doc(dir)
199
- docdir = dir + '/doc'
211
+ docdir = File.join(dir, 'doc')
200
212
  FileUtils.mkdir_p docdir
201
- md_files = Dir.glob(@review_dir + '/doc/*.md').map.to_a
213
+ md_files = Dir.glob(File.join(@review_dir, 'doc/*.md')).map.to_a
202
214
  FileUtils.cp md_files, docdir
203
215
  end
204
216