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/bin/review-preproc CHANGED
@@ -9,19 +9,20 @@
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/preprocessor'
18
15
  require 'review/version'
19
16
  require 'review/extentions'
20
17
  require 'review/logger'
21
- require 'lineinput'
18
+ require 'review/lineinput'
19
+ require 'review/loggable'
22
20
  require 'stringio'
23
21
  require 'fileutils'
24
22
  require 'optparse'
23
+ require 'tempfile'
24
+
25
+ include ReVIEW::Loggable
25
26
 
26
27
  def sigmain
27
28
  Signal.trap(:INT) { exit 1 }
@@ -33,16 +34,7 @@ rescue Errno::EPIPE
33
34
  exit 0
34
35
  end
35
36
 
36
- def main
37
- @logger = ReVIEW.logger
38
- if File.file?('review-preproc-ext.rb')
39
- if ENV['REVIEW_SAFE_MODE'].to_i & 2 > 0
40
- @logger.warn 'review-preproc-ext.rb is prohibited in safe mode. ignored.'
41
- else
42
- Kernel.load(File.expand_path('review-preproc-ext.rb'))
43
- end
44
- end
45
-
37
+ def parse_options
46
38
  param = {}
47
39
 
48
40
  mode = :output
@@ -60,32 +52,42 @@ def main
60
52
  begin
61
53
  opts.parse!
62
54
  rescue OptionParser::ParseError => e
63
- @logger.error e.message
55
+ error e.message
64
56
  $stderr.puts opts.help
65
57
  exit 1
66
58
  end
67
59
 
68
- pp = ReVIEW::Preprocessor.new(ReVIEW::Repository.new(param), param)
69
- current_file = nil
60
+ [param, mode]
61
+ end
62
+
63
+ def main
64
+ @logger = ReVIEW.logger
65
+ if File.file?('review-preproc-ext.rb')
66
+ if ENV['REVIEW_SAFE_MODE'].to_i & 2 > 0
67
+ warn 'review-preproc-ext.rb is prohibited in safe mode. ignored.'
68
+ else
69
+ Kernel.load(File.expand_path('review-preproc-ext.rb'))
70
+ end
71
+ end
72
+
73
+ param, mode = parse_options
74
+ pp = ReVIEW::Preprocessor.new(param)
70
75
  ARGV.each do |path|
71
- current_file = path
72
76
  case mode
73
77
  when :output
74
- File.open(path) { |f| pp.process(f, $stdout) }
78
+ $stdout.write(pp.process(path))
75
79
  when :replace
76
- File.write("#{path}.pptmp", preproc(pp, path))
77
- File.rename("#{path}.pptmp", path)
80
+ output = pp.process(path)
81
+ File.write(path, output)
78
82
  when :diff, :check
79
- tmp = '/tmp/review.pptmp'
80
- begin
81
- File.write(tmp, preproc(pp, path))
83
+ Tempfile.create('review.pptmp') do |tmp_io|
84
+ tmp = tmp_io.path
85
+ tmp_io.write(pp.process(path))
82
86
  if mode == :check
83
87
  system("diff -qu #{path} #{tmp} >/dev/null || echo #{path}")
84
88
  else
85
89
  system("diff -u #{path} #{tmp}")
86
90
  end
87
- ensure
88
- FileUtils.rm_f(tmp)
89
91
  end
90
92
  else
91
93
  raise "must not happen: #{mode}"
@@ -93,18 +95,8 @@ def main
93
95
  end
94
96
  rescue ReVIEW::Error => e
95
97
  raise if $DEBUG
96
- @logger.error e.message
97
- exit 1
98
- end
99
-
100
- def preproc(pp, path)
101
- buf = StringIO.new
102
- File.open(path) { |f| pp.process(f, buf) }
103
- buf.string
104
- end
105
98
 
106
- def File.write(path, str)
107
- File.open(path, 'w') { |f| f.write str }
99
+ error! e.message
108
100
  end
109
101
 
110
102
  sigmain
data/bin/review-textmaker 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/textmaker'
15
13
 
data/bin/review-update 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/update'
16
13
 
