review 3.0.0 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c42bf9b1882e845d3b136daa8a10a5b268ec5abc2c60f0e02e2f10bb390350be
4
- data.tar.gz: 311a696028fcd8651245648a33d15acb79f79f12986ee2f2ceb67be1329fe2b2
3
+ metadata.gz: e84bcc2665b217e208b209c794a7d4e4a71440f8094cb32e969e294ef49b525b
4
+ data.tar.gz: 5a27039b3a6fa44437786debfc54fa2fe24213fdb497a84d4a483bb590fd1118
5
5
  SHA512:
6
- metadata.gz: dec76569275ed22bc13a978b2181da58f1dec38fe8ddf9a6c5355f0f5fe00385b50307143b938764e5b854471ad80feda576cba5b350ee18e03f6a6b06b1d80b
7
- data.tar.gz: aee5b0eff6ec9df9501810c38d0a60c22e5a957e2db2549f1ac63df4ab3e4a575b7ad8f698ab3a54fa10bbdadde5c95685c3f2db51f5c0a097a1b80f3da816b6
6
+ metadata.gz: cadd2c9a936fd38bd84f15d9b06fd0e85cd1df1b32e8116e165f4dd67801cdef887ca0e1c788ed8d5c3cc3b9979d729eb886149b7c188d2d461f459d6da36923
7
+ data.tar.gz: ce5a14cc670d7c57ce8fb6b7c2a885dc9bdef074da06eaa3a83d1bca5eeaa4196d42f60763d86e0aa2afe8a2115ad38f3e6e43ef69aaedd930dd938eefb50bd5
data/.travis.yml CHANGED
@@ -11,16 +11,24 @@ addons:
11
11
  - dvipng
12
12
 
13
13
  before_install:
14
- - gem update --system
15
- - gem update bundler
14
+ - |-
15
+ RUBY_VER=`ruby -e "print RUBY_VERSION"`
16
+ if [ "$RUBY_VER" = "2.1.10" ]; then
17
+ gem install bundler -v '< 2'
18
+ elif [ "$RUBY_VER" = "2.2.10" ]; then
19
+ gem install bundler -v '< 2'
20
+ else
21
+ gem update --system
22
+ gem install bundler
23
+ fi
16
24
 
17
25
  rvm:
18
- ## - 2.0
19
26
  - 2.1
20
- - 2.2.7
21
- - 2.3.4
22
- - 2.4.1
23
- - 2.5.0
27
+ - 2.2.10
28
+ - 2.3.8
29
+ - 2.4.5
30
+ - 2.5.3
31
+ - 2.6.0
24
32
  ## - ruby-head
25
33
 
26
34
  branches:
data/NEWS.ja.md CHANGED
@@ -1,3 +1,61 @@
1
+ # Version 3.1.0
2
+
3
+ ## 非互換の変更
4
+ * PDFMaker: 図版のキャプションとして `\reviewimagecaption` マクロを導入しました ([#1254])。Re:VIEW 3 を使っているプロジェクトでは、`review-update` コマンドを実行して review-base.sty ファイルを更新することを推奨します。
5
+ * `review-preproc` コマンドから、文書化されておらず正しく動作しない `--strip` オプションを除去しました ([#1257])
6
+
7
+ ## バグ修正
8
+ * PDFMaker: 部の中の節番号が前の章の節番号を継続してしまう問題を修正しました ([#1225],[#1226])
9
+ * samples 内で gentombow.sty ファイルのコピーが正しくできていないのを修正しました ([#1229])
10
+ * PDFMaker: review-jsbook 利用時、numer_of_lines ドキュメントオプションで指定した行数より1行減ってしまうのを修正しました ([#1235])
11
+ * PDFMaker: review-jlreq が LuaLaTeX で動作するように修正しました ([#1243])
12
+ * EPUBMaker: 部があるときに目次の階層がおかしくなる問題を修正しました ([#1262])
13
+ * `//comment` の内容が正しくエスケープされないことがある問題を修正しました ([#1264])
14
+ * PDFMaker: 奥付の左列が長いときにあふれるのを修正しました ([#1252])
15
+ * CHAPS: が空のときにエラーになるのを修正しました ([#1273])
16
+
17
+ ## 機能強化
18
+ * PDFMaker: 数式表現の拡張としてよく使われる amssymb, amsthm, bm パッケージを標準で読み込むようにしました ([#1224])
19
+ * HTMLBuilder: emlist, listnum 命令の挙動をほかのコードリスト命令に合わせ、highlight メソッドを必ず経由するようにしました ([#1231])
20
+ * EPUBMaker: 脚注から本文に戻るリンクを表現できるようにしました ([#1233])。`epubmaker` パラメータの `back_footnote` サブパラメータを true にすると利用できます。
21
+ * PDFMaker: ダミーの行を作成する `\makelines` マクロを追加しました ([#1240])
22
+ * `#@warn` 命令を正しく実装しました ([#1258])
23
+ * `#@mapfile` 命令に re 拡張子のファイルが指定されたときにはタブなどを整形せずそのまま取り込むようにしました ([#1247])
24
+ * Ruby 2.6 をテスト対象にしました ([#1242])
25
+ * PDFMaker: review-jlreq で `zw` を使っている箇所を `\zw` に置き換えました。コラム内の段落は字下げするようにしました ([#1250])
26
+ * PDFMaker: [#1254] で導入した `\reviewimagecaption` が定義されていないときにはデフォルトのマクロを提供するようにしました ([#1267])
27
+
28
+ ## ドキュメント
29
+ * README.md: jsbook.cls のファイル名が誤っていたのを修正しました ([#1239])
30
+ * config.yml.sample に back_footnote の説明を追加し、その他いくつかドキュメントに些末な更新を行いました ([#1268])
31
+
32
+ ## コントリビューターのみなさん
33
+ * [@doublemarket](https://github.com/doublemarket)
34
+ * [@munepi](https://github.com/munepi)
35
+
36
+ [#1224]: https://github.com/kmuto/review/issues/1224
37
+ [#1225]: https://github.com/kmuto/review/pull/1225
38
+ [#1226]: https://github.com/kmuto/review/pull/1226
39
+ [#1229]: https://github.com/kmuto/review/pull/1229
40
+ [#1231]: https://github.com/kmuto/review/issues/1231
41
+ [#1233]: https://github.com/kmuto/review/issues/1233
42
+ [#1235]: https://github.com/kmuto/review/issues/1235
43
+ [#1239]: https://github.com/kmuto/review/pull/1239
44
+ [#1240]: https://github.com/kmuto/review/pull/1240
45
+ [#1242]: https://github.com/kmuto/review/pull/1242
46
+ [#1243]: https://github.com/kmuto/review/issues/1243
47
+ [#1247]: https://github.com/kmuto/review/issues/1247
48
+ [#1250]: https://github.com/kmuto/review/pull/1250
49
+ [#1252]: https://github.com/kmuto/review/issues/1252
50
+ [#1254]: https://github.com/kmuto/review/issues/1254
51
+ [#1257]: https://github.com/kmuto/review/issues/1257
52
+ [#1258]: https://github.com/kmuto/review/issues/1258
53
+ [#1262]: https://github.com/kmuto/review/issues/1262
54
+ [#1264]: https://github.com/kmuto/review/issues/1264
55
+ [#1267]: https://github.com/kmuto/review/issues/1267
56
+ [#1268]: https://github.com/kmuto/review/issues/1268
57
+ [#1273]: https://github.com/kmuto/review/issues/1273
58
+
1
59
  # Version 3.0.0
2
60
 
3
61
  ## バグ修正
data/NEWS.md CHANGED
@@ -1,3 +1,60 @@
1
+ # Version 3.1.0
2
+ ## Breaking Changes
3
+ * PDFMaker: introduce `\reviewimagecaption` macro for the caption of figure ([#1254]). Please update your review-base.sty by `review-update` command on your Re:VIEW 3 project.
4
+ * remove `--strip` option which is undocumented and doesn't work correctly from `review-preproc command` ([#1257])
5
+
6
+ ## Bug Fixes
7
+ * PDFMaker: fix a problem that the section number of the part continues the section number in the previous chapter ([#1225],[#1226])
8
+ * fix copying of gentombow.sty in samples folder ([#1229])
9
+ * PDFMaker: fix that the number of lines specified by `number_of_lines` document option decrease by 1 line than originally on review-jsbook ([#1235])
10
+ * PDFMaker: fix review-jlreq to work with LuaLaTeX ([#1243])
11
+ * EPUBMaker: fix a problem that the hierachy of the table of contents become strange when there is a part ([#1262])
12
+ * fix escaping of `//comment` ([#1264])
13
+ * PDFMaker: fix overflowing when the left column of colophon is long ([#1252])
14
+ * fix an error when CHAPS: is empty ([#1273])
15
+
16
+ ## Enhancements
17
+ * PDFMaker: load amssymb, amsthm, and bm packages which are often used as extension of mathematical expression ([#1224])
18
+ * HTMLBuilder: `emlist` and `listnum` now always pass `highlight` method as well as others ([#1231])
19
+ * EPUBMaker: implement a back-link to the text from the footnote ([#1233])
20
+ * PDFMaker: add `\makelines` macro to create a dummy line ([#1240])
21
+ * implement `#@warn` correctly ([#1258])
22
+ * `#@mapfile` now imports as is (keep tabs etc.) when imported file has `.re` extension ([#1247])
23
+ * add Ruby 2.6 for the test coverage ([#1242])
24
+ * PDFMaker: replace `zw` with `\zw` in review-jlreq. add a indent to paragraphs in the column ([#1250])
25
+ * PDFMaker: when `\reviewimagecaption` is undefined (implemented in [#1254]), define it ([#1267])
26
+
27
+ ## Docs
28
+ * README.md: fix the filename of jsbook.cls ([#1239])
29
+ * add the note about `back_footnote` into config.yml.sample and update documents a little ([#1268])
30
+
31
+ ## Contributors
32
+ * [@doublemarket](https://github.com/doublemarket)
33
+ * [@munepi](https://github.com/munepi)
34
+
35
+ [#1224]: https://github.com/kmuto/review/issues/1224
36
+ [#1225]: https://github.com/kmuto/review/pull/1225
37
+ [#1226]: https://github.com/kmuto/review/pull/1226
38
+ [#1229]: https://github.com/kmuto/review/pull/1229
39
+ [#1231]: https://github.com/kmuto/review/issues/1231
40
+ [#1233]: https://github.com/kmuto/review/issues/1233
41
+ [#1235]: https://github.com/kmuto/review/issues/1235
42
+ [#1239]: https://github.com/kmuto/review/pull/1239
43
+ [#1240]: https://github.com/kmuto/review/pull/1240
44
+ [#1242]: https://github.com/kmuto/review/pull/1242
45
+ [#1243]: https://github.com/kmuto/review/issues/1243
46
+ [#1247]: https://github.com/kmuto/review/issues/1247
47
+ [#1250]: https://github.com/kmuto/review/pull/1250
48
+ [#1252]: https://github.com/kmuto/review/issues/1252
49
+ [#1254]: https://github.com/kmuto/review/issues/1254
50
+ [#1257]: https://github.com/kmuto/review/issues/1257
51
+ [#1258]: https://github.com/kmuto/review/issues/1258
52
+ [#1262]: https://github.com/kmuto/review/issues/1262
53
+ [#1264]: https://github.com/kmuto/review/issues/1264
54
+ [#1267]: https://github.com/kmuto/review/issues/1267
55
+ [#1268]: https://github.com/kmuto/review/issues/1268
56
+ [#1273]: https://github.com/kmuto/review/issues/1273
57
+
1
58
  # Version 3.0.0
2
59
 
3
60
  ## Bug Fixes
data/README.md CHANGED
@@ -108,8 +108,8 @@ Exception:
108
108
  * jumoline.sty, vendor/jumoline: The LaTeX Project Public License. See [LPPL](https://github.com/kmuto/review/blob/master/vendor/jumoline/lppl.txt) file.
109
109
  * plistings.sty, vendor/plistings: MIT License. See [LICENSE](https://github.com/kmuto/review/blob/master/vendor/plistings/LICENSE) file.
110
110
  * gentombow.sty, vendor/gentombow: BSD License. See [LICENSE](https://github.com/kmuto/review/blob/master/vendor/gentombow/LICENSE) file.
111
- * jsbook.sty, vendor/jsclasses: BSD License. See [LICENSE](https://github.com/kmuto/review/blob/master/vendor/jsclasses/LICENSE) file.
111
+ * jsbook.cls, vendor/jsclasses: BSD License. See [LICENSE](https://github.com/kmuto/review/blob/master/vendor/jsclasses/LICENSE) file.
112
112
 
113
113
  ## Copyright
114
114
 
115
- Copyright (c) 2006-2018 Minero Aoki, Kenshi Muto, Masayoshi Takahashi, Masanori Kado.
115
+ Copyright (c) 2006-2019 Minero Aoki, Kenshi Muto, Masayoshi Takahashi, Masanori Kado.
data/bin/review-preproc CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
  #
3
- # Copyright (c) 2010-2014 Minero Aoki, Kenshi Muto
3
+ # Copyright (c) 2010-2019 Minero Aoki, Kenshi Muto
4
4
  # 1999-2007 Minero Aoki
5
5
  #
6
6
  # This program is free software.
@@ -52,7 +52,6 @@ def main
52
52
  opts.on('-c', '--check', 'Check if preprocess is needed.') { mode = :check }
53
53
  opts.on('-d', '--diff', 'Show diff from current file.') { mode = :diff }
54
54
  opts.on('--replace', 'Replace file by preprocessed one.') { mode = :replace }
55
- opts.on('-s', '--strip', 'Strip preprocessor tags.') { mode = :strip }
56
55
  opts.on('--tabwidth=WIDTH', "Replace tabs with space characters. (0: don't replace)") { |width| param['tabwidth'] = width.to_i }
57
56
  opts.on('--help', 'Print this message and quit.') do
58
57
  puts opts.help
@@ -88,10 +87,6 @@ def main
88
87
  ensure
89
88
  FileUtils.rm_f tmp
90
89
  end
91
- when :strip
92
- File.open(path) do |f|
93
- ReVIEW::Preprocessor::Strip.new(f).each { |line| puts line }
94
- end
95
90
  else
96
91
  raise "must not happen: #{mode}"
97
92
  end
data/doc/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2006-2018 Minero Aoki, Kenshi Muto, Masayoshi Takahashi, Masanori Kado.
1
+ Copyright (c) 2006-2019 Minero Aoki, Kenshi Muto, Masayoshi Takahashi, Masanori Kado.
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining a copy
4
4
  of this software and associated documentation files (the "Software"), to deal
@@ -72,7 +72,7 @@ aut: ["青木峰郎", "武藤健志", "高橋征義", "角征典"]
72
72
  # 日付の後ろを空白文字で区切り、任意の文字列を置くことも可能。
73
73
  # history: [["2016-04-20 v1.0.0版発行", "2018-11-11 v3.0.0版発行"]]
74
74
  # 権利表記(配列で複数指定可)
75
- # rights: (C) 2016-2018 Re:VIEW Developers
75
+ # rights: (C) 2016-2019 Re:VIEW Developers
76
76
  # description: 説明
77
77
  # subject: 短い説明用タグ(配列で複数指定可)
78
78
  # type: 書籍のカテゴリーなど(配列で複数指定可)
@@ -306,6 +306,8 @@ epubmaker:
306
306
  # @<href>タグでの外部リンクを禁止し、地の文にする(falseで禁止する)
307
307
  # externallink: true
308
308
  #
309
+ # 脚注に「戻る」リンクを追加する(trueで追加)。脚注の記号および戻るリンクの記号はlocale.ymlで変更可能
310
+ # back_footnote: null
309
311
  # epubmaker:階層を使うものはここまで
310
312
 
311
313
  # LaTeX用のスタイルファイル(styディレクトリ以下に置くこと)
@@ -22,7 +22,7 @@ pbl: "Re:VIEW Publishing inc."
22
22
  prt: "Re:VIEW Printing inc."
23
23
  date: 2018-11-11
24
24
  history: [["2012-01-30"],["2016-04-20","2016-05-03"],["2018-11-11"]]
25
- rights: (C) 2016-2018 Re:VIEW Commiters, some rights reserved.
25
+ rights: (C) 2016-2019 Re:VIEW Commiters, some rights reserved.
26
26
  description: sample config.yml file for Re:VIEW book
27
27
  urnid: urn:uid:http://reviewml.org/review-sample-book
28
28
  # isbn: null
@@ -65,6 +65,7 @@ epubmaker:
65
65
  htmlext: xhtml
66
66
  cover_linear: true
67
67
  externallink: true
68
+ # back_footnote: true
68
69
 
69
70
  ## for LaTeX
70
71
 
data/doc/quickstart.ja.md CHANGED
@@ -223,13 +223,13 @@ INFO: 新しいファイル /.../sty/review-custom.sty が作成されました
223
223
  INFO: 新しいファイル /.../sty/review-jsbook.cls が作成されました。
224
224
  INFO: 新しいファイル /.../sty/review-style.sty が作成されました。
225
225
  INFO: 新しいファイル /.../sty/review-base.sty が作成されました。
226
- INFO: 新しいファイル /.../sty/gentombow09j.sty が作成されました。
226
+ INFO: 新しいファイル /.../sty/gentombow.sty が作成されました。
227
227
  完了しました。
228
228
  ```
229
229
 
230
230
  ## クレジット
231
231
 
232
- Re:VIEW は、青木峰郎によって最初に作成されました。武藤健志がこの開発・保守を引き継ぎ、201811月時点では、武藤健志、高橋征義、角征典が開発・保守を継続しています。
232
+ Re:VIEW は、青木峰郎によって最初に作成されました。武藤健志がこの開発・保守を引き継ぎ、20192月時点では、武藤健志、高橋征義、角征典が開発・保守を継続しています。
233
233
 
234
234
  バグ・パッチの報告、開発者用メーリングリストなどについての情報は、
235
235
 
data/doc/quickstart.md CHANGED
@@ -225,13 +225,13 @@ INFO: new file /.../sty/review-custom.sty is created.
225
225
  INFO: new file /.../sty/review-jsbook.cls is created.
226
226
  INFO: new file /.../sty/review-style.sty is created.
227
227
  INFO: new file /.../sty/review-base.sty is created.
228
- INFO: new file /.../sty/gentombow09j.sty is created.
228
+ INFO: new file /.../sty/gentombow.sty is created.
229
229
  Finished.
230
230
  ```
231
231
 
232
232
  ## Copyright
233
233
 
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).
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 (February 2019).
235
235
 
236
236
  If you want to report bugs and patches, or to get more information, see:
237
237
 
@@ -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
@@ -327,8 +327,14 @@ EOT
327
327
 
328
328
  if has_part
329
329
  @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
330
+ if item.chaptype == 'part' && item.level > 0
331
+ # sections in part
332
+ item.level -= 1
333
+ end
334
+ # down level for part and chaps. pre, appendix, post are preserved
335
+ if item.chaptype == 'part' || item.chaptype == 'body'
336
+ item.level += 1
337
+ end
332
338
  end
333
339
  toclevel += 1
334
340
  end
@@ -269,7 +269,8 @@ module EPUBMaker
269
269
  'rename_for_legacy' => nil,
270
270
  'verify_target_images' => nil,
271
271
  'force_include_images' => [],
272
- 'cover_linear' => nil
272
+ 'cover_linear' => nil,
273
+ 'back_footnote' => nil
273
274
  },
274
275
  'externallink' => true,
275
276
  'contentdir' => '.',
@@ -50,7 +50,7 @@ module ReVIEW
50
50
  end
51
51
 
52
52
  def parts_with_chaps
53
- return '' unless @yaml['CHAPS']
53
+ return [] unless @yaml['CHAPS']
54
54
  @yaml['CHAPS'].flatten.compact
55
55
  end
56
56
 
@@ -330,6 +330,8 @@ module ReVIEW
330
330
  elsif chap.on_predef?
331
331
  chaptype = 'pre'
332
332
  elsif chap.on_appendix?
333
+ chaptype = 'appendix'
334
+ elsif chap.on_postdef?
333
335
  chaptype = 'post'
334
336
  end
335
337
 
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2008-2018 Minero Aoki, Kenshi Muto, Masayoshi Takahashi,
1
+ # Copyright (c) 2008-2019 Minero Aoki, Kenshi Muto, Masayoshi Takahashi,
2
2
  # KADO Masanori
3
3
  # 2002-2007 Minero Aoki
4
4
  #
@@ -435,20 +435,20 @@ module ReVIEW
435
435
  end
436
436
 
437
437
  def listnum_body(lines, lang)
438
+ body = lines.inject('') { |i, j| i + detab(j) + "\n" }
439
+ lexer = lang
440
+ first_line_number = line_num
441
+ hs = highlight(body: body, lexer: lexer, format: 'html', linenum: true,
442
+ options: { linenostart: first_line_number })
443
+
438
444
  if highlight?
439
- body = lines.inject('') { |i, j| i + detab(j) + "\n" }
440
- lexer = lang
441
- first_line_number = line_num
442
- puts highlight(body: body, lexer: lexer, format: 'html', linenum: true,
443
- options: { linenostart: first_line_number })
445
+ puts hs
444
446
  else
445
447
  class_names = ['list']
446
448
  class_names.push("language-#{lang}") unless lang.blank?
447
- class_names.push('highlight') if highlight?
448
449
  print %Q(<pre class="#{class_names.join(' ')}">)
449
- first_line_num = line_num
450
- lines.each_with_index do |line, i|
451
- puts detab((i + first_line_num).to_s.rjust(2) + ': ' + line)
450
+ hs.split("\n").each_with_index do |line, i|
451
+ puts detab((i + first_line_number).to_s.rjust(2) + ': ' + line)
452
452
  end
453
453
  puts '</pre>'
454
454
  end
@@ -476,20 +476,20 @@ module ReVIEW
476
476
  puts %Q(<p class="caption">#{compile_inline(caption)}</p>)
477
477
  end
478
478
 
479
+ body = lines.inject('') { |i, j| i + detab(j) + "\n" }
480
+ lexer = lang
481
+ first_line_number = line_num
482
+ hs = highlight(body: body, lexer: lexer, format: 'html', linenum: true,
483
+ options: { linenostart: first_line_number })
479
484
  if highlight?
480
- body = lines.inject('') { |i, j| i + detab(j) + "\n" }
481
- lexer = lang
482
- first_line_number = line_num
483
- puts highlight(body: body, lexer: lexer, format: 'html', linenum: true,
484
- options: { linenostart: first_line_number })
485
+ puts hs
485
486
  else
486
487
  class_names = ['emlist']
487
488
  class_names.push("language-#{lang}") unless lang.blank?
488
489
  class_names.push('highlight') if highlight?
489
490
  print %Q(<pre class="#{class_names.join(' ')}">)
490
- first_line_num = line_num
491
- lines.each_with_index do |line, i|
492
- puts detab((i + first_line_num).to_s.rjust(2) + ': ' + line)
491
+ hs.split("\n").each_with_index do |line, i|
492
+ puts detab((i + first_line_number).to_s.rjust(2) + ': ' + line)
493
493
  end
494
494
  puts '</pre>'
495
495
  end
@@ -748,16 +748,21 @@ module ReVIEW
748
748
  end
749
749
 
750
750
  def comment(lines, comment = nil)
751
- lines ||= []
752
- lines.unshift comment unless comment.blank?
753
751
  return unless @book.config['draft']
752
+ lines ||= []
753
+ lines.unshift escape(comment) unless comment.blank?
754
754
  str = lines.join('<br />')
755
- puts %Q(<div class="draft-comment">#{escape(str)}</div>)
755
+ puts %Q(<div class="draft-comment">#{str}</div>)
756
756
  end
757
757
 
758
758
  def footnote(id, str)
759
759
  if @book.config['epubversion'].to_i == 3
760
- puts %Q(<div class="footnote" epub:type="footnote" id="fn-#{normalize_id(id)}"><p class="footnote">[*#{@chapter.footnote(id).number}] #{compile_inline(str)}</p></div>)
760
+ back = ''
761
+ if @book.config['epubmaker'] && @book.config['epubmaker']['back_footnote']
762
+ back = %Q(<a href="#fnb-#{normalize_id(id)}">#{I18n.t('html_footnote_backmark')}</a>)
763
+ end
764
+ # XXX: back link must be located at first of p for Kindle.
765
+ puts %Q(<div class="footnote" epub:type="footnote" id="fn-#{normalize_id(id)}"><p class="footnote">#{back}#{I18n.t('html_footnote_textmark', @chapter.footnote(id).number)}#{compile_inline(str)}</p></div>)
761
766
  else
762
767
  puts %Q(<div class="footnote" id="fn-#{normalize_id(id)}"><p class="footnote">[<a href="#fnb-#{normalize_id(id)}">*#{@chapter.footnote(id).number}</a>] #{compile_inline(str)}</p></div>)
763
768
  end
@@ -862,7 +867,7 @@ module ReVIEW
862
867
 
863
868
  def inline_fn(id)
864
869
  if @book.config['epubversion'].to_i == 3
865
- %Q(<a id="fnb-#{normalize_id(id)}" href="#fn-#{normalize_id(id)}" class="noteref" epub:type="noteref">*#{@chapter.footnote(id).number}</a>)
870
+ %Q(<a id="fnb-#{normalize_id(id)}" href="#fn-#{normalize_id(id)}" class="noteref" epub:type="noteref">#{I18n.t('html_footnote_refmark', @chapter.footnote(id).number)}</a>)
866
871
  else
867
872
  %Q(<a id="fnb-#{normalize_id(id)}" href="#fn-#{normalize_id(id)}" class="noteref">*#{@chapter.footnote(id).number}</a>)
868
873
  end
data/lib/review/i18n.yml CHANGED
@@ -29,6 +29,9 @@ ja:
29
29
  ruby_postfix: ")"
30
30
  external_link: "%s(%s)"
31
31
  label_marker: "●● "
32
+ html_footnote_refmark: "*%s"
33
+ html_footnote_textmark: "[*%s] "
34
+ html_footnote_backmark: "⏎"
32
35
  aut: "著 者"
33
36
  csl: "監 修"
34
37
  dsr: "デザイン"
@@ -114,6 +117,9 @@ en:
114
117
  ruby_prefix: "("
115
118
  ruby_postfix: ")"
116
119
  label_marker: "●● "
120
+ html_footnote_refmark: "*%s"
121
+ html_footnote_textmark: "[*%s] "
122
+ html_footnote_backmark: "⏎"
117
123
  aut: "Author"
118
124
  csl: "Consultant"
119
125
  dsr: "Design"
@@ -179,6 +185,9 @@ zh-TW:
179
185
  ruby_postfix: ")"
180
186
  external_link: "%s (%s)"
181
187
  label_marker: "●● "
188
+ html_footnote_refmark: "*%s"
189
+ html_footnote_textmark: "[*%s] "
190
+ html_footnote_backmark: "⏎"
182
191
  aut: "著作人"
183
192
  csl: "監 修"
184
193
  dsr: "美術編輯"
@@ -581,11 +581,11 @@ module ReVIEW
581
581
  end
582
582
 
583
583
  def comment(lines, comment = nil)
584
- return true unless @book.config['draft']
584
+ return unless @book.config['draft']
585
585
  lines ||= []
586
- lines.unshift comment unless comment.blank?
586
+ lines.unshift escape(comment) unless comment.blank?
587
587
  str = lines.join("\n")
588
- print "<msg>#{escape(str)}</msg>"
588
+ print "<msg>#{str}</msg>"
589
589
  end
590
590
 
591
591
  def inline_comment(str)
@@ -1,6 +1,6 @@
1
1
  # Copyright (c) 2002-2007 Minero Aoki
2
2
  # 2008-2009 Minero Aoki, Kenshi Muto
3
- # 2010-2018 Minero Aoki, Kenshi Muto, TAKAHASHI Masayoshi
3
+ # 2010-2019 Minero Aoki, Kenshi Muto, TAKAHASHI Masayoshi
4
4
  #
5
5
  # This program is free software.
6
6
  # You can distribute or modify this program under the terms of
@@ -477,7 +477,12 @@ module ReVIEW
477
477
  puts "\\includegraphics[width=\\maxwidth]{#{@chapter.image(id).path}}"
478
478
  end
479
479
  @doc_status[:caption] = true
480
- puts macro('caption', compile_inline(caption)) if caption.present?
480
+
481
+ if @book.config.check_version('2', exception: false)
482
+ puts macro('caption', compile_inline(caption)) if caption.present?
483
+ else
484
+ puts macro('reviewimagecaption', compile_inline(caption)) if caption.present?
485
+ end
481
486
  @doc_status[:caption] = nil
482
487
  puts macro('label', image_label(id))
483
488
  puts '\end{reviewimage}'
@@ -493,7 +498,11 @@ module ReVIEW
493
498
  end
494
499
  puts macro('label', image_label(id))
495
500
  @doc_status[:caption] = true
496
- puts macro('caption', compile_inline(caption)) if caption.present?
501
+ if @book.config.check_version('2', exception: false)
502
+ puts macro('caption', compile_inline(caption)) if caption.present?
503
+ else
504
+ puts macro('reviewimagecaption', compile_inline(caption)) if caption.present?
505
+ end
497
506
  @doc_status[:caption] = nil
498
507
  puts '\end{reviewdummyimage}'
499
508
  end
@@ -853,13 +862,13 @@ module ReVIEW
853
862
  end
854
863
 
855
864
  def comment(lines, comment = nil)
865
+ return true unless @book.config['draft']
856
866
  lines ||= []
857
867
  unless comment.blank?
858
- lines.unshift comment
868
+ lines.unshift escape(comment)
859
869
  end
860
- return true unless @book.config['draft']
861
870
  str = lines.join('\par ')
862
- puts macro('pdfcomment', escape(str))
871
+ puts macro('pdfcomment', str)
863
872
  end
864
873
 
865
874
  def hr
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2010-2017 Minero Aoki, Kenshi Muto
1
+ # Copyright (c) 2010-2019 Minero Aoki, Kenshi Muto
2
2
  # 2002-2009 Minero Aoki
3
3
  #
4
4
  # This program is free software.
@@ -69,6 +69,7 @@ module ReVIEW
69
69
  @repository = repo
70
70
  @config = param
71
71
  @logger = ReVIEW.logger
72
+ @leave_content = nil
72
73
  end
73
74
 
74
75
  def process(inf, outf)
@@ -106,6 +107,7 @@ module ReVIEW
106
107
  when /\A\#@mapfile/
107
108
  direc = parse_directive(line, 1, 'eval')
108
109
  path = expand(direc.arg)
110
+ @leave_content = File.extname(path) == '.re'
109
111
  if direc['eval']
110
112
  ent = evaluate(path, ent)
111
113
  else
@@ -116,6 +118,7 @@ module ReVIEW
116
118
  when /\A\#@map(?:range)?/
117
119
  direc = parse_directive(line, 2, 'unindent')
118
120
  path = expand(direc.args[0])
121
+ @leave_content = File.extname(path) == '.re'
119
122
  ent = @repository.fetch_range(path, direc.args[1]) or
120
123
  error "unknown range: #{path}: #{direc.args[1]}"
121
124
  ent = (direc['unindent'] ? unindent(ent, direc['unindent']) : ent)
@@ -127,6 +130,9 @@ module ReVIEW
127
130
  when /\A\#@/
128
131
  op = line.slice(/@(\w+)/, 1)
129
132
  warn "unknown directive: #{line.strip}" unless known_directive?(op)
133
+ if op == 'warn'
134
+ warn line.strip.sub(/\#@warn\((.+)\)/, '\1')
135
+ end
130
136
  @f.print line
131
137
 
132
138
  when /\A\s*\z/ # empty line
@@ -166,9 +172,11 @@ module ReVIEW
166
172
  @f.print line
167
173
  return nil
168
174
  when %r{\A//\}}
169
- warn '//} seen in list'
170
- @f.print line
171
- return nil
175
+ unless @leave_content
176
+ warn '//} seen in list'
177
+ @f.print line
178
+ return nil
179
+ end
172
180
  when /\A\#@\w/
173
181
  warn "#{line.slice(/\A\#@\w+/)} seen in list"
174
182
  @f.print line
@@ -357,6 +365,7 @@ module ReVIEW
357
365
  private
358
366
 
359
367
  def file_descripter(fname)
368
+ @leave_content = File.extname(fname) == '.re'
360
369
  return @repository[fname] if @repository[fname]
361
370
 
362
371
  @repository[fname] = git?(fname) ? parse_git_blob(fname) : parse_file(fname)
@@ -455,6 +464,10 @@ module ReVIEW
455
464
  end
456
465
 
457
466
  def canonical(line)
467
+ if @leave_content
468
+ return line
469
+ end
470
+
458
471
  tabwidth = @config['tabwidth'] || 8
459
472
  if tabwidth > 0
460
473
  detab(line, tabwidth).rstrip + "\n"
@@ -240,7 +240,7 @@ module ReVIEW
240
240
  unless comment.blank?
241
241
  lines.unshift comment
242
242
  end
243
- str = lines.join
243
+ str = lines.join("\n")
244
244
  puts "◆→#{str}←◆"
245
245
  end
246
246
 
@@ -1,3 +1,3 @@
1
1
  module ReVIEW
2
- VERSION = '3.0.0'.freeze
2
+ VERSION = '3.1.0'.freeze
3
3
  end
data/review.gemspec CHANGED
@@ -12,7 +12,7 @@ Gem::Specification.new do |gem|
12
12
  gem.summary = 'Re:VIEW: a easy-to-use digital publishing system'
13
13
  gem.description = 'Re:VIEW is a digital publishing system for books and ebooks. It supports InDesign, EPUB and LaTeX.'
14
14
  gem.required_rubygems_version = Gem::Requirement.new('>= 0') if gem.respond_to? :required_rubygems_version=
15
- gem.date = '2018-11-30'
15
+ gem.date = '2019-02-28'
16
16
 
17
17
  gem.files = `git ls-files`.split("\n")
18
18
  gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
@@ -9,9 +9,9 @@ task :copy_sty do
9
9
  Dir.glob(File.join(jsbook_dir, 'review-*.sty')) do |file|
10
10
  FileUtils.cp file, 'sty'
11
11
  end
12
- FileUtils.cp File.join(gentombow_dir, 'gentombow.sty'), 'sty/gentombow09j.sty'
12
+ FileUtils.cp File.join(gentombow_dir, 'gentombow.sty'), 'sty/gentombow.sty'
13
13
  end
14
14
 
15
- CLEAN.include([Dir.glob('sty/review-*.sty'), 'sty/review-jsbook.cls', 'sty/gentombow09j.sty'])
15
+ CLEAN.include([Dir.glob('sty/review-*.sty'), 'sty/review-jsbook.cls', 'sty/gentombow.sty'])
16
16
 
17
17
  Rake::Task[BOOK_PDF].enhance([:copy_sty])
@@ -9,9 +9,9 @@ task :copy_sty do
9
9
  Dir.glob(File.join(jsbook_dir, 'review-*.sty')) do |file|
10
10
  FileUtils.cp file, 'sty'
11
11
  end
12
- FileUtils.cp File.join(gentombow_dir, 'gentombow.sty'), 'sty/gentombow09j.sty'
12
+ FileUtils.cp File.join(gentombow_dir, 'gentombow.sty'), 'sty/gentombow.sty'
13
13
  end
14
14
 
15
- CLEAN.include([Dir.glob('sty/review-*.sty'), 'sty/review-jsbook.cls', 'sty/gentombow09j.sty'])
15
+ CLEAN.include([Dir.glob('sty/review-*.sty'), 'sty/review-jsbook.cls', 'sty/gentombow.sty'])
16
16
 
17
17
  Rake::Task[BOOK_PDF].enhance([:copy_sty])
@@ -98,4 +98,10 @@
98
98
  \def\reviewusepart{true}
99
99
  <%- end -%>
100
100
 
101
+ \def\reviewbackcompatibilityhook{
102
+ \@ifundefined{reviewimagecaption}{% for 3.0.0 compatibility
103
+ \newcommand{\reviewimagecaption}[1]{\caption{##1}}
104
+ }
105
+ }
106
+
101
107
  \makeatother
@@ -6,6 +6,9 @@
6
6
  <%- end -%>
7
7
  <%- end -%>
8
8
 
9
+ %% backward compatibility (defined in config.erb)
10
+ \reviewbackcompatibilityhook
11
+
9
12
  \begin{document}
10
13
 
11
14
  %% begindocument hook
@@ -59,11 +59,12 @@
59
59
  \begin{reviewtablesetup}\begin{tabular}{#1}}%
60
60
  {\end{tabular}\end{reviewtablesetup}}
61
61
 
62
+ \newcommand\reviewimagecaption[1]{\caption{#1}}
62
63
  \newcommand*\reviewimgtablecaption[1]{\caption{#1}}
63
64
 
64
65
  % コラム
65
66
  \newenvironment{reviewcolumn}[1][COLUMN]{%
66
- \begin{tcolorbox}[skin=enhanced jigsaw,breakable,boxrule=0.2mm,arc=2mm,colback=white,colframe=black!100!white,title={\sffamily\bfseries #1}]\par}
67
+ \begin{tcolorbox}[skin=enhanced jigsaw,breakable,boxrule=0.2mm,arc=2mm,colback=white,colframe=black!100!white,before upper={\parindent1\zw},title={\sffamily\bfseries #1}]\par}
67
68
  {\end{tcolorbox}}
68
69
 
69
70
  \newcommand{\reviewbackslash}[0]{\textbackslash{}}
@@ -107,6 +108,7 @@
107
108
  \renewcommand{\contentsname}{\review@toctitle}
108
109
 
109
110
  \newenvironment{reviewpart}{%
111
+ \setcounter{section}{0}%
110
112
  \renewcommand{\thesection}{\thepart.\@arabic\c@section}%
111
113
  }{}
112
114
 
@@ -246,11 +248,7 @@
246
248
  \thispagestyle{empty}
247
249
  \begin{center}%
248
250
  \mbox{}%
249
- \ifx\review@jlreq@driver\review@jlreq@driver@luatex
250
- \vskip5\zw
251
- \else
252
- \vskip5zw
253
- \fi
251
+ \vskip5\zw
254
252
  \reviewtitlefont%
255
253
  {\Huge\review@booktitlename\par}%
256
254
  \ifdefined\review@subtitlename
@@ -265,11 +263,7 @@
265
263
  \end{tabular}\par}%
266
264
  \vfill
267
265
  {\large\review@date \review@intn@edition%
268
- \ifx\review@jlreq@driver\review@jlreq@driver@luatex
269
- \hspace{2\zw}%
270
- \else
271
- \hspace{2zw}%
272
- \fi
266
+ \hspace{2\zw}%
273
267
  \review@intn@publishedby\par}%
274
268
  \vskip4\zw\mbox{}
275
269
  \end{center}%
@@ -314,9 +308,9 @@
314
308
  \rule[8pt]{\textwidth}{1pt} \\
315
309
  {\noindent\review@pubhistories}
316
310
 
317
- \begin{tabular}{p{3em}p{\dimexpr\textwidth-6em}}
311
+ \begin{tabularx}{\dimexpr\textwidth-0.5em}{lX}
318
312
  \review@colophonnames
319
- \end{tabular}
313
+ \end{tabularx}
320
314
   \\
321
315
  \rule[0pt]{\textwidth}{1pt} \\
322
316
  \ifdefined\review@rights
@@ -1,5 +1,5 @@
1
1
  %#!ptex2pdf -l -u -ot '-synctex=1' test-rejlreqbk
2
- % Copyright (c) 2018 Kenshi Muto.
2
+ % Copyright (c) 2018-2019 Kenshi Muto.
3
3
  %
4
4
  % Permission is hereby granted, free of charge, to any person obtaining a copy
5
5
  % of this software and associated documentation files (the "Software"), to deal
@@ -20,7 +20,7 @@
20
20
  % THE SOFTWARE.
21
21
 
22
22
  \NeedsTeXFormat{LaTeX2e}
23
- \ProvidesClass{review-jlreq}[2018/10/05 Re:VIEW pLaTeX class modified for jlreq.
23
+ \ProvidesClass{review-jlreq}[2019/01/01 Re:VIEW pLaTeX class modified for jlreq.
24
24
  cls]
25
25
 
26
26
  %% hook at end of reviewmacro
@@ -92,7 +92,7 @@ cls]
92
92
  \edef\recls@tmp{\thepage}%
93
93
  \lower\dimexpr4pt+\recls@tombobleed+.5\paperheight+5\p@\hbox{%
94
94
  \vbox{\expandafter\@tfor\expandafter\recls@x\expandafter:\expandafter=\recls@tmp\do{%
95
- \hbox to 1zw{\hss\recls@x\hss}}}}}%
95
+ \hbox to 1\zw{\hss\recls@x\hss}}}}}%
96
96
  \ifodd\c@page
97
97
  \rlap{\recls@hiddfolio}%
98
98
  \else
@@ -161,7 +161,7 @@ cls]
161
161
  \def\recls@engine{}
162
162
  \def\recls@driver{}
163
163
  \ifdefined\jlreq@trimmarks@engine
164
- \ifx l\jlreq@trimmarks@engine\def\recls@engine{lualatex}\fi
164
+ \ifx l\jlreq@trimmarks@engine\def\recls@engine{lualatex}\def\recls@driver{luatex}\fi
165
165
  \ifx u\jlreq@trimmarks@engine\def\recls@engine{uplatex}\fi
166
166
  \ifx p\jlreq@trimmarks@engine\def\recls@engine{platex}\fi
167
167
  \else% jlreqから持ってくる
@@ -194,14 +194,22 @@ cls]
194
194
  \RequirePackage[\recls@driver]{graphicx}
195
195
  \RequirePackage[\recls@driver,table]{xcolor}
196
196
 
197
- \RequirePackage[T1]{fontenc}
197
+ % luatex固有
198
+ \def\recls@tmp{luatex}\ifx\recls@tmp\recls@driver
199
+ \DeclareGraphicsRule{.ai}{pdf}{.ai}{}
200
+ \usepackage[no-math]{fontspec}
201
+ \else
202
+ \RequirePackage[T1]{fontenc}
203
+ \RequirePackage{lmodern}%\ttdefault: lmtt
204
+ \fi
205
+
198
206
  \RequirePackage{textcomp}%T1/TS1
199
- \RequirePackage{lmodern}%\ttdefault: lmtt
200
207
  \RequirePackage{tikz}
201
208
  \usetikzlibrary{calc}
202
209
  \RequirePackage{multirow}
203
210
  \RequirePackage{amsmath}
204
211
  \RequirePackage{amssymb}
212
+ \RequirePackage{amsthm}
205
213
  \RequirePackage{needspace}
206
214
  \RequirePackage{alltt}
207
215
  \RequirePackage{float}
@@ -211,14 +219,20 @@ cls]
211
219
  \RequirePackage{tcolorbox}
212
220
  \tcbuselibrary{xparse,hooks,skins,breakable}
213
221
  \RequirePackage{ulem}
222
+ \RequirePackage{tabularx}
214
223
 
215
- \RequirePackage[dvipdfmx, \if@pdfhyperlink\else draft,\fi
224
+ \def\recls@tmp{luatex}
225
+ \RequirePackage[\recls@driver, \if@pdfhyperlink\else draft,\fi
226
+ \ifx\recls@tmp\recls@driver unicode,\fi
216
227
  bookmarks=true,
217
228
  bookmarksnumbered=true,
218
229
  hidelinks,
219
230
  setpagesize=false,
220
231
  ]{hyperref}
221
- \RequirePackage[\recls@driver]{pxjahyper}
232
+
233
+ \def\recls@tmp{uplatex}\ifx\recls@tmp\recls@engine
234
+ \RequirePackage[\recls@driver]{pxjahyper}
235
+ \fi
222
236
 
223
237
  %% include fullpage graphics
224
238
  \edef\grnchry@head{\dimexpr\topmargin+1in+\headheight+\headsep}
@@ -259,6 +273,25 @@ cls]
259
273
  \hbox{}\thispagestyle{empty}\newpage\if@twocolumn\hbox{}\newpage\fi\fi\fi}
260
274
  \let\clearoddpage\cleardoublepage@left
261
275
 
276
+ %% 行のサンプル。\makelines{行数} で「■□■□…」からなる行を指定行数配置する
277
+ \def\makelines#1{%
278
+ \@tempcnta\z@\relax
279
+ \def\@makeline@f@size{\f@size}%
280
+ \@whilenum\@tempcnta<#1\do{%
281
+ \advance\@tempcnta\@ne\relax
282
+ \noindent\rlap{\the\@tempcnta}\nobreak
283
+ \makelines@neline\par}%
284
+ }
285
+ \def\makelines@unit@#10#2\relax{%
286
+ \ifx!#2!\relax □\else\relax ■\fi}%
287
+ \newcounter{makelines@unit}
288
+ \def\makelines@neline{%
289
+ \c@makelines@unit\@ne
290
+ \@whilenum\c@makelines@unit<\dimexpr(\textwidth + \Cwd)/\Cwd\do{%
291
+ \expandafter\makelines@unit@\the\c@makelines@unit0\relax
292
+ \advance\c@makelines@unit\@ne}%
293
+ }
294
+
262
295
  % シンプルな通しノンブル
263
296
  \ifrecls@serialpage
264
297
  \jlreqsetup{frontmatter_pagination=continuous}
@@ -283,5 +316,23 @@ cls]
283
316
  \if@restonecol\twocolumn\else\newpage\fi
284
317
  }
285
318
 
319
+ % pdfpagesのトンボずれへの対処
320
+ \if@pdftombo
321
+ \def\recls@patch@pdfpages{%
322
+ \patchcmd{\AM@output}{%
323
+ \setlength{\@tempdima}{\AM@xmargin}%
324
+ \edef\AM@xmargin{\the\@tempdima}%
325
+ \setlength{\@tempdima}{\AM@ymargin}%
326
+ \edef\AM@ymargin{\the\@tempdima}%
327
+ }{%
328
+ \setlength{\@tempdima}{\AM@xmargin+1in}%
329
+ \edef\AM@xmargin{\the\@tempdima}%
330
+ \setlength{\@tempdima}{\AM@ymargin-1in}%
331
+ \edef\AM@ymargin{\the\@tempdima}%
332
+ }%
333
+ }{\message{patch for pdfpages applied}}{}
334
+ \AtBeginDocument{\@ifpackageloaded{pdfpages}{\recls@patch@pdfpages}{}}
335
+ \fi
336
+
286
337
  \listfiles
287
338
  \endinput
@@ -34,6 +34,10 @@
34
34
  \RequirePackage{float}
35
35
  \RequirePackage{alltt}
36
36
  \RequirePackage{amsmath}
37
+ \RequirePackage{amssymb}
38
+ \RequirePackage{amsthm}
39
+ \RequirePackage{bm}
40
+ \RequirePackage{tabularx}
37
41
 
38
42
  %% if you use @<u>{} (underline), use jumoline.sty
39
43
  \IfFileExists{jumoline.sty}{
@@ -165,6 +169,9 @@
165
169
  \WithSuffix\newcommand\reviewtablecaption*[1]{%
166
170
  \caption*{#1}}
167
171
 
172
+ \newcommand\reviewimagecaption[1]{%
173
+ \caption{#1}}
174
+
168
175
  \newcommand{\reviewimgtablecaption}[1]{%
169
176
  \caption{#1}\vspace{-3mm}}
170
177
 
@@ -198,6 +205,7 @@
198
205
  \newcommand{\reviewsecref}[2]{#1}
199
206
 
200
207
  \newenvironment{reviewpart}{%
208
+ \setcounter{section}{0}%
201
209
  \renewcommand{\thesection}{\thepart.\@arabic\c@section}%
202
210
  }{}
203
211
 
@@ -414,9 +422,9 @@
414
422
  \rule[8pt]{\textwidth}{1pt} \\
415
423
  {\noindent\review@pubhistories}
416
424
 
417
- \begin{tabular}{p{3em}p{\dimexpr\textwidth-6em}}
425
+ \begin{tabularx}{\dimexpr\textwidth-0.5em}{lX}
418
426
  \review@colophonnames
419
- \end{tabular}
427
+ \end{tabularx}
420
428
   \\
421
429
  \rule[0pt]{\textwidth}{1pt} \\
422
430
  \ifdefined\review@rights
@@ -331,7 +331,7 @@
331
331
  \ifx\recls@number@of@lines\@empty\else
332
332
  \setlength\textheight{\recls@number@of@lines\Cvs}
333
333
  \addtolength\textheight{-\Cvs}\addtolength\textheight{\Cwd}
334
- \addtolength\textheight{1H}
334
+ \addtolength\textheight{\dimexpr\topskip-\Cht}%%adjustment for jsbook.cls's \topskip
335
335
  \fi
336
336
 
337
337
  %% ノド、小口
@@ -429,6 +429,25 @@
429
429
  \hbox{}\thispagestyle{empty}\newpage\if@twocolumn\hbox{}\newpage\fi\fi\fi}
430
430
  \let\clearoddpage\cleardoublepage@left
431
431
 
432
+ %% 行のサンプル。\makelines{行数} で「■□■□…」からなる行を指定行数配置する
433
+ \def\makelines#1{%
434
+ \@tempcnta\z@\relax
435
+ \def\@makeline@f@size{\f@size}%
436
+ \@whilenum\@tempcnta<#1\do{%
437
+ \advance\@tempcnta\@ne\relax
438
+ \noindent\rlap{\the\@tempcnta}\nobreak
439
+ \makelines@neline\par}%
440
+ }
441
+ \def\makelines@unit@#10#2\relax{%
442
+ \ifx!#2!\relax □\else\relax ■\fi}%
443
+ \newcounter{makelines@unit}
444
+ \def\makelines@neline{%
445
+ \c@makelines@unit\@ne
446
+ \@whilenum\c@makelines@unit<\dimexpr(\textwidth + \Cwd)/\Cwd\do{%
447
+ \expandafter\makelines@unit@\the\c@makelines@unit0\relax
448
+ \advance\c@makelines@unit\@ne}%
449
+ }
450
+
432
451
  %% coverオプションによる表紙判定の上書き
433
452
  \def\recls@tmp{true}\ifx\recls@forcecover\recls@tmp
434
453
  \@reclscovertrue
@@ -44,9 +44,18 @@
44
44
  \def\reviewappendixfiles{}
45
45
  \def\reviewpostdeffiles{}
46
46
 
47
+ \def\reviewbackcompatibilityhook{
48
+ \@ifundefined{reviewimagecaption}{% for 3.0.0 compatibility
49
+ \newcommand{\reviewimagecaption}[1]{\caption{##1}}
50
+ }
51
+ }
52
+
47
53
  \makeatother
48
54
 
49
55
 
56
+ %% backward compatibility (defined in config.erb)
57
+ \reviewbackcompatibilityhook
58
+
50
59
  \begin{document}
51
60
 
52
61
  %% begindocument hook
@@ -55,9 +55,18 @@ some ad content
55
55
  \def\reviewappendixfiles{}
56
56
  \def\reviewpostdeffiles{}
57
57
 
58
+ \def\reviewbackcompatibilityhook{
59
+ \@ifundefined{reviewimagecaption}{% for 3.0.0 compatibility
60
+ \newcommand{\reviewimagecaption}[1]{\caption{##1}}
61
+ }
62
+ }
63
+
58
64
  \makeatother
59
65
 
60
66
 
67
+ %% backward compatibility (defined in config.erb)
68
+ \reviewbackcompatibilityhook
69
+
61
70
  \begin{document}
62
71
 
63
72
  %% begindocument hook
@@ -13,6 +13,7 @@ class HTMLBuidlerTest < Test::Unit::TestCase
13
13
  @config['secnolevel'] = 2
14
14
  @config['stylesheet'] = nil
15
15
  @config['htmlext'] = 'html'
16
+ @config['epubmaker'] = {}
16
17
  @book = Book::Base.new('.')
17
18
  @book.config = @config
18
19
  @compiler = ReVIEW::Compiler.new(@builder)
@@ -1590,17 +1591,33 @@ EOS
1590
1591
  assert_equal expected, actual
1591
1592
  end
1592
1593
 
1593
- def test_inline_fn
1594
+ def test_footnote
1594
1595
  fn = Book::FootnoteIndex.parse(['//footnote[foo][bar\\a\\$buz]'])
1595
1596
  @chapter.instance_eval { @footnote_index = fn }
1596
1597
  actual = compile_block("//footnote[foo][bar\\a\\$buz]\n")
1597
1598
  expected = <<-'EOS'
1598
1599
  <div class="footnote" epub:type="footnote" id="fn-foo"><p class="footnote">[*1] bar\a\$buz</p></div>
1600
+ EOS
1601
+ assert_equal expected, actual
1602
+
1603
+ @book.config['epubmaker'] ||= {}
1604
+ @book.config['epubmaker']['back_footnote'] = true
1605
+ actual = compile_block("//footnote[foo][bar\\a\\$buz]\n")
1606
+ expected = <<-'EOS'
1607
+ <div class="footnote" epub:type="footnote" id="fn-foo"><p class="footnote"><a href="#fnb-foo">⏎</a>[*1] bar\a\$buz</p></div>
1608
+ EOS
1609
+ assert_equal expected, actual
1610
+
1611
+ I18n.set('html_footnote_textmark', '+%s:')
1612
+ I18n.set('html_footnote_backmark', '←')
1613
+ actual = compile_block("//footnote[foo][bar\\a\\$buz]\n")
1614
+ expected = <<-'EOS'
1615
+ <div class="footnote" epub:type="footnote" id="fn-foo"><p class="footnote"><a href="#fnb-foo">←</a>+1:bar\a\$buz</p></div>
1599
1616
  EOS
1600
1617
  assert_equal expected, actual
1601
1618
  end
1602
1619
 
1603
- def test_inline_fn_with_tricky_id
1620
+ def test_footnote_with_tricky_id
1604
1621
  fn = Book::FootnoteIndex.parse(['//footnote[123 あ_;][bar\\a\\$buz]'])
1605
1622
  @chapter.instance_eval { @footnote_index = fn }
1606
1623
  actual = compile_block("//footnote[123 あ_;][bar\\a\\$buz]\n")
@@ -1610,6 +1627,22 @@ EOS
1610
1627
  assert_equal expected, actual
1611
1628
  end
1612
1629
 
1630
+ def test_inline_fn
1631
+ book = ReVIEW::Book::Base.load
1632
+ book.catalog = ReVIEW::Catalog.new('CHAPS' => %w[ch1.re])
1633
+ io1 = StringIO.new("//footnote[foo][bar]\n")
1634
+ chap1 = ReVIEW::Book::Chapter.new(book, 1, 'ch1', 'ch1.re', io1)
1635
+ book.parts = [ReVIEW::Book::Part.new(self, nil, [chap1])]
1636
+ builder = ReVIEW::HTMLBuilder.new
1637
+ comp = ReVIEW::Compiler.new(builder)
1638
+ builder.bind(comp, chap1, nil)
1639
+ fn = builder.inline_fn('foo')
1640
+ assert_equal '<a id="fnb-foo" href="#fn-foo" class="noteref" epub:type="noteref">*1</a>', fn
1641
+ I18n.set('html_footnote_refmark', '+%s')
1642
+ fn = builder.inline_fn('foo')
1643
+ assert_equal '<a id="fnb-foo" href="#fn-foo" class="noteref" epub:type="noteref">+1</a>', fn
1644
+ end
1645
+
1613
1646
  def test_inline_hd
1614
1647
  book = ReVIEW::Book::Base.load
1615
1648
  book.catalog = ReVIEW::Catalog.new('CHAPS' => %w[ch1.re ch2.re])
@@ -1725,8 +1758,10 @@ EOS
1725
1758
 
1726
1759
  def test_comment_for_draft
1727
1760
  @config['draft'] = true
1728
- actual = compile_block('//comment[コメント]')
1729
- assert_equal %Q(<div class="draft-comment">コメント</div>\n), actual
1761
+ actual = compile_block('//comment[コメント<]')
1762
+ assert_equal %Q(<div class="draft-comment">コメント&lt;</div>\n), actual
1763
+ actual = compile_block("//comment{\nA<>\nB&\n//}")
1764
+ assert_equal %Q(<div class="draft-comment">A&lt;&gt;<br />B&amp;</div>\n), actual
1730
1765
  end
1731
1766
 
1732
1767
  def test_inline_comment
@@ -721,8 +721,10 @@ EOS
721
721
 
722
722
  def test_comment_for_draft
723
723
  @config['draft'] = true
724
- actual = compile_block('//comment[コメント]')
725
- assert_equal '<msg>コメント</msg>', actual
724
+ actual = compile_block('//comment[コメント<]')
725
+ assert_equal '<msg>コメント&lt;</msg>', actual
726
+ actual = compile_block("//comment{\nA<>\nB&\n//}")
727
+ assert_equal %Q(<msg>A&lt;&gt;\nB&amp;</msg>), actual
726
728
  end
727
729
 
728
730
  def test_inline_comment
@@ -450,7 +450,7 @@ class LATEXBuidlerTest < Test::Unit::TestCase
450
450
  end
451
451
 
452
452
  actual = compile_block("//image[sampleimg][sample photo]{\n//}\n")
453
- assert_equal %Q(\\begin{reviewimage}%%sampleimg\n\\includegraphics[width=\\maxwidth]{./images/chap1-sampleimg.png}\n\\caption{sample photo}\n\\label{image:chap1:sampleimg}\n\\end{reviewimage}\n), actual
453
+ assert_equal %Q(\\begin{reviewimage}%%sampleimg\n\\includegraphics[width=\\maxwidth]{./images/chap1-sampleimg.png}\n\\reviewimagecaption{sample photo}\n\\label{image:chap1:sampleimg}\n\\end{reviewimage}\n), actual
454
454
  end
455
455
 
456
456
  def test_image_with_metric
@@ -461,7 +461,7 @@ class LATEXBuidlerTest < Test::Unit::TestCase
461
461
  end
462
462
 
463
463
  actual = compile_block("//image[sampleimg][sample photo][scale=1.2]{\n//}\n")
464
- assert_equal %Q(\\begin{reviewimage}%%sampleimg\n\\includegraphics[scale=1.2]{./images/chap1-sampleimg.png}\n\\caption{sample photo}\n\\label{image:chap1:sampleimg}\n\\end{reviewimage}\n), actual
464
+ assert_equal %Q(\\begin{reviewimage}%%sampleimg\n\\includegraphics[scale=1.2]{./images/chap1-sampleimg.png}\n\\reviewimagecaption{sample photo}\n\\label{image:chap1:sampleimg}\n\\end{reviewimage}\n), actual
465
465
  end
466
466
 
467
467
  def test_image_with_metric_width
@@ -473,7 +473,7 @@ class LATEXBuidlerTest < Test::Unit::TestCase
473
473
 
474
474
  @config['image_scale2width'] = true
475
475
  actual = compile_block("//image[sampleimg][sample photo][scale=1.2]{\n//}\n")
476
- assert_equal %Q(\\begin{reviewimage}%%sampleimg\n\\includegraphics[width=1.2\\maxwidth]{./images/chap1-sampleimg.png}\n\\caption{sample photo}\n\\label{image:chap1:sampleimg}\n\\end{reviewimage}\n), actual
476
+ assert_equal %Q(\\begin{reviewimage}%%sampleimg\n\\includegraphics[width=1.2\\maxwidth]{./images/chap1-sampleimg.png}\n\\reviewimagecaption{sample photo}\n\\label{image:chap1:sampleimg}\n\\end{reviewimage}\n), actual
477
477
  end
478
478
 
479
479
  def test_image_with_metric2
@@ -484,7 +484,7 @@ class LATEXBuidlerTest < Test::Unit::TestCase
484
484
  end
485
485
 
486
486
  actual = compile_block("//image[sampleimg][sample photo][scale=1.2,html::class=sample,latex::ignore=params]{\n//}\n")
487
- assert_equal %Q(\\begin{reviewimage}%%sampleimg\n\\includegraphics[scale=1.2,ignore=params]{./images/chap1-sampleimg.png}\n\\caption{sample photo}\n\\label{image:chap1:sampleimg}\n\\end{reviewimage}\n), actual
487
+ assert_equal %Q(\\begin{reviewimage}%%sampleimg\n\\includegraphics[scale=1.2,ignore=params]{./images/chap1-sampleimg.png}\n\\reviewimagecaption{sample photo}\n\\label{image:chap1:sampleimg}\n\\end{reviewimage}\n), actual
488
488
  end
489
489
 
490
490
  def test_image_with_metric2_width
@@ -496,7 +496,7 @@ class LATEXBuidlerTest < Test::Unit::TestCase
496
496
 
497
497
  @config['image_scale2width'] = true
498
498
  actual = compile_block("//image[sampleimg][sample photo][scale=1.2,html::class=sample,latex::ignore=params]{\n//}\n")
499
- assert_equal %Q(\\begin{reviewimage}%%sampleimg\n\\includegraphics[width=1.2\\maxwidth,ignore=params]{./images/chap1-sampleimg.png}\n\\caption{sample photo}\n\\label{image:chap1:sampleimg}\n\\end{reviewimage}\n), actual
499
+ assert_equal %Q(\\begin{reviewimage}%%sampleimg\n\\includegraphics[width=1.2\\maxwidth,ignore=params]{./images/chap1-sampleimg.png}\n\\reviewimagecaption{sample photo}\n\\label{image:chap1:sampleimg}\n\\end{reviewimage}\n), actual
500
500
  end
501
501
 
502
502
  def test_indepimage
@@ -993,8 +993,10 @@ EOS
993
993
 
994
994
  def test_comment_for_draft
995
995
  @config['draft'] = true
996
- actual = compile_block('//comment[コメント]')
997
- assert_equal %Q(\\pdfcomment{コメント}\n), actual
996
+ actual = compile_block('//comment[コメント<]')
997
+ assert_equal %Q(\\pdfcomment{コメント\\textless{}}\n), actual
998
+ actual = compile_block("//comment{\nA<>\nB&\n//}")
999
+ assert_equal %Q(\\pdfcomment{A\\textless{}\\textgreater{}\\par B\\&}\n), actual
998
1000
  end
999
1001
 
1000
1002
  def test_inline_comment
@@ -1132,7 +1134,7 @@ EOS
1132
1134
 
1133
1135
  \\begin{reviewimage}%%sampleimg
1134
1136
  \\includegraphics[width=\\maxwidth]{./images/chap1-sampleimg.png}
1135
- \\caption{FOO}
1137
+ \\reviewimagecaption{FOO}
1136
1138
  \\label{image:chap1:sampleimg}
1137
1139
  \\end{reviewimage}
1138
1140
  EOS
@@ -182,8 +182,10 @@ class TOPBuidlerTest < Test::Unit::TestCase
182
182
 
183
183
  def test_comment_for_draft
184
184
  @config['draft'] = true
185
- actual = compile_block('//comment[コメント]')
186
- assert_equal %Q(◆→コメント←◆\n), actual
185
+ actual = compile_block('//comment[コメント<]')
186
+ assert_equal %Q(◆→コメント<←◆\n), actual
187
+ actual = compile_block("//comment{\nA<>\nB&\n//}")
188
+ assert_equal %Q(◆→A<>\nB&←◆\n), actual
187
189
  end
188
190
 
189
191
  def test_list
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: review
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 3.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - kmuto
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-11-30 00:00:00.000000000 Z
12
+ date: 2019-02-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: image_size