review 5.0.0 → 5.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (160) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby-tex.yml +31 -0
  3. data/.github/workflows/ruby-win.yml +3 -3
  4. data/.github/workflows/ruby.yml +1 -1
  5. data/.rubocop.yml +15 -7
  6. data/NEWS.ja.md +108 -0
  7. data/NEWS.md +108 -0
  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 +2 -5
  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 +2 -4
  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 +21 -5
  28. data/doc/config.yml.sample-simple +1 -1
  29. data/doc/format.ja.md +21 -10
  30. data/doc/format.md +21 -10
  31. data/doc/quickstart.ja.md +11 -1
  32. data/doc/quickstart.md +11 -2
  33. data/lib/review.rb +1 -1
  34. data/lib/review/book/base.rb +4 -0
  35. data/lib/review/book/book_unit.rb +3 -0
  36. data/lib/review/book/chapter.rb +3 -0
  37. data/lib/review/book/index.rb +1 -0
  38. data/lib/review/book/volume.rb +1 -0
  39. data/lib/review/builder.rb +8 -1
  40. data/lib/review/call_hook.rb +20 -0
  41. data/lib/review/catalog.rb +1 -0
  42. data/lib/review/compiler.rb +27 -10
  43. data/lib/review/configure.rb +64 -7
  44. data/lib/review/epubmaker.rb +93 -96
  45. data/lib/review/epubmaker/content.rb +113 -0
  46. data/lib/review/epubmaker/epubcommon.rb +372 -0
  47. data/lib/review/epubmaker/epubv2.rb +178 -0
  48. data/lib/review/epubmaker/epubv3.rb +231 -0
  49. data/lib/review/epubmaker/producer.rb +168 -0
  50. data/lib/review/epubmaker/reviewheaderlistener.rb +12 -2
  51. data/lib/review/epubmaker/zip_exporter.rb +84 -0
  52. data/lib/review/exception.rb +6 -0
  53. data/lib/review/htmlbuilder.rb +36 -49
  54. data/lib/review/htmlutils.rb +1 -1
  55. data/lib/review/i18n.rb +1 -0
  56. data/lib/review/idgxmlbuilder.rb +33 -30
  57. data/lib/review/idgxmlmaker.rb +3 -1
  58. data/lib/review/img_math.rb +245 -0
  59. data/lib/review/index_builder.rb +1 -0
  60. data/lib/review/init.rb +4 -4
  61. data/lib/review/latexbox.rb +58 -0
  62. data/lib/review/latexbuilder.rb +30 -19
  63. data/lib/review/latexutils.rb +9 -1
  64. data/lib/review/lineinput.rb +112 -2
  65. data/lib/review/logger.rb +41 -2
  66. data/lib/review/makerhelper.rb +2 -205
  67. data/lib/review/markdownbuilder.rb +32 -1
  68. data/lib/review/pdfmaker.rb +31 -29
  69. data/lib/review/plaintextbuilder.rb +9 -1
  70. data/lib/review/preprocessor.rb +12 -6
  71. data/lib/review/rstbuilder.rb +1 -1
  72. data/lib/review/sec_counter.rb +1 -0
  73. data/lib/review/template.rb +6 -0
  74. data/lib/review/textmaker.rb +11 -7
  75. data/lib/review/textutils.rb +2 -10
  76. data/lib/review/tocprinter.rb +85 -68
  77. data/lib/review/topbuilder.rb +18 -11
  78. data/lib/review/update.rb +5 -6
  79. data/lib/review/version.rb +1 -1
  80. data/lib/review/volumeprinter.rb +4 -5
  81. data/lib/review/webmaker.rb +18 -13
  82. data/lib/review/webtocprinter.rb +10 -9
  83. data/lib/review/yamlloader.rb +2 -1
  84. data/review.gemspec +5 -3
  85. data/samples/sample-book/src/config-epub2.yml +1 -1
  86. data/samples/sample-book/src/config.yml +1 -1
  87. data/samples/sample-book/src/lib/tasks/review.rake +17 -1
  88. data/samples/syntax-book/ch01.re +1 -1
  89. data/samples/syntax-book/ch02.re +21 -6
  90. data/samples/syntax-book/ch03.re +1 -1
  91. data/samples/syntax-book/images/img3-2.png +0 -0
  92. data/templates/html/_colophon.html.erb +23 -0
  93. data/templates/html/_colophon_history.html.erb +9 -0
  94. data/templates/html/_cover.html.erb +10 -0
  95. data/templates/html/_part_body.html.erb +6 -0
  96. data/templates/html/_titlepage.html.erb +20 -0
  97. data/templates/html/layout-html5.html.erb +6 -0
  98. data/templates/html/layout-xhtml1.html.erb +6 -0
  99. data/templates/latex/config.erb +8 -0
  100. data/templates/latex/review-jlreq/review-base.sty +4 -5
  101. data/templates/latex/review-jlreq/review-jlreq.cls +10 -2
  102. data/templates/latex/review-jlreq/review-style.sty +6 -1
  103. data/templates/latex/review-jlreq/review-tcbox.sty +348 -0
  104. data/templates/latex/review-jlreq/reviewmacro.sty +5 -0
  105. data/templates/latex/review-jsbook/review-base.sty +5 -7
  106. data/templates/latex/review-jsbook/review-jsbook.cls +10 -2
  107. data/templates/latex/review-jsbook/review-style.sty +6 -1
  108. data/templates/latex/review-jsbook/review-tcbox.sty +348 -0
  109. data/templates/latex/review-jsbook/reviewmacro.sty +5 -0
  110. data/templates/opf/epubv2.opf.erb +7 -7
  111. data/templates/opf/epubv3.opf.erb +7 -7
  112. data/templates/opf/opf_manifest_epubv2.opf.erb +10 -0
  113. data/templates/opf/opf_manifest_epubv3.opf.erb +10 -0
  114. data/templates/opf/opf_metainfo_epubv2.opf.erb +17 -0
  115. data/templates/opf/opf_metainfo_epubv3.opf.erb +49 -0
  116. data/templates/opf/opf_tocx_epubv2.opf.erb +9 -0
  117. data/templates/opf/opf_tocx_epubv3.opf.erb +17 -0
  118. data/templates/web/html/layout-html5.html.erb +6 -5
  119. data/templates/web/html/layout-xhtml1.html.erb +6 -0
  120. data/test/assets/header_listener.html +35 -0
  121. data/test/assets/img_math/img1.png +0 -0
  122. data/test/assets/img_math/img2.png +0 -0
  123. data/test/assets/img_math/img3.png +0 -0
  124. data/test/assets/syntax_book_index_detail.txt +58 -0
  125. data/test/assets/test_template.tex +4 -1
  126. data/test/assets/test_template_backmatter.tex +4 -1
  127. data/test/run_test.rb +1 -1
  128. data/test/test_book_chapter.rb +2 -2
  129. data/test/test_catalog_converter_cmd.rb +1 -1
  130. data/test/test_epub3maker.rb +168 -124
  131. data/test/test_epubmaker.rb +243 -131
  132. data/test/test_epubmaker_cmd.rb +2 -2
  133. data/test/test_helper.rb +5 -4
  134. data/test/test_htmlbuilder.rb +64 -6
  135. data/test/test_idgxmlbuilder.rb +13 -0
  136. data/test/test_idgxmlmaker_cmd.rb +7 -3
  137. data/test/test_img_math.rb +111 -0
  138. data/test/test_indexbuilder.rb +5 -5
  139. data/test/test_latexbuilder.rb +107 -4
  140. data/test/test_lineinput.rb +20 -93
  141. data/test/test_markdownbuilder.rb +29 -0
  142. data/test/test_pdfmaker.rb +71 -0
  143. data/test/test_pdfmaker_cmd.rb +2 -2
  144. data/test/test_plaintextbuilder.rb +10 -18
  145. data/test/test_reviewheaderlistener.rb +49 -0
  146. data/test/test_template.rb +12 -2
  147. data/test/test_textmaker_cmd.rb +5 -1
  148. data/test/test_tocprinter.rb +46 -0
  149. data/test/test_topbuilder.rb +6 -1
  150. data/test/test_update.rb +34 -34
  151. data/test/test_zip_exporter.rb +5 -6
  152. metadata +91 -17
  153. data/lib/epubmaker.rb +0 -23
  154. data/lib/epubmaker/content.rb +0 -111
  155. data/lib/epubmaker/epubcommon.rb +0 -449
  156. data/lib/epubmaker/epubv2.rb +0 -142
  157. data/lib/epubmaker/epubv3.rb +0 -235
  158. data/lib/epubmaker/producer.rb +0 -375
  159. data/lib/epubmaker/zip_exporter.rb +0 -81
  160. data/lib/lineinput.rb +0 -155