data/bin/review-validate CHANGED
@@ -8,10 +8,9 @@
8
8
  #
9
9
 
10
10
  # simple validator for Re:VIEW
11
- require 'pathname'
12
11
 
13
- bindir = Pathname.new(__FILE__).realpath.dirname
14
- $LOAD_PATH.unshift((bindir + '../lib').realpath)
12
+ $LOAD_PATH.unshift(File.realpath('../lib', __dir__))
13
+
15
14
  require 'review/logger'
16
15
 
17
16
  block = nil
@@ -53,6 +52,7 @@ ARGF.each do |line|
53
52
  end
54
53
  elsif block == 'table'
55
54
  next if line.start_with?('#@')
55
+
56
56
  if line !~ /\A-----/
57
57
  # table
58
58
  colcount = line.split("\t").size
data/bin/review-vol 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/volumeprinter'
18
15
 
data/bin/review-webmaker CHANGED
@@ -6,9 +6,7 @@
6
6
  # For details of the GNU LGPL, see the file "COPYING".
7
7
  #
8
8
 
9
- require 'pathname'
10
- bindir = Pathname.new(__FILE__).realpath.dirname
11
- $LOAD_PATH.unshift((bindir + '../lib').realpath)
9
+ $LOAD_PATH.unshift(File.realpath('../lib', __dir__))
12
10
 
13
11
  require 'review/webmaker'
14
12
 
@@ -87,7 +87,7 @@ aut: ["青木峰郎", "武藤健志", "高橋征義", "角征典"]
87
87
  debug: null
88
88
 
89
89
  # 固有IDに使用するドメイン。指定しない場合には、時刻に基づくランダムUUIDが入る
90
- # urnid: urn:uid:http://example.com/book-title/
90
+ # urnid: urn:uuid:http://example.com/book-title/
91
91
  #
92
92
  # ISBN。省略した場合はurnidが入る
93
93
  # isbn: null
@@ -208,11 +208,14 @@ toc: true
208
208
  # 各数字の意味は、順にリストの行数、リストの1行字数、テキストの行数、テキストの1行字数
209
209
  # page_metric: [40,34,29,34]
210
210
 
211
- # EPUB・Web、およびテキスト生成時における数式の画像化指定
212
- # TeXの数式を画像化するか。省略した場合はnull (作成しない)
213
- # imgmath: true
211
+ # @<m>, //texequation に記述したTeX数式の表現方法 (PDFMaker (LaTeX) 以外)
212
+ # null: TeX式をそのまま文字列として出力 (デフォルト)
213
+ # mathml: MathML変換。別途math_ml gemファイルが必要。EPUBMaker/WebMakerのみ効果
214
+ # imgmath: 画像化。オプションはimgmath_optionsで設定する
215
+ # mathjax: MathJax変換。EPUBMaker/WebMakerのみ効果。なお、MathJaxに必要なデータはインターネットから取得される。EPUBで利用できるかはEPUBリーダ依存
216
+ # math_format: null
214
217
 
215
- # imgmathがtrueの場合の設定
218
+ # math_formatがimgmathの場合の設定
216
219
  # 以下のパラメータを有効にするときには、
217
220
  # imgmath_options:
218
221
  # パラメータ: 値
@@ -338,6 +341,8 @@ epubmaker:
338
341
  #
339
342
  # 脚注に「戻る」リンクを追加する(trueで追加)。脚注の記号および戻るリンクの記号はlocale.ymlで変更可能
340
343
  # back_footnote: null
344
+ # 見出しに応じて<section>で囲むようにする(trueで<section>を利用)
345
+ # use_section: null
341
346
  # epubmaker:階層を使うものはここまで
342
347
 
343
348
  # LaTeX用のスタイルファイル(styディレクトリ以下に置くこと)
@@ -423,4 +428,17 @@ pdfmaker:
423
428
  colophon: true
424
429
  # 表紙挿入時に表紙のページ番号名を「cover」とし、偶数ページ扱いにして大扉前に白ページが入るのを防ぐ。デフォルトはtrue
425
430
  # use_cover_nombre: true
