review 4.1.0 → 4.2.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 +4 -4
- data/.github/workflows/ruby.yml +1 -1
- data/.rubocop.yml +4 -1
- data/NEWS.ja.md +29 -0
- data/NEWS.md +29 -0
- data/bin/review-index +2 -89
- data/bin/review-vol +4 -78
- data/doc/config.yml.sample +18 -5
- data/doc/config.yml.sample-simple +1 -1
- data/doc/pdfmaker.ja.md +42 -0
- data/doc/pdfmaker.md +41 -0
- data/doc/quickstart.ja.md +8 -5
- data/doc/quickstart.md +7 -4
- data/lib/review/book/base.rb +2 -4
- data/lib/review/book/compilable.rb +1 -5
- data/lib/review/book/page_metric.rb +7 -7
- data/lib/review/book/part.rb +6 -3
- data/lib/review/book/volume.rb +3 -4
- data/lib/review/builder.rb +23 -10
- data/lib/review/compiler.rb +9 -9
- data/lib/review/configure.rb +6 -0
- data/lib/review/epubmaker.rb +1 -1
- data/lib/review/htmlbuilder.rb +56 -16
- data/lib/review/idgxmlbuilder.rb +63 -22
- data/lib/review/latexbuilder.rb +70 -19
- data/lib/review/makerhelper.rb +18 -1
- data/lib/review/pdfmaker.rb +8 -1
- data/lib/review/plaintextbuilder.rb +41 -11
- data/lib/review/textmaker.rb +1 -1
- data/lib/review/textutils.rb +2 -3
- data/lib/review/tocprinter.rb +231 -102
- data/lib/review/topbuilder.rb +47 -13
- data/lib/review/version.rb +1 -1
- data/lib/review/volumeprinter.rb +99 -0
- data/lib/review/webmaker.rb +1 -1
- data/lib/review/webtocprinter.rb +38 -35
- data/review.gemspec +1 -1
- data/samples/sample-book/src/config.yml +1 -1
- data/templates/web/html/layout-html5.html.erb +2 -2
- data/test/test_book.rb +1 -1
- data/test/test_book_part.rb +3 -3
- data/test/test_helper.rb +4 -1
- data/test/test_htmlbuilder.rb +179 -0
- data/test/test_idgxmlbuilder.rb +143 -0
- data/test/test_latexbuilder.rb +223 -0
- data/test/test_pdfmaker.rb +17 -0
- data/test/test_plaintextbuilder.rb +99 -0
- data/test/test_topbuilder.rb +116 -2
- data/test/test_webtocprinter.rb +66 -34
- metadata +3 -5
- data/lib/review/tocparser.rb +0 -275
- data/test/test_tocparser.rb +0 -25
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6045860e33279138a91d9f6fcdecc9dd589c448c9e576858f41969d3fe73fa79
|
|
4
|
+
data.tar.gz: 70ccce6b312cf4802261417393e724f6cfbc9d97aa7afd7a2d4783af148ba1ea
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7c0bbe35d45e9b099fcc6f1114b3e0cc8b0c8edc2cb1af04288c71a01e188bc1a4e88c68ccb905c30912d82082a822526f0721034b85c1b530b607341404e2d5
|
|
7
|
+
data.tar.gz: 7b2010fa445336f13a5067a436957e9899dd17af042ef816c7d742c36c2afd8dbad6c7d0a1a11d572e2f57212e06f100a51403bad0101a5ce9cb8e10505ac531
|
data/.github/workflows/ruby.yml
CHANGED
data/.rubocop.yml
CHANGED
|
@@ -58,6 +58,9 @@ Performance/StringReplacement:
|
|
|
58
58
|
Performance/RangeInclude:
|
|
59
59
|
Enabled: true
|
|
60
60
|
|
|
61
|
+
Performance/DeletePrefix:
|
|
62
|
+
Enabled: false
|
|
63
|
+
|
|
61
64
|
#### Style
|
|
62
65
|
|
|
63
66
|
Style/AccessModifierDeclarations:
|
|
@@ -428,7 +431,7 @@ Metrics/BlockNesting:
|
|
|
428
431
|
Max: 4
|
|
429
432
|
|
|
430
433
|
Metrics/ModuleLength:
|
|
431
|
-
Max:
|
|
434
|
+
Max: 300
|
|
432
435
|
|
|
433
436
|
Metrics/ParameterLists:
|
|
434
437
|
Max: 8
|
data/NEWS.ja.md
CHANGED
|
@@ -1,3 +1,32 @@
|
|
|
1
|
+
# Version 4.2.0
|
|
2
|
+
## 新機能
|
|
3
|
+
* 図・表・リスト・式のキャプションの位置を内容の上側・下側どちらにするかを指定する `caption_position` パラメータを追加しました。`caption_position` の下位パラメータとして `image`・`table`・`list`・`equation` のパラメータがあり、値として `top` (上側) または `bottom` (下側) を指定します。デフォルトは `image` のみ `bottom`、ほかは `top` です ([#1320])
|
|
4
|
+
|
|
5
|
+
## 非互換の変更
|
|
6
|
+
* review-vol を再構成しました。部の処理や見出し内のインライン命令の処理を正しました。表示形式をわかりやすい形に変更しました。部を指定したときに部のボリュームではなく、部ファイル単体のボリュームを返すようにしました。`-P`, `--directory` オプションは廃止しました ([#1485])
|
|
7
|
+
* review-index を再構成しました。オプション名を大幅に変更しています。行数・文字数は `-d` オプションを指定したときのみ表示するようにしました。また、ファイルの行数・文字数ではなく、PLAINTEXTBuilder を利用して、変換結果に近い行数・文字数を返すようにしました (review-vol よりも正確です)。特定の章は `-y` オプションで複数指定できるようにしました ([#1485])
|
|
8
|
+
|
|
9
|
+
## バグ修正
|
|
10
|
+
* 重複する `@non_parsed_commands` 宣言を削除しました ([#1499])
|
|
11
|
+
* WebMaker、TextMaker で数式画像が作成されない問題を修正しました ([#1501])
|
|
12
|
+
|
|
13
|
+
## 機能強化
|
|
14
|
+
* imgmath での数式画像の作成処理を最適化し、高速化しました ([#1488])
|
|
15
|
+
* デフォルト以外の固有の YAML 設定を PDFMaker に引き渡したいときのために、`layouts/config-local.tex.erb` ファイルが存在すればそれを評価・読み込みするようにしました ([#1505])
|
|
16
|
+
|
|
17
|
+
## その他
|
|
18
|
+
* GitHub Actions を eregon/use-ruby-action から ruby/setup-ruby に切り替えました ([#1490])
|
|
19
|
+
* テストの際、samples フォルダ内にあるビルド成果物を無視するようにしました ([#1504])
|
|
20
|
+
|
|
21
|
+
[#1320]: https://github.com/kmuto/review/issues/1320
|
|
22
|
+
[#1485]: https://github.com/kmuto/review/issues/1485
|
|
23
|
+
[#1488]: https://github.com/kmuto/review/issues/1488
|
|
24
|
+
[#1490]: https://github.com/kmuto/review/pull/1490
|
|
25
|
+
[#1499]: https://github.com/kmuto/review/issues/1499
|
|
26
|
+
[#1501]: https://github.com/kmuto/review/pull/1501
|
|
27
|
+
[#1504]: https://github.com/kmuto/review/pull/1504
|
|
28
|
+
[#1505]: https://github.com/kmuto/review/issues/1505
|
|
29
|
+
|
|
1
30
|
# Version 4.1.0
|
|
2
31
|
## 新機能
|
|
3
32
|
* 表のセル区切りの文字を `table_row_separator` パラメータで変更できるようにしました。指定可能な値は tabs (1個以上のタブ、デフォルト)、singletab (1文字のタブ文字区切り)、spaces (1文字以上のスペースまたはタブ文字の区切り)、 verticalbar ("0個以上の空白 | 0個以上の空白" の区切り) です ([#1420])
|
data/NEWS.md
CHANGED
|
@@ -1,3 +1,32 @@
|
|
|
1
|
+
# Version 4.2.0
|
|
2
|
+
## New Features
|
|
3
|
+
* introduce `caption_position` parameter to specify a caption position of image, table, list, and equation. `caption_position` has child parameters `image`, `table`, `list`, and `equation` and the value is `top` or `bottom` ([#1320])
|
|
4
|
+
|
|
5
|
+
## Breaking Changes
|
|
6
|
+
* review-vol is rewritten. Improved processing of parts and inline instructions in headings. Changed display format. When a part is specified, the volume of the part file itself is returned instead of the volume of the part. The `-P` and `--directory` options have been removed ([#1485])
|
|
7
|
+
* review-index is rewritten. Most option names have been changed. The number of lines and characters are now displayed only when `-d` option is specified. review-index uses PLAINTEXTBuilder to return accurate line and character counts. `-y` option is provided to specify a target chapter ([#1485])
|
|
8
|
+
|
|
9
|
+
## Bug Fixes
|
|
10
|
+
* remove duplicated `@non_parsed_commands` declaration ([#1499])
|
|
11
|
+
* mathematical images not being created in WebMaker and TextMaker has been fixed ([#1501])
|
|
12
|
+
|
|
13
|
+
## Enhancements
|
|
14
|
+
* improve a performance of building math figures on imgmath ([#1488])
|
|
15
|
+
* for those times when you want to hand over non-default YAML parameters to PDFMaker, you can write your own `layouts/config-local.tex.erb` file ([#1505])
|
|
16
|
+
|
|
17
|
+
## Others
|
|
18
|
+
* GitHub Actions: use `ruby/setup-ruby` instead of `eregon/use-ruby-action` ([#1490])
|
|
19
|
+
* skip artifacts in the sample folder during testing ([#1504])
|
|
20
|
+
|
|
21
|
+
[#1320]: https://github.com/kmuto/review/issues/1320
|
|
22
|
+
[#1485]: https://github.com/kmuto/review/issues/1485
|
|
23
|
+
[#1488]: https://github.com/kmuto/review/issues/1488
|
|
24
|
+
[#1490]: https://github.com/kmuto/review/pull/1490
|
|
25
|
+
[#1499]: https://github.com/kmuto/review/issues/1499
|
|
26
|
+
[#1501]: https://github.com/kmuto/review/pull/1501
|
|
27
|
+
[#1504]: https://github.com/kmuto/review/pull/1504
|
|
28
|
+
[#1505]: https://github.com/kmuto/review/issues/1505
|
|
29
|
+
|
|
1
30
|
# Version 4.1.0
|
|
2
31
|
## New Features
|
|
3
32
|
* add `table_row_separator` to specify a separator that separates table rows. Accceptable value: tabs (means `\t+`, default), `singletab` (means `\t`), spaces (means `\s+`), verticalbar (means `\s*\|\s*`) ([#1420])
|
data/bin/review-index
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env ruby
|
|
2
2
|
#
|
|
3
|
-
# Copyright (c) 2008-
|
|
3
|
+
# Copyright (c) 2008-2020 Minero Aoki, Kenshi Muto
|
|
4
4
|
# 1999-2007 Minero Aoki
|
|
5
5
|
#
|
|
6
6
|
# This program is free software.
|
|
@@ -14,93 +14,6 @@ require 'pathname'
|
|
|
14
14
|
bindir = Pathname.new(__FILE__).realpath.dirname
|
|
15
15
|
$LOAD_PATH.unshift((bindir + '../lib').realpath)
|
|
16
16
|
|
|
17
|
-
require 'review/book'
|
|
18
|
-
require 'review/tocparser'
|
|
19
17
|
require 'review/tocprinter'
|
|
20
|
-
require 'review/version'
|
|
21
|
-
require 'optparse'
|
|
22
18
|
|
|
23
|
-
|
|
24
|
-
@logger = ReVIEW.logger
|
|
25
|
-
Signal.trap(:INT) { exit 1 }
|
|
26
|
-
if RUBY_PLATFORM !~ /mswin(?!ce)|mingw|cygwin|bccwin/
|
|
27
|
-
Signal.trap(:PIPE, 'IGNORE')
|
|
28
|
-
end
|
|
29
|
-
_main
|
|
30
|
-
rescue Errno::EPIPE
|
|
31
|
-
exit 0
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
def _main
|
|
35
|
-
yamlfile = 'config.yml'
|
|
36
|
-
printer_class = ReVIEW::TextTOCPrinter
|
|
37
|
-
source = nil
|
|
38
|
-
upper = ReVIEW::TOCPrinter.default_upper_level
|
|
39
|
-
param = {}
|
|
40
|
-
book = ReVIEW::Book::Base.load
|
|
41
|
-
|
|
42
|
-
opts = OptionParser.new
|
|
43
|
-
opts.version = ReVIEW::VERSION
|
|
44
|
-
opts.on('--yaml=YAML', 'Read configurations from YAML file.') { |yaml| yamlfile = yaml }
|
|
45
|
-
opts.on('-a', '--all', 'print all chapters.') { source = book }
|
|
46
|
-
opts.on('-p', '--part N', 'list only part N.') do |n|
|
|
47
|
-
source = book.part(Integer(n)) or
|
|
48
|
-
error_exit("part #{n} does not exist in this book")
|
|
49
|
-
end
|
|
50
|
-
opts.on('-c', '--chapter C', 'list only chapter C.') do |c|
|
|
51
|
-
begin
|
|
52
|
-
source = ReVIEW::Book::Part.new(nil, 1, [book.chapter(c)])
|
|
53
|
-
rescue
|
|
54
|
-
error_exit("chapter #{c} does not exist in this book")
|
|
55
|
-
end
|
|
56
|
-
end
|
|
57
|
-
opts.on('-l', '--level N', 'list upto N level (1..4, default=4)') do |n|
|
|
58
|
-
upper = Integer(n)
|
|
59
|
-
unless (0..4).cover?(upper) # 0 is hidden option
|
|
60
|
-
$stderr.puts '-l/--level option accepts only 1..4'
|
|
61
|
-
exit 1
|
|
62
|
-
end
|
|
63
|
-
end
|
|
64
|
-
opts.on('--text', 'output in plain text (default)') { printer_class = ReVIEW::TextTOCPrinter }
|
|
65
|
-
opts.on('--html', 'output in HTML (deprecated)') { printer_class = ReVIEW::HTMLTOCPrinter }
|
|
66
|
-
opts.on('--help', 'print this message and quit.') do
|
|
67
|
-
puts opts.help
|
|
68
|
-
exit 0
|
|
69
|
-
end
|
|
70
|
-
begin
|
|
71
|
-
opts.parse!
|
|
72
|
-
rescue OptionParser::ParseError => e
|
|
73
|
-
@logger.error e.message
|
|
74
|
-
$stderr.puts opts.help
|
|
75
|
-
exit 1
|
|
76
|
-
end
|
|
77
|
-
|
|
78
|
-
book.config = ReVIEW::Configure.values
|
|
79
|
-
book.load_config(yamlfile) if yamlfile
|
|
80
|
-
|
|
81
|
-
if source
|
|
82
|
-
error_exit('-a/-s option and file arguments are exclusive') unless ARGV.empty?
|
|
83
|
-
else
|
|
84
|
-
puts opts.help
|
|
85
|
-
exit 0
|
|
86
|
-
end
|
|
87
|
-
|
|
88
|
-
begin
|
|
89
|
-
printer = printer_class.new(upper, param)
|
|
90
|
-
if source.is_a?(ReVIEW::Book::Part)
|
|
91
|
-
printer.print_part(source)
|
|
92
|
-
else
|
|
93
|
-
printer.print_book(source)
|
|
94
|
-
end
|
|
95
|
-
rescue ReVIEW::Error, Errno::ENOENT => e
|
|
96
|
-
raise if $DEBUG
|
|
97
|
-
error_exit(e.message)
|
|
98
|
-
end
|
|
99
|
-
end
|
|
100
|
-
|
|
101
|
-
def error_exit(msg)
|
|
102
|
-
@logger.error msg
|
|
103
|
-
exit 1
|
|
104
|
-
end
|
|
105
|
-
|
|
106
|
-
main
|
|
19
|
+
ReVIEW::TOCPrinter.execute(*ARGV)
|
data/bin/review-vol
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env ruby
|
|
2
2
|
#
|
|
3
|
-
# Copyright (c) 2014-
|
|
3
|
+
# Copyright (c) 2014-2020 Minero Aoki, Kenshi Muto
|
|
4
4
|
# 2003-2014 Minero Aoki
|
|
5
5
|
#
|
|
6
6
|
# This program is free software.
|
|
@@ -14,82 +14,8 @@ require 'pathname'
|
|
|
14
14
|
bindir = Pathname.new(__FILE__).realpath.dirname
|
|
15
15
|
$LOAD_PATH.unshift((bindir + '../lib').realpath)
|
|
16
16
|
|
|
17
|
-
require 'review'
|
|
18
|
-
require 'optparse'
|
|
17
|
+
require 'review/volumeprinter'
|
|
19
18
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
def main
|
|
23
|
-
@logger = ReVIEW.logger
|
|
24
|
-
@config = ReVIEW::Configure.values
|
|
25
|
-
|
|
26
|
-
part_sensitive = false
|
|
27
|
-
basedir = nil
|
|
28
|
-
yamlfile = 'config.yml'
|
|
29
|
-
opts = OptionParser.new
|
|
30
|
-
opts.version = ReVIEW::VERSION
|
|
31
|
-
opts.on('--yaml=YAML', 'Read configurations from YAML file.') { |yaml| yamlfile = yaml }
|
|
32
|
-
opts.on('-P', '--part-sensitive', 'Prints volume of each parts.') { part_sensitive = true }
|
|
33
|
-
opts.on('--directory=DIR', 'Compile all chapters in DIR.') { |path| basedir = path }
|
|
34
|
-
opts.on('--help', 'Print this message and quit') do
|
|
35
|
-
puts opts.help
|
|
36
|
-
exit 0
|
|
37
|
-
end
|
|
38
|
-
begin
|
|
39
|
-
opts.parse!
|
|
40
|
-
rescue OptionParser::ParseError => e
|
|
41
|
-
@logger.error e.message
|
|
42
|
-
$stderr.puts opts.help
|
|
43
|
-
exit 1
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
book = basedir ? ReVIEW::Book.load(basedir) : ReVIEW::Book::Base.load
|
|
47
|
-
book.config = @config
|
|
48
|
-
if yamlfile
|
|
49
|
-
book.load_config(yamlfile)
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
if part_sensitive
|
|
53
|
-
sep = ''
|
|
54
|
-
book.each_part do |part|
|
|
55
|
-
print sep
|
|
56
|
-
sep = "\n"
|
|
57
|
-
if part.number
|
|
58
|
-
puts "Part #{part.number} #{part.name}"
|
|
59
|
-
end
|
|
60
|
-
part.each_chapter do |chap|
|
|
61
|
-
print_chapter_volume chap
|
|
62
|
-
end
|
|
63
|
-
puts ' --------------------'
|
|
64
|
-
print_volume part.volume
|
|
65
|
-
end
|
|
66
|
-
else
|
|
67
|
-
book.each_chapter do |chap|
|
|
68
|
-
print_chapter_volume chap
|
|
69
|
-
end
|
|
70
|
-
end
|
|
71
|
-
puts '============================='
|
|
72
|
-
print_volume(book.volume) # puts "Total #{book.volume}"
|
|
73
|
-
rescue ReVIEW::ApplicationError, Errno::ENOENT => e
|
|
74
|
-
raise if $DEBUG
|
|
75
|
-
@logger.error e.message
|
|
76
|
-
exit 1
|
|
77
|
-
end
|
|
78
|
-
|
|
79
|
-
def print_chapter_volume(chap)
|
|
80
|
-
vol = chap.volume
|
|
81
|
-
title = chap.title
|
|
82
|
-
printf("%s %3dKB %6dC %5dL %3dP %s %-s\n",
|
|
83
|
-
chapnumstr(chap.number), vol.kbytes, vol.chars, vol.lines, vol.page,
|
|
84
|
-
"#{chap.name} ".ljust(25, '.'), title)
|
|
19
|
+
if File.basename($PROGRAM_NAME) == File.basename(__FILE__)
|
|
20
|
+
ReVIEW::VolumePrinter.execute(*ARGV)
|
|
85
21
|
end
|
|
86
|
-
|
|
87
|
-
def print_volume(vol)
|
|
88
|
-
printf(" %3dKB %6dC %5dL %3dP\n", vol.kbytes, vol.chars, vol.lines, vol.page)
|
|
89
|
-
end
|
|
90
|
-
|
|
91
|
-
def chapnumstr(n)
|
|
92
|
-
n ? sprintf('%2d.', n) : ' '
|
|
93
|
-
end
|
|
94
|
-
|
|
95
|
-
main
|
data/doc/config.yml.sample
CHANGED
|
@@ -74,7 +74,7 @@ aut: ["青木峰郎", "武藤健志", "高橋征義", "角征典"]
|
|
|
74
74
|
# 日付の後ろを空白文字で区切り、任意の文字列を置くことも可能。
|
|
75
75
|
# history: [["2016-04-20 v1.0.0版発行", "2018-11-11 v3.0.0版発行"]]
|
|
76
76
|
# 権利表記(配列で複数指定可)
|
|
77
|
-
# rights: (C) 2016-
|
|
77
|
+
# rights: (C) 2016-2020 Re:VIEW Developers
|
|
78
78
|
# description: 説明
|
|
79
79
|
# subject: 短い説明用タグ(配列で複数指定可)
|
|
80
80
|
# type: 書籍のカテゴリーなど(配列で複数指定可)
|
|
@@ -184,13 +184,26 @@ toc: true
|
|
|
184
184
|
# //table命令における列の区切り文字。tabs (1文字以上のタブ文字区切り。デフォルト), singletab (1文字のタブ文字区切り), spaces (1文字以上のスペースまたはタブ文字の区切り), verticalbar ("0個以上の空白 | 0個以上の空白"の区切り)
|
|
185
185
|
# table_row_separator: tabs
|
|
186
186
|
|
|
187
|
-
#
|
|
188
|
-
#
|
|
187
|
+
# 複数行から段落を結合する際、前後のUnicode文字種に基づき必要に応じて空白文字を挿入するか
|
|
188
|
+
# 省略した場合はnull (挿入しない)。別途unicode-eaw gemファイルが必要
|
|
189
|
+
# join_lines_by_lang: null
|
|
190
|
+
|
|
191
|
+
# 図・表・コードリスト・数式のキャプション位置。
|
|
192
|
+
# 値はtop(上)またはbottom(下)でデフォルトは以下のとおり
|
|
193
|
+
# caption_position:
|
|
194
|
+
# image: bottom
|
|
195
|
+
# table: top
|
|
196
|
+
# list: top
|
|
197
|
+
# equation: top
|
|
198
|
+
|
|
199
|
+
# review-toc向けのヒント情報
|
|
200
|
+
# (文字幅を考慮した行数計測には、別途unicode-eaw gemファイルが必要)
|
|
201
|
+
# ページあたりの行数文字数を用紙サイズで指定する(A5 or B5)
|
|
189
202
|
# page_metric: A5
|
|
190
203
|
#
|
|
191
204
|
# あるいは、配列で指定することもできる
|
|
192
|
-
# 各数字の意味は、順にリストの行数、リストの1行字数、テキストの行数、テキストの1
|
|
193
|
-
# page_metric: [40,
|
|
205
|
+
# 各数字の意味は、順にリストの行数、リストの1行字数、テキストの行数、テキストの1行字数
|
|
206
|
+
# page_metric: [40,34,29,34]
|
|
194
207
|
|
|
195
208
|
# EPUB・Web、およびテキスト生成時における数式の画像化指定
|
|
196
209
|
# TeXの数式を画像化するか。省略した場合はnull (作成しない)
|
|
@@ -23,7 +23,7 @@ prt: "Re:VIEW Printing inc."
|
|
|
23
23
|
contact: "https://reviewml.org/"
|
|
24
24
|
date: 2018-11-11
|
|
25
25
|
history: [["2012-01-30"],["2016-04-20","2016-05-03"],["2018-11-11"]]
|
|
26
|
-
rights: (C) 2016-
|
|
26
|
+
rights: (C) 2016-2020 Re:VIEW Commiters, some rights reserved.
|
|
27
27
|
description: sample config.yml file for Re:VIEW book
|
|
28
28
|
urnid: urn:uid:http://reviewml.org/review-sample-book
|
|
29
29
|
# isbn: null
|
data/doc/pdfmaker.ja.md
CHANGED
|
@@ -109,6 +109,48 @@ Re:VIEW 3.0 から review-jlreq.cls という別のクラスファイルも用
|
|
|
109
109
|
|
|
110
110
|
その他の詳細な設定については、sty フォルダにある README.md を参照してください。
|
|
111
111
|
|
|
112
|
+
### カスタムパラメータの引き渡し
|
|
113
|
+
|
|
114
|
+
技術的な都合で、config.yml の YAML 設定から TeX のマクロへの変換はすべての設定について行われるわけではなく、ごく限られた値のみに制限しています。これは Re:VIEW 内部の `config.erb` ( https://github.com/kmuto/review/blob/master/templates/latex/config.erb ) の ERB スクリプトによって処理されており、この挙動を変更することは許容していません。
|
|
115
|
+
|
|
116
|
+
任意の YAML 設定を TeX に引き渡すには、`config.erb` と同様に YAML から TeX への変換を行う固有の ERB スクリプトを作成して配置します。このためには、プロジェクトフォルダに `layouts` フォルダを作成し、そこに固有の ERB スクリプトを `config-local.tex.erb` という名前で置きます。
|
|
117
|
+
|
|
118
|
+
`config-local.tex.erb` は `config.erb` の評価・埋め込みの後、評価・埋め込みされます。
|
|
119
|
+
|
|
120
|
+
config.yml を次のようにして、これを TeX に渡したいとします。
|
|
121
|
+
|
|
122
|
+
```
|
|
123
|
+
mycustom:
|
|
124
|
+
mystring: HELLO_#1
|
|
125
|
+
mybool: true
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
`layouts/config-local.tex.erb` はたとえば次のようになります。
|
|
129
|
+
|
|
130
|
+
```
|
|
131
|
+
\def\mystring{<%= escape(@config['mycustom']['mystring']) %>}
|
|
132
|
+
<%- if @config['mycustom']['mybool'] -%>
|
|
133
|
+
\def\mybool{true}
|
|
134
|
+
<%- end -%>
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
次のように展開されます。
|
|
138
|
+
```
|
|
139
|
+
…
|
|
140
|
+
\makeatother
|
|
141
|
+
%% BEGIN: config-local.tex.erb
|
|
142
|
+
\def\mystring{HELLO\textunderscore{}\#1}
|
|
143
|
+
\def\mybool{true}
|
|
144
|
+
%% END: config-local.tex.erb
|
|
145
|
+
|
|
146
|
+
\usepackage{reviewmacro}
|
|
147
|
+
…
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
こうして定義されたマクロを sty ファイルなどで参照します。
|
|
151
|
+
|
|
152
|
+
なお、ERB での YAML 解析、および TeX マクロの記述において誤りがあると、極めてわかりにくいエラーになることがあります。`--debug` オプション付きで実行して展開された `__REVIEW_BOOK__.tex` を確認して原因を調査するのがよいでしょう。
|
|
153
|
+
|
|
112
154
|
## Re:VIEW 2.0 以前の情報
|
|
113
155
|
|
|
114
156
|
### upLaTeX について
|
data/doc/pdfmaker.md
CHANGED
|
@@ -84,6 +84,47 @@ Since Re:VIEW 3.0, review-jlreq.cls is also provided. This class file extends jl
|
|
|
84
84
|
|
|
85
85
|
`review-init --latex-template=review-jlreq` command copies the review-jlreq.cls set to `sty` folder.
|
|
86
86
|
|
|
87
|
+
### Handing over custom parameters
|
|
88
|
+
|
|
89
|
+
For technical reasons, only a small part of the YAML parameters in config.yml is converted to TeX macros. Re:VIEW's internal `config.erb` ( https://github.com/ kmuto/review/blob/master/templates/latex/ config.erb ) ERB script manages this. You cannot change this script.
|
|
90
|
+
|
|
91
|
+
If you want to give YAML parameters to TeX, you can use your own ERB script that do the YAML to TeX conversion. This is done by creating `layouts/config-local.tex.erb` in the project folder.
|
|
92
|
+
|
|
93
|
+
After evaluation and embedding of `config.erb`, `config-local.tex. erb` will be evaluated and embedded as well. For example,
|
|
94
|
+
|
|
95
|
+
`config.yml`:
|
|
96
|
+
|
|
97
|
+
```
|
|
98
|
+
mycustom:
|
|
99
|
+
mystring: HELLO_#1
|
|
100
|
+
mybool: true
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
`layouts/config-local.tex.erb`:
|
|
104
|
+
|
|
105
|
+
```
|
|
106
|
+
\def\mystring{<%= escape(@config['mycustom']['mystring']) %>}
|
|
107
|
+
<%- if @config['mycustom']['mybool'] -%>
|
|
108
|
+
\def\mybool{true}
|
|
109
|
+
<%- end -%>
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
will be parsed:
|
|
113
|
+
|
|
114
|
+
```
|
|
115
|
+
…
|
|
116
|
+
\makeatother
|
|
117
|
+
%% BEGIN: config-local.tex.erb
|
|
118
|
+
\def\mystring{HELLO\textunderscore{}\#1}
|
|
119
|
+
\def\mybool{true}
|
|
120
|
+
%% END: config-local.tex.erb
|
|
121
|
+
|
|
122
|
+
\usepackage{reviewmacro}
|
|
123
|
+
…
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
Refer to these macros in your sty file.
|
|
127
|
+
|
|
87
128
|
## Important Changes about LaTeX in Re:VIEW 2.0
|
|
88
129
|
|
|
89
130
|
* Default LaTeX compiler is upLaTeX, not pLaTeX.
|