data/bin/review-check CHANGED
@@ -9,10 +9,7 @@
9
9
  # For details of the GNU LGPL, see the file "COPYING".
10
10
  #
11
11
 
12
- require 'pathname'
13
-
14
- bindir = Pathname.new(__FILE__).realpath.dirname
15
- $LOAD_PATH.unshift((bindir + '../lib').realpath)
12
+ $LOAD_PATH.unshift(File.realpath('../lib', __dir__))
16
13
 
17
14
  require 'review'
18
15
  require 'optparse'
@@ -86,6 +83,7 @@ def check_text(files)
86
83
  m = re.match(s)
87
84
  next if m.nil? || m[0] == @review_utils_word_ok
88
85
  next if neg && neg =~ s
86
+
89
87
  str, offset = find_line(para, re)
90
88
  out = sprintf("%s:%d: %s\n", path, lineno + offset, str)
91
89
  print out
@@ -107,6 +105,7 @@ def find_line(lines, re)
107
105
  while i < lines.size - 1
108
106
  str = lines[i] + lines[i + 1]
109
107
  return str.gsub(re, '<<<\&>>>'), i if re =~ str
108
+
110
109
  i += 1
111
110
  end
112
111
 
@@ -118,6 +117,7 @@ def words_re(rc)
118
117
  nega = []