431
+ #
432
+ # 囲み表現の切り替え設定
433
+ # column, note, memo, tip, info, warning, important, caution, noticeを設定可
434
+ # styleはreview-tcbox.styまたは独自に作成したスタイルで定義済みの囲みスタイル名
435
+ # optionsはキャプションなし囲みに対するtcolorboxの追加・上書きオプション
436
+ # options_with_captionはキャプション付き囲みのtcolorboxの追加・上書きオプション(省略した場合はoptionsと同じ)
437
+ #
438
+ # boxsetting:
439
+ # note:
440
+ # style: squarebox
441
+ # options: "colback=black!5!white"
442
+ # options_with_caption: "colbacktitle=black!25!white"
443
+ #
426
444
  # pdfmaker:階層を使うものはここまで
@@ -25,7 +25,7 @@ date: 2018-11-11
25
25
  history: [["2012-01-30"],["2016-04-20","2016-05-03"],["2018-11-11"]]
26
26
  rights: (C) 2016-2020 Re:VIEW Commiters, some rights reserved.
27
27
  description: sample config.yml file for Re:VIEW book
28
- urnid: urn:uid:http://reviewml.org/review-sample-book
28
+ urnid: urn:uuid:http://reviewml.org/review-sample-book
29
29
  # isbn: null
30
30
 
31
31
  ## Book Structure
data/doc/format.ja.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Re:VIEW フォーマットの文法について解説します。Re:VIEW フォーマットはアスキー社(現カドカワ)の EWB を基本としながら、一部に RD や各種 Wiki の文法を取り入れて簡素化しています。
4
4
 
5
- このドキュメントは、Re:VIEW 5.0 に基づいています。
5
+ このドキュメントは、Re:VIEW 5.3 に基づいています。
6
6
 
7
7
  ## 段落
8
8
 
@@ -345,7 +345,7 @@ V1 --> V6 --|
345
345
  ```
346
346
 
347
347
  * `<imgdir>` はデフォルトでは images ディレクトリです。
348
- * `<builder>` は利用しているビルダ名(ターゲット名)で、たとえば `--target=html` としているのであれば、images/html ディレクトリとなります。
348
+ * `<builder>` は利用しているビルダ名(ターゲット名)で、たとえば `--target=html` としているのであれば、images/html ディレクトリとなります。各 Maker におけるビルダ名は epubmaker および webmaker の場合は `html`、pdfmaker の場合は `latex`、textmaker の場合は `top` です。
349
349
  * `<chapid>` は章 ID です。たとえば ch01.re という名前であれば「ch01」です。
350
350
  * `<id>` は //image[〜] の最初に入れた「〜」のことです(つまり、ID に日本語や空白交じりの文字を使ってしまうと、後で画像ファイル名の名前付けに苦労することになります!)。
351
351
  * `<ext>` は Re:VIEW が自動で判別する拡張子です。ビルダによってサポートおよび優先する拡張子は異なります。
@@ -354,7 +354,7 @@ V1 --> V6 --|
354
354
 
355
355
  * HTMLBuilder (EPUBMaker、WEBMaker)、MARKDOWNBuilder: .png、.jpg、.jpeg、.gif、.svg
356
356
  * LATEXBuilder (PDFMaker): .ai、.eps、.pdf、.tif、.tiff、.png、.bmp、.jpg、.jpeg、.gif
357
- * それ以外のビルダ: .ai、.psd、.eps、.pdf、.tif、.tiff、.png、.bmp、.jpg、.jpeg、.gif、.svg
357
+ * それ以外のビルダ・Maker: .ai、.psd、.eps、.pdf、.tif、.tiff、.png、.bmp、.jpg、.jpeg、.gif、.svg
358
358
 
359
359
  ### インラインの画像挿入
360
360
 
@@ -396,7 +396,7 @@ plot sin(x)
396
396
  * Gnuplot ( http://www.gnuplot.info/ ) : `gnuplot` コマンドへのパスを OS に設定すること
397
397
  * Blockdiag ( http://blockdiag.com/ ) : `blockdiag` コマンドへのパスを OS に設定すること。PDF を生成する場合は ReportLab もインストールすること
398
398
  * aafigure ( https://launchpad.net/aafigure ) : `aafigure` コマンドへのパスを OS に設定すること
399
- * PlantUML ( http://plantuml.com/ ) : `java` コマンドへのパスを OS に設定し、`plantuml.jar` が作業フォルダにあること
399
+ * PlantUML ( http://plantuml.com/ ) : `java` コマンドへのパスを OS に設定し、`plantuml.jar` が作業フォルダ、または `/usr/share/plantuml` あるいは `/usr/share/java` フォルダにあること
400
400
 
401
401
  ## 表
402
402
 
@@ -524,6 +524,7 @@ Re:VIEW 5.0 以降では、囲み記事に箇条書きや図表・リストを
524
524
  ```
525
525
  パッケージは本書のサポートサイトから入手できます@<fn>{site}。
526
526
  各自ダウンロードしてインストールしておいてください。
527
+
527
528
  //footnote[site][本書のサポートサイト: http://i.loveruby.net/ja/stdcompiler ]
528
529
  ```
529
530
 
@@ -538,6 +539,31 @@ TeX PDF において、コラム以外の `//note` などの囲み記事の中
538
539
 
539
540
  ただし、通常の脚注(footnote)ではなく、footnotemark と footnotetext を使うため、本文と脚注が別ページに分かれる可能性があるなど、いろいろな制約があります。また、採番が別々になるため、footnote と footnotemark/footnotetext を両立させることはできません。
540
541
 
542
+ ## 後注
543
+
544
+ 後注(最後にまとめて出力される注釈)は、「`//endnote`」を使って記述します。
545
+
546
+ ```
547
+ パッケージは本書のサポートサイトから入手できます@<endnote>{site}。
548
+ 各自ダウンロードしてインストールしておいてください。
549
+
550
+ //endnote[site][本書のサポートサイト: http://i.loveruby.net/ja/stdcompiler ]
551
+ ```
552
+
553
+ 本文中のインライン命令「`@<endnote>{site}`」は後注番号に置換され、「本書のサポートサイト……」という文は後注として内部に保存されます。
554
+
555
+ 保存されている後注を書き出すには、書き出したい箇所(通常は章の末尾)に「`//printendnotes`」を置きます。
556
+
557
+ ```
558
+
559
+
560
+ ==== 注釈
561
+
562
+ //printendnotes
563
+ ```
564
+
565
+ 後注の管理は章 (re ファイル) 単位であり、複数の章にまたがった後注を作ることはできません。
566
+
541
567
  ## 参考文献の定義
542
568
 
543
569
  参考文献は同一ディレクトリ内の `bib.re` ファイルに定義します。
@@ -612,7 +638,7 @@ LaTeX の式を挿入するには、`//texequation{ 〜 //}` を使います。
612
638
 
613
639
  LaTeX の数式が正常に整形されるかどうかは処理系に依存します。LaTeX を利用する PDFMaker では問題なく利用できます。
614
640
 
615
- EPUBMaker および WEBMaker では、MathML に変換する方法と、画像化する方法のどちらかを選べます。
641
+ EPUBMaker および WEBMaker では、MathML に変換する方法、MathJax に変換する方法、画像化する方法から選べます。
616
642
 
617
643
  ### MathML の場合
618
644
  MathML ライブラリをインストールしておきます(`gem install math_ml`)。