119
118
  File.foreach(rc) do |line|
120
119
  next if line[0, 1] == '#'
120
+
121
121
  if / !/ =~ line
122
122
  line, n = *line.split('!', 2)
123
123
  nega.push(n.strip)
@@ -134,7 +134,7 @@ def each_paragraph(f)
134
134
  case line
135
135
  when /\A\#@ok\((.*)\)/
136
136
  @review_utils_word_ok = $1
137
- when /\A\#@/
137
+ when /\A\#@/, /\A\s*\z/
138
138
  # do nothing
139
139
  next
140
140
  when %r{\A//caption\{(.*?)//\}}
@@ -145,9 +145,6 @@ def each_paragraph(f)
145
145
  end
146
146
  when /\A=/
147
147
  yield [line.slice(/\A=+(?:\[.*?\])?\s+(.*)/, 1).strip], f.lineno
148
- when /\A\s*\z/
149
- # skip
150
- next
151
148
  else
152
149
  buf = [line.strip]
153
150
  lineno = f.lineno
@@ -155,6 +152,7 @@ def each_paragraph(f)
155
152
  break if line.strip.empty?
156
153
  break if %r{\A(?:=|//[\w\}])} =~ line
157
154
  next if /\A\#@/ =~ line
155
+
158
156
  buf.push(line.strip)
159
157
  end
160
158
  yield buf, lineno
data/bin/review-checkdep CHANGED
@@ -9,10 +9,7 @@
9
9
  # For details of the GNU LGPL, see the file "COPYING".
10
10
  #
11
11
 
12
- require 'pathname'
13
-
14
- bindir = Pathname.new(__FILE__).realpath.dirname
15
- $LOAD_PATH.unshift((bindir + '../lib').realpath)
12
+ $LOAD_PATH.unshift(File.realpath('../lib', __dir__))
16
13
 
17
14
  PREDEF_FILE = 'PREDEF'.freeze
18
15
 
data/bin/review-compile CHANGED
@@ -9,10 +9,7 @@
9
9
  # For details of the GNU LGPL, see the file "COPYING".
10
10
  #
11
11
 
12
- require 'pathname'
13
-
14
- bindir = Pathname.new(__FILE__).realpath.dirname
15
- $LOAD_PATH.unshift((bindir + '../lib').realpath)
12
+ $LOAD_PATH.unshift(File.realpath('../lib', __dir__))
16
13
 
17
14
  require 'review'
18
15
  require 'fileutils'
@@ -126,7 +123,7 @@ def parse_opts
126
123
  opts.on('--chapref="before,middle,after"', 'Chapref decoration. (idgxml)') { |cdec| @config['chapref'] = cdec }
127
124
  opts.on('--chapterlink', 'make chapref hyperlink') { @config['chapterlink'] = true }
128
125
  opts.on('--stylesheet=file', 'Stylesheet file for HTML (comma separated)') { |files| @config['stylesheet'] = files.split(/\s*,\s*/) }
129
- opts.on('--mathml', 'Use MathML for TeX equation in HTML') { @config['mathml'] = true }
126
+ opts.on('--mathml', 'Use MathML for TeX equation in HTML') { @config['math_format'] = 'mathml' }
130
127
  opts.on('--htmlversion=VERSION', 'HTML version.') do |v|
131
128
  v = v.to_i
132
129
  @config['htmlversion'] = v if [4, 5].include?(v)
data/bin/review-epub2html CHANGED
@@ -7,10 +7,7 @@
7
7
  # the GNU LGPL, Lesser General Public License version 2.1.
8
8
  # For details of the GNU LGPL, see the file "COPYING".
9
9
 
10
- require 'pathname'
11
-
12
- bindir = Pathname.new(__FILE__).realpath.dirname
13
- $LOAD_PATH.unshift((bindir + '../lib').realpath)
10
+ $LOAD_PATH.unshift(File.realpath('../lib', __dir__))
14
11
 
15
12
  require 'review/epub2html'
16
13
 
data/bin/review-epubmaker CHANGED
@@ -6,11 +6,10 @@
6
6
  # the GNU LGPL, Lesser General Public License version 2.1.
7
7
  # For details of the GNU LGPL, see the file "COPYING".
8
8
  #
9
- require 'pathname'
10
- require 'optparse'
11
- bindir = Pathname.new(__FILE__).realpath.dirname
12
- $LOAD_PATH.unshift((bindir + '../lib').realpath)
13
9
 
10
+ $LOAD_PATH.unshift(File.realpath('../lib', __dir__))
11
+
12
+ require 'optparse'
14
13
  require 'review/epubmaker'
15
14
 
16
15
  ReVIEW::EPUBMaker.execute(*ARGV)
@@ -7,9 +7,7 @@
7
7
  # For details of the GNU LGPL, see the file "COPYING".
8
8
  #
9
9
 
10
- require 'pathname'
11
- bindir = Pathname.new(__FILE__).realpath.dirname
12
- $LOAD_PATH.unshift((bindir + '../lib').realpath)
10
+ $LOAD_PATH.unshift(File.realpath('../lib', __dir__))
13
11
 
14
12
  require 'review/idgxmlmaker'
15
13
 
data/bin/review-index CHANGED
@@ -9,11 +9,17 @@
9
9
  # For details of the GNU LGPL, see the file "COPYING".
10
10
  #
11
11
 
12
- require 'pathname'
13
-
14
- bindir = Pathname.new(__FILE__).realpath.dirname
15
- $LOAD_PATH.unshift((bindir + '../lib').realpath)
12
+ $LOAD_PATH.unshift(File.realpath('../lib', __dir__))
16
13
 
17
14
  require 'review/tocprinter'
18
15
 
19
- ReVIEW::TOCPrinter.execute(*ARGV)
16
+ begin
17
+ Signal.trap(:INT) { exit 1 }
18
+ if RUBY_PLATFORM !~ /mswin(?!ce)|mingw|cygwin|bccwin/
19
+ Signal.trap(:PIPE, 'IGNORE')
20
+ end
21
+
22
+ ReVIEW::TOCPrinter.execute(*ARGV)
23
+ rescue Errno::EPIPE
24
+ exit 0
25
+ end
data/bin/review-init CHANGED
@@ -7,10 +7,7 @@
7
7
  # the GNU LGPL, Lesser General Public License version 2.1.
8
8
  # For details of the GNU LGPL, see the file "COPYING".
9
9
 
10
- require 'pathname'
11
-
12
- bindir = Pathname.new(__FILE__).realpath.dirname
13
- $LOAD_PATH.unshift((bindir + '../lib').realpath)
10
+ $LOAD_PATH.unshift(File.realpath('../lib', __dir__))
14
11
 
15
12
  require 'review/init'
16
13
 
data/bin/review-pdfmaker CHANGED
@@ -7,9 +7,7 @@
7
7
  # For details of the GNU LGPL, see the file "COPYING".
8
8
  #
9
9
 
10
- require 'pathname'
11
- bindir = Pathname.new(__FILE__).realpath.dirname
12
- $LOAD_PATH.unshift((bindir + '../lib').realpath)
10
+ $LOAD_PATH.unshift(File.realpath('../lib', __dir__))
13
11
 
14
12
  require 'review/pdfmaker'
15
13
 
data/bin/review-preproc 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/preprocessor'
18
15
  require 'review/version'
@@ -93,6 +90,7 @@ def main
93
90
  end
94
91
  rescue ReVIEW::Error => e
95
92
  raise if $DEBUG
93
+
96
94
  @logger.error e.message
97
95
  exit 1
98
96
  end
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
  # パラメータ: 値
@@ -423,4 +426,17 @@ pdfmaker:
423
426
  colophon: true
424
427
  # 表紙挿入時に表紙のページ番号名を「cover」とし、偶数ページ扱いにして大扉前に白ページが入るのを防ぐ。デフォルトはtrue
425
428
  # use_cover_nombre: true
429
+ #
430
+ # 囲み表現の切り替え設定
431
+ # column, note, memo, tip, info, warning, important, caution, noticeを設定可
432
+ # styleはreview-tcbox.styまたは独自に作成したスタイルで定義済みの囲みスタイル名
433
+ # optionsはキャプションなし囲みに対するtcolorboxの追加・上書きオプション
434
+ # options_with_captionはキャプション付き囲みのtcolorboxの追加・上書きオプション(省略した場合はoptionsと同じ)
435
+ #
436
+ # boxsetting:
437
+ # note:
438
+ # style: squarebox
439
+ # options: "colback=black!5!white"
440
+ # options_with_caption: "colbacktitle=black!25!white"
441
+ #
426
442
  # 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.1 に基づいています。
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
 
@@ -612,7 +612,7 @@ LaTeX の式を挿入するには、`//texequation{ 〜 //}` を使います。
612
612
 
613
613
  LaTeX の数式が正常に整形されるかどうかは処理系に依存します。LaTeX を利用する PDFMaker では問題なく利用できます。
614
614
 
615
- EPUBMaker および WEBMaker では、MathML に変換する方法と、画像化する方法のどちらかを選べます。
615
+ EPUBMaker および WEBMaker では、MathML に変換する方法、MathJax に変換する方法、画像化する方法から選べます。
616
616
 
617
617
  ### MathML の場合
618
618
  MathML ライブラリをインストールしておきます(`gem install math_ml`)。
@@ -620,11 +620,20 @@ MathML ライブラリをインストールしておきます(`gem install mat
620
620
  さらに config.yml に以下のように指定します。
621
621
 
622
622
  ```
623
- mathml: true
623
+ math_format: mathml
624
624
  ```
625
625
 
626
626
  なお、MathML で正常に表現されるかどうかは、ビューアやブラウザに依存します。
627
627
 
628
+ ### MathJax の場合
629
+ config.yml に以下のように指定します。
630
+
631
+ ```
632
+ math_format: mathjax
633
+ ```
634
+
635
+ MathJax の JavaScript モジュールはインターネットから読み込まれます。現時点で EPUB の仕様では外部からの読み込みを禁止しているため、MathJax を有効にすると EPUB ファイルの検証を通りません。また、ほぼすべての EPUB リーダーで MathJax は動作しません。CSS 組版との組み合わせでは利用できる可能性があります。
636
+
628
637
  ### 画像化の場合
629
638
 
630
639
  LaTeX を内部で呼び出し、外部ツールを使って画像化する方法です。画像化された数式は、`images/_review_math` フォルダに配置されます。
@@ -639,7 +648,7 @@ TeXLive などの LaTeX 環境が必要です。必要に応じて config.yml
639
648
  config.yml で以下のように設定すると、
640
649
 
641
650
  ```
642
- imgmath: true
651
+ math_format: imgmath
643
652
  ```
644
653
 
645
654
  デフォルト値として以下が使われます。
@@ -674,7 +683,7 @@ imgmath_options:
674
683
  たとえば SVG を利用するには、次のようにします。
675
684
 
676
685
  ```
677
- imgmath: true
686
+ math_format: imgmath
678
687
  imgmath_options:
679
688
  format: svg
680
689
  pdfcrop_pixelize_cmd: "pdftocairo -svg -r 90 -f %p -l %p -singlefile %i %o"
@@ -685,7 +694,7 @@ imgmath_options:
685
694
  単一のページの処理を前提とする `sips` コマンドや `magick` コマンドを使う場合、入力 PDF から指定のページを抽出するように `extract_singlepage: true` として挙動を変更します。単一ページの抽出はデフォルトで TeXLive の `pdfjam` コマンドが使われます。
686
695
 
687
696
  ```
688
- imgmath: true
697
+ math_format: imgmath
689
698
  imgmath_options:
690
699
  extract_singlepage: true
691
700
  # pdfjamの代わりに外部ツールのpdftkを使う場合(Windowsなど)
@@ -699,7 +708,7 @@ imgmath_options:
699
708
  textmaker 向けに PDF 形式の数式ファイルを作成したいときには、たとえば以下のように設定します(ページの抽出には pdftk を利用)。
700
709
 
701
710
  ```
702
- imgmath: true
711
+ math_format: imgmath
703
712
  imgmath_options:
704
713
  format: pdf
705
714
  extract_singlepage: true
@@ -710,7 +719,7 @@ imgmath_options:
710
719
  Re:VIEW 2 以前の dvipng の設定に合わせるには、次のようにします。
711
720
 
712
721
  ```
713
- imgmath: true
722
+ math_format: imgmath
714
723
  imgmath_options:
715
724
  converter: dvipng
716
725
  fontsize: 12
@@ -1013,6 +1022,8 @@ UL1-OL1-PARAGRAPH
1013
1022
  * `@<ttb>{〜}` : 等幅+太字にします。
1014
1023
  * `@<code>{〜}` : 等幅にします(コードの引用という性質)。
1015
1024
  * `@<tcy>{〜}` : 縦書きの文書において文字を縦中横にします。
1025
+ * `@<ins>{〜}` : 挿入箇所を明示します(デフォルトでは下線が引かれます)。
1026
+ * `@<del>{〜}` : 削除箇所を明示します(デフォルトでは打ち消し線が引かれます)。
1016
1027
 
1017
1028
  ### 参照
1018
1029
  * `@<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.1.
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
 
@@ -645,7 +645,7 @@ There is `@<m>{ ... }` for inline (see "Fence notation for inline commands" sect
645
645
 
646
646
  Whether LaTeX formula is correctly displayed or not depends on the processing system. PDFMaker uses LaTeX internally, so there is no problem.
647
647
 
648
- EPUBMaker and WEBMaker use either MathML transformation or imaging.
648
+ In EPUBMaker and WEBMaker, you can choose between MathML conversion, MathJax conversion, and imaging.
649
649
 
650
650
  ### MathML case
651
651
  Install MathML library (`gem install math_ml`).
@@ -653,11 +653,20 @@ Install MathML library (`gem install math_ml`).
653
653
  Specify in config.yml as follows:
654
654
 
655
655
  ```
656
- mathml: true
656
+ math_format: mathml
657
657
  ```
658
658
 
659
659
  Whether it is displayed properly in MathML depends on your viewer or browser.
660
660
 
661
+ ### MathJax case
662
+ Specify in config.yml as follows:
663
+
664
+ ```
665
+ math_format: mathjax
666
+ ```
667
+
668
+ 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.
669
+
661
670
  ### imaging case
662
671
 
663
672
  This way calls LaTeX internally and images it with an external tool. Image files will be placed in `images/_review_math` folder.
@@ -672,7 +681,7 @@ In addition, external tools for image conversion are also needed. Currently, it
672
681
  By setting in config.yml,
673
682
 
674
683
  ```
675
- imgmath: true
684
+ math_format: imgmath
676
685
  ```
677
686
 
678
687
  it is set as follows:
@@ -707,7 +716,7 @@ imgmath_options:
707
716
  For example, to make SVG:
708
717
 
709
718
  ```
710
- imgmath: true
719
+ math_format: imgmath
711
720
  imgmath_options:
712
721
  format: svg
713
722
  pdfcrop_pixelize_cmd: "pdftocairo -svg -r 90 -f %p -l %p -singlefile %i %o"
@@ -718,7 +727,7 @@ By default, the command specified in `pdfcrop_pixelize_cmd` takes the filename o
718
727
  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
728
 
720
729
  ```
721
- imgmath: true
730
+ math_format: imgmath
722
731
  imgmath_options:
723
732
  extract_singlepage: true
724
733
  # use pdftk instead of default pdfjam (for Windows)
@@ -732,7 +741,7 @@ imgmath_options:
732
741
  To create PDF math images:
733
742
 
734
743
  ```
735
- imgmath: true
744
+ math_format: imgmath
736
745
  imgmath_options:
737
746
  format: pdf
738
747
  extract_singlepage: true
@@ -743,7 +752,7 @@ imgmath_options:
743
752
  To set the same setting as Re:VIEW 2:
744
753
 
745
754
  ```
746
- imgmath: true
755
+ math_format: imgmath
747
756
  imgmath_options:
748
757
  converter: dvipng
749
758
  fontsize: 12
@@ -1054,6 +1063,8 @@ Output:
1054
1063
  @<ttb>{BarClass}:: teletype (monospaced font) and bold
1055
1064
  @<code>{a.foo(bar)}:: teletype (monospaced font) for fragments of code
1056
1065
  @<tcy>{}:: short horizontal text in vertical text
1066
+ @<ins>{sentence}:: inserted part (underline)
1067
+ @<del>{sentence}:: deleted part (strike through)
1057
1068
  ```
1058
1069
 
1059
1070
  ### References