@@ -620,11 +646,20 @@ MathML ライブラリをインストールしておきます(`gem install mat
620
646
  さらに config.yml に以下のように指定します。
621
647
 
622
648
  ```
623
- mathml: true
649
+ math_format: mathml
624
650
  ```
625
651
 
626
652
  なお、MathML で正常に表現されるかどうかは、ビューアやブラウザに依存します。
627
653
 
654
+ ### MathJax の場合
655
+ config.yml に以下のように指定します。
656
+
657
+ ```
658
+ math_format: mathjax
659
+ ```
660
+
661
+ MathJax の JavaScript モジュールはインターネットから読み込まれます。現時点で EPUB の仕様では外部からの読み込みを禁止しているため、MathJax を有効にすると EPUB ファイルの検証を通りません。また、ほぼすべての EPUB リーダーで MathJax は動作しません。CSS 組版との組み合わせでは利用できる可能性があります。
662
+
628
663
  ### 画像化の場合
629
664
 
630
665
  LaTeX を内部で呼び出し、外部ツールを使って画像化する方法です。画像化された数式は、`images/_review_math` フォルダに配置されます。
@@ -639,7 +674,7 @@ TeXLive などの LaTeX 環境が必要です。必要に応じて config.yml
639
674
  config.yml で以下のように設定すると、
640
675
 
641
676
  ```
642
- imgmath: true
677
+ math_format: imgmath
643
678
  ```
644
679
 
645
680
  デフォルト値として以下が使われます。
@@ -674,10 +709,10 @@ imgmath_options:
674
709
  たとえば SVG を利用するには、次のようにします。
675
710
 
676
711
  ```
677
- imgmath: true
712
+ math_format: imgmath
678
713
  imgmath_options:
679
714
  format: svg
680
- pdfcrop_pixelize_cmd: "pdftocairo -svg -r 90 -f %p -l %p -singlefile %i %o"
715
+ pdfcrop_pixelize_cmd: "pdftocairo -%t -r 90 -f %p -l %p %i %o"
681
716
  ```
682
717
 
683
718
  デフォルトでは、pdfcrop_pixelize_cmd に指定するコマンドは、1ページあたり1数式からなる複数ページの PDF のファイル名を `%i` プレースホルダで受け取り、`%p` プレースホルダのページ数に基づいて `%o`(拡張子あり)または `%O`(拡張子なし)の画像ファイルに書き出す、という仕組みになっています。
@@ -685,7 +720,7 @@ imgmath_options:
685
720
  単一のページの処理を前提とする `sips` コマンドや `magick` コマンドを使う場合、入力 PDF から指定のページを抽出するように `extract_singlepage: true` として挙動を変更します。単一ページの抽出はデフォルトで TeXLive の `pdfjam` コマンドが使われます。
686
721
 
687
722
  ```
688
- imgmath: true
723
+ math_format: imgmath
689
724
  imgmath_options:
690
725
  extract_singlepage: true
691
726
  # pdfjamの代わりに外部ツールのpdftkを使う場合(Windowsなど)
@@ -699,7 +734,7 @@ imgmath_options:
699
734
  textmaker 向けに PDF 形式の数式ファイルを作成したいときには、たとえば以下のように設定します(ページの抽出には pdftk を利用)。
700
735
 
701
736
  ```
702
- imgmath: true
737
+ math_format: imgmath
703
738
  imgmath_options:
704
739
  format: pdf
705
740
  extract_singlepage: true
@@ -710,7 +745,7 @@ imgmath_options:
710
745
  Re:VIEW 2 以前の dvipng の設定に合わせるには、次のようにします。
711
746
 
712
747
  ```
713
- imgmath: true
748
+ math_format: imgmath
714
749
  imgmath_options:
715
750
  converter: dvipng
716
751
  fontsize: 12
@@ -1013,6 +1048,8 @@ UL1-OL1-PARAGRAPH
1013
1048
  * `@<ttb>{〜}` : 等幅+太字にします。
1014
1049
  * `@<code>{〜}` : 等幅にします(コードの引用という性質)。
1015
1050
  * `@<tcy>{〜}` : 縦書きの文書において文字を縦中横にします。
1051
+ * `@<ins>{〜}` : 挿入箇所を明示します(デフォルトでは下線が引かれます)。
1052
+ * `@<del>{〜}` : 削除箇所を明示します(デフォルトでは打ち消し線が引かれます)。
1016
1053
 
1017
1054
  ### 参照
1018
1055
  * `@<chap>{章ファイル名}` : 「第17章」のような、章番号を含むテキストに置換されます。
data/doc/format.md CHANGED
@@ -4,7 +4,7 @@ The document is a brief guide for Re:VIEW markup syntax.
4
4
 
5
5
  Re:VIEW is based on EWB of ASCII (now KADOKAWA), influenced RD and other Wiki system's syntax.
6
6
 
7
- This document explains about the format of Re:VIEW 5.0.
7
+ This document explains about the format of Re:VIEW 5.3.
8
8
 
9
9
  ## Paragraph
10
10
 
@@ -375,7 +375,7 @@ The order of finding image is as follows. The first matched one is used.
375
375
  ```
376
376
 
377
377
  * ``<imgdir>`` is `images` as default.
378
- * ``<builder>`` is a builder (target) name to use. When you use review-comile commmand with ``--target=html``, `<imagedir>/<builder>` is `images/html`.
378
+ * ``<builder>`` is a builder (target) name to use. When you use review-comile commmand with ``--target=html``, `<imagedir>/<builder>` is `images/html`. The builder name for epubmaker and webmaker is `html`, for pdfmaker it is `latex`, and for textmaker it is `top`.
379
379
  * ``<chapid>`` is basename of *.re file. If the filename is `ch01.re`, chapid is `ch01`.
380
380
  * ``<id>`` is the ID of the first argument of `//image`. You should use only printable ASCII characters as ID.
381
381
  * ``<ext>`` is file extensions of Re:VIEW. They are different by the builder you use.
@@ -384,7 +384,7 @@ For each builder, image files are searched in order of the following extensions,
384
384
 
385
385
  * HTMLBuilder (EPUBMaker, WEBMaker), MARKDOWNBuilder: .png, .jpg, .jpeg, .gif, .svg
386
386
  * LATEXBuilder (PDFMaker): .ai, .eps, .pdf, .tif, .tiff, .png, .bmp, .jpg, .jpeg, .gif
387
- * Other builders: .ai, .psd, .eps, .pdf, .tif, .tiff, .png, .bmp, .jpg, .jpeg, .gif, .svg
387
+ * Other builders/makers: .ai, .psd, .eps, .pdf, .tif, .tiff, .png, .bmp, .jpg, .jpeg, .gif, .svg
388
388
 
389
389
  ### Inline Images
390
390
 
@@ -423,7 +423,7 @@ Before using these tools, you should installed them and configured path appropri
423
423
  * Gnuplot ( http://www.gnuplot.info/ ) : set path to `gnuplot` command
424
424
  * Blockdiag ( http://blockdiag.com/ ) : set path to `blockdiag` command. Install ReportLab also to make a PDF
425
425
  * aafigure ( https://launchpad.net/aafigure ) : set path to `aafigure` command
426
- * PlantUML ( http://plantuml.com/ ) : set path to `java` command. place `plantuml.jar` on working folder
426
+ * PlantUML ( http://plantuml.com/ ) : set path to `java` command. place `plantuml.jar` on working folder, `/usr/share/plantuml` or `/usr/share/java`.
427
427
 
428
428
  ## Tables
429
429
 
@@ -551,6 +551,7 @@ Usage:
551
551
  ```
552
552
  You can get the packages from support site for the book.@<fn>{site}
553
553
  You should get and install it before reading the book.
554
+
554
555
  //footnote[site][support site of the book: http://i.loveruby.net/ja/stdcompiler ]
555
556
  ```
556
557
 
@@ -572,6 +573,34 @@ Note that with this option, Re:VIEW use footnotemark and footnotetext instead of
572
573
  There are some constraints to use this option.
573
574
  You cannot use footnote and footnotemark/footnotetext at the same time.
574
575
 
576
+ ## Endnotes
577
+
578
+ You can use `//endnote` to write endnotes.
579
+
580
+ Usage:
581
+
582
+ ```
583
+ You can get the packages from support site for the book.@<endnote>{site}
584
+ You should get and install it before reading the book.
585
+
586
+ //endnote[site][support site of the book: http://i.loveruby.net/ja/stdcompiler ]
587
+ ```
588
+
589
+ `@<endnote>{site}` in source are replaced by endnote marks, and the phrase "support site of .."
590
+ is stored for printing later.
591
+
592
+ To print stored endnotes, place "`//printendnotes`" where you want to write down them (usually at the end of the chapter).
593
+
594
+ ```
595
+ ...
596
+
597
+ ==== Endnote
598
+
599
+ //printendnotes
600
+ ```
601
+
602
+ It is not possible to create an endnote that spans multiple chapters.
603
+
575
604
  ## Bibliography
576
605
 
577
606
  When you want to use a bibliography, you should write them in the file `bib.re`.
@@ -645,7 +674,7 @@ There is `@<m>{ ... }` for inline (see "Fence notation for inline commands" sect
645
674
 
646
675
  Whether LaTeX formula is correctly displayed or not depends on the processing system. PDFMaker uses LaTeX internally, so there is no problem.
647
676
 
648
- EPUBMaker and WEBMaker use either MathML transformation or imaging.
677
+ In EPUBMaker and WEBMaker, you can choose between MathML conversion, MathJax conversion, and imaging.
649
678
 
650
679
  ### MathML case
651
680
  Install MathML library (`gem install math_ml`).
@@ -653,11 +682,20 @@ Install MathML library (`gem install math_ml`).
653
682
  Specify in config.yml as follows:
654
683
 
655
684
  ```
656
- mathml: true
685
+ math_format: mathml
657
686
  ```
658
687
 
659
688
  Whether it is displayed properly in MathML depends on your viewer or browser.
660
689
 
690
+ ### MathJax case
691
+ Specify in config.yml as follows:
692
+
693
+ ```
694
+ math_format: mathjax
695
+ ```
696
+
697
+ MathJax JavaScript module is loaded from the Internet. Because the EPUB specification prohibits loading files from external, enabling this feature will cause the EPUB file to fail validation. Also MathJax will not work in almost all EPUB readers, but may be available with CSS formatting processor.
698
+
661
699
  ### imaging case
662
700
 
663
701
  This way calls LaTeX internally and images it with an external tool. Image files will be placed in `images/_review_math` folder.
@@ -672,7 +710,7 @@ In addition, external tools for image conversion are also needed. Currently, it
672
710
  By setting in config.yml,
673
711
 
674
712
  ```
675
- imgmath: true
713
+ math_format: imgmath
676
714
  ```
677
715
 
678
716
  it is set as follows:
@@ -707,10 +745,10 @@ imgmath_options:
707
745
  For example, to make SVG:
708
746
 
709
747
  ```
710
- imgmath: true
748
+ math_format: imgmath
711
749
  imgmath_options:
712
750
  format: svg
713
- pdfcrop_pixelize_cmd: "pdftocairo -svg -r 90 -f %p -l %p -singlefile %i %o"
751
+ pdfcrop_pixelize_cmd: "pdftocairo -%t -r 90 -f %p -l %p %i %o"
714
752
  ```
715
753
 
716
754
  By default, the command specified in `pdfcrop_pixelize_cmd` takes the filename of multi-page PDF consisting of one formula per page.
@@ -718,7 +756,7 @@ By default, the command specified in `pdfcrop_pixelize_cmd` takes the filename o
718
756
  If you want to use the `sips` command or the` magick` command, they can only process a single page, so you need to set `extract_singlepage: true` to extract the specified page from the input PDF. `pdfjam` command (in TeXLive) is used to extract pages.
719
757
 
720
758
  ```
721
- imgmath: true
759
+ math_format: imgmath
722
760
  imgmath_options:
723
761
  extract_singlepage: true
724
762
  # use pdftk instead of default pdfjam (for Windows)
@@ -732,7 +770,7 @@ imgmath_options:
732
770
  To create PDF math images:
733
771
 
734
772
  ```
735
- imgmath: true
773
+ math_format: imgmath
736
774
  imgmath_options:
737
775
  format: pdf
738
776
  extract_singlepage: true
@@ -743,7 +781,7 @@ imgmath_options:
743
781
  To set the same setting as Re:VIEW 2:
744
782
 
745
783
  ```
746
- imgmath: true
784
+ math_format: imgmath
747
785
  imgmath_options:
748
786
  converter: dvipng
749
787
  fontsize: 12
@@ -1054,6 +1092,8 @@ Output:
1054
1092
  @<ttb>{BarClass}:: teletype (monospaced font) and bold
1055
1093
  @<code>{a.foo(bar)}:: teletype (monospaced font) for fragments of code
1056
1094
  @<tcy>{}:: short horizontal text in vertical text
1095
+ @<ins>{sentence}:: inserted part (underline)
1096
+ @<del>{sentence}:: deleted part (strike through)
1057
1097
  ```
1058
1098
 
1059
1099
  ### References
data/doc/quickstart.ja.md CHANGED
@@ -8,7 +8,7 @@ Re:VIEW は GNU Lesser General Public License Version 2.1 に基づいて配布
8
8
 
9
9
  このドキュメントでは、Re:VIEW のセットアップから変換の例までを簡単に説明します。
10
10
 
11
- このドキュメントは、Re:VIEW 4.2 に基づいています。
11
+ このドキュメントは、Re:VIEW 5.1 に基づいています。
12
12
 
13
13
  ## セットアップ
14
14
 
@@ -160,6 +160,16 @@ config.yml のサンプルについては以下を参照してください。
160
160
 
161
161
  * [config.yml.sample](https://github.com/kmuto/review/blob/master/doc/config.yml.sample)
162
162
 
163
+ #### Vivliostyle CLI を使った PDF 化
164
+
165
+ TeX (`review-pdfmaker`、`rake pdf`) を利用する代わりに、[Vivliostyle CLI](https://github.com/vivliostyle/vivliostyle-cli) を使って PDF を作成することもできます。Re:VIEW が EPUB を作成したあと、VivliostyleCLI がそれを PDF に変換します。
166
+
167
+ ```bash
168
+ $ rake vivliostyle:build ← Vivliostyle を使って PDF を作成
169
+ $ rake vivliostyle:preview ← Chrome/Chromium ブラウザでプレビュー
170
+ $ rake vivliostyle ← vivliostyle:buildのショートカット
171
+ ```
172
+
163
173
  ### 章を増やす、カスタマイズする
164
174
  作成した PDF あるいは EPUB を見ると、先に作成した RE:VIEW フォーマットテキストファイルが「第1章」となっていることがわかります。
165
175
 
data/doc/quickstart.md CHANGED
@@ -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 4.2.
12
+ The supported version of the article is Re:VIEW 5.1.
13
13
 
14
14
  ## Set up Re:VIEW
15
15
 
@@ -161,6 +161,16 @@ $ rake idgxml ## generate InDesign XML
161
161
 
162
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.
163
163
 
164
+ #### generate PDF using Vivliostyle CLI
165
+
166
+ Instead of using TeX (`review-pdfmaker` or `rake pdf`), you can also create a PDF use [Vivliostyle CLI](https://github.com/vivliostyle/vivliostyle-cli). Re:VIEW creates EPUB first and then converts it to PDF with Vivliostyle CLI.
167
+
168
+ ```bash
169
+ $ rake vivliostyle:build ## build PDF using Viliostyle
170
+ $ rake vivliostyle:preview ## preview pages in Chrome/Chromium browser
171
+ $ rake vivliostyle ## shortcut of vivliostyle:build
172
+ ```
173
+
164
174
  ### add chapters and modify them
165
175
 
166
176
  `catalog.yml` file is a catalog of Re:VIEW format files.
@@ -182,7 +192,6 @@ POSTDEF:
182
192
 
183
193
  The first item in CHAPS is the first chapter, and the second item (if you add) is the second chapter. PREDEF is for front matter, APPENDIX is for appendix, and POSTDEF is for back matter. You can see in detail with [catalog.md](https://github.com/kmuto/review/blob/master/doc/catalog.ja.md).
184
194
 
185
-
186
195
  ### more information
187
196
 
188
197
  For more information about Re:VIEW format, see [format.md](https://github.com/kmuto/review/blob/master/doc/format.md).
@@ -35,6 +35,12 @@ body {
35
35
  -epub-writing-mode: vertical-rl;
36
36
  writing-mode: tb-rl;
37
37
  }
38
+
39
+ span.tcy {
40
+ -webkit-text-combine: horizontal;
41
+ -ms-text-combine-horizontal: all;
42
+ text-combine-upright: all;
43
+ }
38
44
  ```
39
45
 
40
46
  また、縦書きの書籍は通常、「左開き」(右ページから左ページへ進む)となるので、config.yml の direction パラメータを設定します。