review 5.6.0 → 5.8.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/rubocop.yml +31 -0
- data/.github/workflows/ruby-tex.yml +5 -1
- data/.github/workflows/ruby-win.yml +1 -1
- data/.github/workflows/ruby.yml +2 -2
- data/.rubocop.yml +13 -2
- data/NEWS.ja.md +39 -0
- data/NEWS.md +38 -0
- data/README.md +1 -1
- data/doc/config.yml.sample +11 -0
- data/doc/format.ja.md +50 -2
- data/doc/format.md +50 -2
- data/lib/review/book/base.rb +2 -2
- data/lib/review/book/image_finder.rb +29 -14
- data/lib/review/book/index.rb +1 -8
- data/lib/review/builder.rb +18 -9
- data/lib/review/configure.rb +7 -0
- data/lib/review/epubmaker/epubcommon.rb +13 -7
- data/lib/review/epubmaker/epubv2.rb +0 -5
- data/lib/review/epubmaker/epubv3.rb +9 -1
- data/lib/review/epubmaker/producer.rb +2 -3
- data/lib/review/epubmaker.rb +14 -5
- data/lib/review/htmlbuilder.rb +3 -3
- data/lib/review/idgxmlbuilder.rb +4 -3
- data/lib/review/idgxmlmaker.rb +13 -2
- data/lib/review/img_graph.rb +79 -0
- data/lib/review/img_math.rb +9 -2
- data/lib/review/init.rb +3 -3
- data/lib/review/latexbuilder.rb +1 -1
- data/lib/review/lineinput.rb +2 -2
- data/lib/review/makerhelper.rb +2 -2
- data/lib/review/pdfmaker.rb +14 -6
- data/lib/review/plaintextbuilder.rb +13 -1
- data/lib/review/textmaker.rb +14 -3
- data/lib/review/update.rb +3 -7
- data/lib/review/version.rb +1 -1
- data/lib/review/yamlloader.rb +0 -3
- data/review.gemspec +3 -3
- data/samples/syntax-book/Gemfile +1 -1
- data/samples/syntax-book/ch02.re +6 -0
- data/templates/latex/review-jlreq/review-jlreq.cls +14 -0
- data/templates/latex/review-jsbook/review-jsbook.cls +14 -0
- data/templates/opf/epubv2.opf.erb +2 -0
- data/templates/opf/epubv3.opf.erb +2 -0
- data/templates/opf/opf_manifest_epubv2.opf.erb +2 -0
- data/templates/opf/opf_manifest_epubv3.opf.erb +2 -0
- data/templates/opf/opf_tocx_epubv3.opf.erb +2 -0
- metadata +22 -136
- data/test/assets/black.eps +0 -280
- data/test/assets/fit.png +0 -0
- data/test/assets/header_listener.html +0 -35
- data/test/assets/img_math/img1.png +0 -0
- data/test/assets/img_math/img2.png +0 -0
- data/test/assets/img_math/img3.png +0 -0
- data/test/assets/large.gif +0 -0
- data/test/assets/large.jpg +0 -0
- data/test/assets/large.png +0 -0
- data/test/assets/large.svg +0 -65
- data/test/assets/syntax_book_index_detail.txt +0 -60
- data/test/assets/test.xml.erb +0 -3
- data/test/assets/test_template.tex +0 -189
- data/test/assets/test_template_backmatter.tex +0 -200
- data/test/book_test_helper.rb +0 -44
- data/test/run_test.rb +0 -12
- data/test/test_book.rb +0 -588
- data/test/test_book_chapter.rb +0 -329
- data/test/test_book_part.rb +0 -53
- data/test/test_builder.rb +0 -128
- data/test/test_catalog.rb +0 -174
- data/test/test_catalog_converter_cmd.rb +0 -73
- data/test/test_compiler.rb +0 -52
- data/test/test_configure.rb +0 -91
- data/test/test_converter.rb +0 -21
- data/test/test_epub3maker.rb +0 -733
- data/test/test_epubmaker.rb +0 -931
- data/test/test_epubmaker_cmd.rb +0 -56
- data/test/test_extentions_hash.rb +0 -66
- data/test/test_helper.rb +0 -62
- data/test/test_htmlbuilder.rb +0 -3315
- data/test/test_htmltoc.rb +0 -29
- data/test/test_htmlutils.rb +0 -43
- data/test/test_i18n.rb +0 -300
- data/test/test_idgxmlbuilder.rb +0 -1529
- data/test/test_idgxmlmaker_cmd.rb +0 -50
- data/test/test_image_finder.rb +0 -81
- data/test/test_img_math.rb +0 -120
- data/test/test_index.rb +0 -287
- data/test/test_indexbuilder.rb +0 -52
- data/test/test_latexbuilder.rb +0 -2972
- data/test/test_latexbuilder_v2.rb +0 -1654
- data/test/test_lineinput.rb +0 -104
- data/test/test_location.rb +0 -30
- data/test/test_logger.rb +0 -33
- data/test/test_makerhelper.rb +0 -44
- data/test/test_markdownbuilder.rb +0 -371
- data/test/test_md2inaobuilder.rb +0 -90
- data/test/test_pdfmaker.rb +0 -354
- data/test/test_pdfmaker_cmd.rb +0 -130
- data/test/test_plaintextbuilder.rb +0 -1214
- data/test/test_preprocessor.rb +0 -196
- data/test/test_review_ext.rb +0 -30
- data/test/test_reviewheaderlistener.rb +0 -49
- data/test/test_rstbuilder.rb +0 -619
- data/test/test_sec_counter.rb +0 -156
- data/test/test_template.rb +0 -33
- data/test/test_textmaker_cmd.rb +0 -58
- data/test/test_textutils.rb +0 -187
- data/test/test_tocprinter.rb +0 -46
- data/test/test_topbuilder.rb +0 -1301
- data/test/test_update.rb +0 -473
- data/test/test_webtocprinter.rb +0 -195
- data/test/test_yamlloader.rb +0 -186
- data/test/test_zip_exporter.rb +0 -106
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 368cf93a0b3ae0f5aaecebdef459f759ab45998b9236cfa983294711a4f135b6
|
|
4
|
+
data.tar.gz: 9990d2ed06a889cc951c3db58b47431e8ad414842fb4e6868082e2c33dd73139
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a78a8e4f75a856c15c492a9ef466efd72cad538a6c3378023b6c0dd83ec268e7a99126b16cb3d2ec158035b9f620380a50b759319131227c403b09b27bd8e8b6
|
|
7
|
+
data.tar.gz: 7f14b429a757435416de52eb8bed9d05925c1694e647c2165b68c46c835fcea9f0f1e4ea7d908219ceceb3edb179bf130ffe2ef811fe58416d00aba6f0d4e068
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
name: Lint by RuboCop
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- master
|
|
7
|
+
pull_request:
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
build:
|
|
11
|
+
|
|
12
|
+
runs-on: ${{ matrix.os }}
|
|
13
|
+
strategy:
|
|
14
|
+
fail-fast: false
|
|
15
|
+
matrix:
|
|
16
|
+
ruby: ['2.7', '3.0', '3.1', '3.2']
|
|
17
|
+
os: [ubuntu-latest]
|
|
18
|
+
steps:
|
|
19
|
+
- uses: actions/checkout@v2
|
|
20
|
+
- name: Set up Ruby
|
|
21
|
+
uses: ruby/setup-ruby@v1
|
|
22
|
+
with:
|
|
23
|
+
ruby-version: ${{ matrix.ruby }}
|
|
24
|
+
- name: fix ImageMagick policy.xml on Linux
|
|
25
|
+
if: runner.os == 'Linux'
|
|
26
|
+
run: sudo sed -i 's/none/read|write/g' /etc/ImageMagick-6/policy.xml
|
|
27
|
+
- name: Build and test with Rake
|
|
28
|
+
run: |
|
|
29
|
+
gem install bundler --no-document
|
|
30
|
+
bundle install --retry 3
|
|
31
|
+
bundle exec rubocop -P
|
|
@@ -13,7 +13,7 @@ jobs:
|
|
|
13
13
|
strategy:
|
|
14
14
|
fail-fast: false
|
|
15
15
|
matrix:
|
|
16
|
-
ruby: ['2.
|
|
16
|
+
ruby: ['2.7', '3.2']
|
|
17
17
|
os: [ubuntu-20.04]
|
|
18
18
|
steps:
|
|
19
19
|
- uses: actions/checkout@v2
|
|
@@ -28,6 +28,10 @@ jobs:
|
|
|
28
28
|
- name: fix ImageMagick policy.xml on Linux
|
|
29
29
|
if: runner.os == 'Linux'
|
|
30
30
|
run: sudo sed -i 's/none/read|write/g' /etc/ImageMagick-6/policy.xml
|
|
31
|
+
- name: use Node.js 18.x
|
|
32
|
+
uses: actions/setup-node@v3
|
|
33
|
+
with:
|
|
34
|
+
node-version: 18
|
|
31
35
|
- name: Build and test with Rake
|
|
32
36
|
run: |
|
|
33
37
|
gem install bundler --no-document
|
data/.github/workflows/ruby.yml
CHANGED
|
@@ -13,7 +13,7 @@ jobs:
|
|
|
13
13
|
strategy:
|
|
14
14
|
fail-fast: false
|
|
15
15
|
matrix:
|
|
16
|
-
ruby: ['2.
|
|
16
|
+
ruby: ['2.7', '3.0', '3.1', '3.2']
|
|
17
17
|
os: [ubuntu-latest, macOS-latest]
|
|
18
18
|
steps:
|
|
19
19
|
- uses: actions/checkout@v2
|
|
@@ -28,4 +28,4 @@ jobs:
|
|
|
28
28
|
run: |
|
|
29
29
|
gem install bundler --no-document
|
|
30
30
|
bundle install --retry 3
|
|
31
|
-
bundle exec rake
|
|
31
|
+
bundle exec rake test
|
data/.rubocop.yml
CHANGED
|
@@ -5,7 +5,7 @@ AllCops:
|
|
|
5
5
|
- tmp/*
|
|
6
6
|
DisplayCopNames: true
|
|
7
7
|
NewCops: enable
|
|
8
|
-
TargetRubyVersion: 2.
|
|
8
|
+
TargetRubyVersion: 2.7
|
|
9
9
|
|
|
10
10
|
require:
|
|
11
11
|
- rubocop-performance
|
|
@@ -38,6 +38,9 @@ Performance/StringInclude:
|
|
|
38
38
|
Performance/CollectionLiteralInLoop:
|
|
39
39
|
Enabled: false
|
|
40
40
|
|
|
41
|
+
Performance/MapCompact:
|
|
42
|
+
Enabled: false
|
|
43
|
+
|
|
41
44
|
#### Style
|
|
42
45
|
|
|
43
46
|
Style/AsciiComments:
|
|
@@ -109,7 +112,7 @@ Style/LineEndConcatenation:
|
|
|
109
112
|
Enabled: false
|
|
110
113
|
|
|
111
114
|
Style/MethodCallWithArgsParentheses:
|
|
112
|
-
|
|
115
|
+
AllowedMethods:
|
|
113
116
|
- 'require'
|
|
114
117
|
- 'include'
|
|
115
118
|
- 'file'
|
|
@@ -194,6 +197,9 @@ Style/OptionalBooleanParameter:
|
|
|
194
197
|
Style/CombinableLoops:
|
|
195
198
|
Enabled: false
|
|
196
199
|
|
|
200
|
+
Style/FetchEnvVar:
|
|
201
|
+
Enabled: false
|
|
202
|
+
|
|
197
203
|
### Layout
|
|
198
204
|
|
|
199
205
|
Layout/BlockAlignment:
|
|
@@ -296,3 +302,8 @@ Naming/VariableNumber:
|
|
|
296
302
|
|
|
297
303
|
Gemspec/RequiredRubyVersion:
|
|
298
304
|
Enabled: false
|
|
305
|
+
|
|
306
|
+
Gemspec/DevelopmentDependencies:
|
|
307
|
+
EnforcedStyle: gemspec
|
|
308
|
+
Exclude:
|
|
309
|
+
- samples/syntax-book/Gemfile
|
data/NEWS.ja.md
CHANGED
|
@@ -1,3 +1,42 @@
|
|
|
1
|
+
# Version 5.8.0
|
|
2
|
+
## 新機能
|
|
3
|
+
* `//graph` 命令でMermaid記法によるグラフ記述ができるようになりました。外部ツールの用意や設定については`doc/format.ja.md`を参照してください ([#1885])
|
|
4
|
+
|
|
5
|
+
## バグ修正
|
|
6
|
+
* EPUBMaker: 自動生成される部の内容に`<title>`が入らないのを修正しました ([#1898])
|
|
7
|
+
|
|
8
|
+
## 機能強化
|
|
9
|
+
* PDFMaker: `@<href>`命令で長いURLを記述したときに、ページをはみ出さずに折り返すようにしました ([#1890])
|
|
10
|
+
|
|
11
|
+
## コントリビューターのみなさん
|
|
12
|
+
* [@munepi](https://github.com/munepi)
|
|
13
|
+
|
|
14
|
+
[#1885]: https://github.com/kmuto/review/pull/1885
|
|
15
|
+
[#1890]: https://github.com/kmuto/review/issues/1890
|
|
16
|
+
[#1898]: https://github.com/kmuto/review/pull/1898
|
|
17
|
+
|
|
18
|
+
# Version 5.7.0
|
|
19
|
+
## バグ修正
|
|
20
|
+
* Windows において、`review-init -w` の実行時にバインドアドレスを省略したときにエラーが発生するのを修正しました ([#1824])
|
|
21
|
+
* PDFMaker: `//blankline` でページをまたいだときに、ページの先頭に空行が入るのを抑制しました ([#1872])
|
|
22
|
+
* EPUBMaker: MathJax で数式を表現する際に、`<`, `>`, `&` を変換し、HTML のエラーが出ないようにしました ([#1876], [#1877])
|
|
23
|
+
|
|
24
|
+
## 非互換の変更
|
|
25
|
+
* 動作検証済みバージョンを Ruby 2.7 以降としました ([#1871])
|
|
26
|
+
* EPUMaker: EPUB の検証ルールに従い、EPUB の目次に表紙へのリンクを含めました ([#1874])
|
|
27
|
+
|
|
28
|
+
## その他
|
|
29
|
+
* Ruby 3.2 を動作検証テスト対象に含めました ([#1871])
|
|
30
|
+
* RuboCop 1.45.1 の指摘を反映しました ([#1878])
|
|
31
|
+
|
|
32
|
+
[#1824]: https://github.com/kmuto/review/issues/1824
|
|
33
|
+
[#1871]: https://github.com/kmuto/review/pull/1871
|
|
34
|
+
[#1872]: https://github.com/kmuto/review/issues/1872
|
|
35
|
+
[#1874]: https://github.com/kmuto/review/issues/1874
|
|
36
|
+
[#1876]: https://github.com/kmuto/review/pull/1876
|
|
37
|
+
[#1877]: https://github.com/kmuto/review/pull/1877
|
|
38
|
+
[#1878]: https://github.com/kmuto/review/pull/1878
|
|
39
|
+
|
|
1
40
|
# Version 5.6.0
|
|
2
41
|
## 新機能
|
|
3
42
|
* IDGXMLBuilder: `//texequation` と `@<m>` で `imgmath` math_formatに対応しました ([#1829])
|
data/NEWS.md
CHANGED
|
@@ -1,3 +1,41 @@
|
|
|
1
|
+
# Version 5.8.0
|
|
2
|
+
## New Features
|
|
3
|
+
* The `//graph` operator allows graphical description in Mermaid notation. See `doc/format.md` for details on prepairing and setting up external tools ([#1885])
|
|
4
|
+
|
|
5
|
+
## Bug Fixes
|
|
6
|
+
* EPUBMaker: fix `<title>` not being included in the auto-generated part content ([#1898])
|
|
7
|
+
|
|
8
|
+
## Enhancements
|
|
9
|
+
* PDFMaker: fix to wrap long URLs with `@<href>` operator ([#1890])
|
|
10
|
+
|
|
11
|
+
## Contributors
|
|
12
|
+
* [@munepi](https://github.com/munepi)
|
|
13
|
+
|
|
14
|
+
[#1885]: https://github.com/kmuto/review/pull/1885
|
|
15
|
+
[#1890]: https://github.com/kmuto/review/issues/1890
|
|
16
|
+
[#1898]: https://github.com/kmuto/review/pull/1898
|
|
17
|
+
|
|
18
|
+
# Version 5.7.0
|
|
19
|
+
## Bug Fixes
|
|
20
|
+
* Fixed error when omitting a bind address of `review-init -w` on Windows ([#1824])
|
|
21
|
+
* EPUBMaker: escape `<`, `>`, and `&` when converting to MathJax to avoid HTML errors ([#1876], [#1877])
|
|
22
|
+
|
|
23
|
+
## Breaking Changes
|
|
24
|
+
* Ruby 2.6 or earlier was excluded from the operation verification ([#1871])
|
|
25
|
+
* EPUMaker: included a link to the cover in the table of contents according to EPUB validation rules ([#1874])
|
|
26
|
+
|
|
27
|
+
## Others
|
|
28
|
+
* Ruby 3.2 is now included in the testing target ([#1871])
|
|
29
|
+
* refactor code with RuboCop 1.45.1 ([#1878])
|
|
30
|
+
|
|
31
|
+
[#1824]: https://github.com/kmuto/review/issues/1824
|
|
32
|
+
[#1871]: https://github.com/kmuto/review/pull/1871
|
|
33
|
+
[#1872]: https://github.com/kmuto/review/issues/1872
|
|
34
|
+
[#1874]: https://github.com/kmuto/review/issues/1874
|
|
35
|
+
[#1876]: https://github.com/kmuto/review/pull/1876
|
|
36
|
+
[#1877]: https://github.com/kmuto/review/pull/1877
|
|
37
|
+
[#1878]: https://github.com/kmuto/review/pull/1878
|
|
38
|
+
|
|
1
39
|
# Version 5.6.0
|
|
2
40
|
## New Features
|
|
3
41
|
* IDGXMLBuilder: support `imgmath` math_format in `//texequation` and `@<m>` ([#1829])
|
data/README.md
CHANGED
data/doc/config.yml.sample
CHANGED
|
@@ -262,6 +262,17 @@ toc: true
|
|
|
262
262
|
# 追加する<meta>要素のプロパティとその値
|
|
263
263
|
# opf_meta: {"ebpaj:guide-version": "1.1.3"}
|
|
264
264
|
|
|
265
|
+
# Playwrightの利用オプション
|
|
266
|
+
# playwright_options:
|
|
267
|
+
# playwrightコマンドのパス
|
|
268
|
+
# playwright_path: "./node_modules/.bin/playwright"
|
|
269
|
+
# playwright-runnerの切り取りを使う。pdfcropを使う場合はfalseにする
|
|
270
|
+
# selfcrop: true
|
|
271
|
+
# pdfcropコマンドのパス
|
|
272
|
+
# pdfcrop_path: "pdfcrop"
|
|
273
|
+
# pdftocairoコマンドのパス
|
|
274
|
+
# pdftocairo_path: "pdftocairo"
|
|
275
|
+
|
|
265
276
|
# 以下のパラメータを有効にするときには、
|
|
266
277
|
# epubmaker:
|
|
267
278
|
# パラメータ: 値
|
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.
|
|
5
|
+
このドキュメントは、Re:VIEW 5.8 に基づいています。
|
|
6
6
|
|
|
7
7
|
## 段落
|
|
8
8
|
|
|
@@ -407,13 +407,61 @@ plot sin(x)
|
|
|
407
407
|
//}
|
|
408
408
|
```
|
|
409
409
|
|
|
410
|
-
コマンド名には、「`graphviz`」「`gnuplot`」「`blockdiag`」「`aafigure`」「`plantuml`」のいずれかを指定できます。ツールはそれぞれ別途インストールし、インストール先のフォルダ名を指定することなく実行できる (パスを通す) 必要があります。
|
|
410
|
+
コマンド名には、「`graphviz`」「`gnuplot`」「`blockdiag`」「`aafigure`」「`plantuml`」「`mermaid`」のいずれかを指定できます。ツールはそれぞれ別途インストールし、インストール先のフォルダ名を指定することなく実行できる (パスを通す) 必要があります。
|
|
411
411
|
|
|
412
412
|
* Graphviz ( https://www.graphviz.org/ ) : `dot` コマンドへのパスを OS に設定すること
|
|
413
413
|
* Gnuplot ( http://www.gnuplot.info/ ) : `gnuplot` コマンドへのパスを OS に設定すること
|
|
414
414
|
* Blockdiag ( http://blockdiag.com/ ) : `blockdiag` コマンドへのパスを OS に設定すること。PDF を生成する場合は ReportLab もインストールすること
|
|
415
415
|
* aafigure ( https://launchpad.net/aafigure ) : `aafigure` コマンドへのパスを OS に設定すること
|
|
416
416
|
* PlantUML ( http://plantuml.com/ ) : `java` コマンドへのパスを OS に設定し、`plantuml.jar` が作業フォルダ、または `/usr/share/plantuml` あるいは `/usr/share/java` フォルダにあること
|
|
417
|
+
* Mermaid ( https://mermaid.js.org/ ) : 以下を参照
|
|
418
|
+
|
|
419
|
+
### Mermaid の利用
|
|
420
|
+
|
|
421
|
+
Mermaid は Web ブラウザ上で動作する JavaScript ベースの図形描画ツールです。EPUB や LaTeX 経由の PDF で利用するには、Web ブラウザを内部的に呼び出して画像化する必要があります。現時点で、Linux 以外の動作は確認していません。
|
|
422
|
+
|
|
423
|
+
1. プロジェクトに次のように `package.json` を作成します(既存のファイルがあるときには、`dependencies` に `"playwright"〜` の行を追加します)。
|
|
424
|
+
```
|
|
425
|
+
{
|
|
426
|
+
"name": "book",
|
|
427
|
+
"dependencies": {
|
|
428
|
+
"playwright": "^1.32.2"
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
```
|
|
432
|
+
2. Playwright ライブラリをインストールします。`npm` がない場合は、[Node.js](https://nodejs.org/) の環境をセットアップしてください。
|
|
433
|
+
```
|
|
434
|
+
npm install
|
|
435
|
+
```
|
|
436
|
+
3. Playwright ライブラリを Ruby から呼び出すモジュールである [playwright-runner](https://github.com/kmuto/playwright-runner) をインストールします。
|
|
437
|
+
```
|
|
438
|
+
gem install playwright-runner
|
|
439
|
+
```
|
|
440
|
+
4. (オプション) EPUB には SVG 形式を作成する必要がありますが、SVG に変換するには、[poppler](https://gitlab.freedesktop.org/poppler/poppler) に含まれる `pdftocairo` コマンドが必要です。Debian およびその派生物では以下のようにしてインストールできます。
|
|
441
|
+
```
|
|
442
|
+
apt install poppler-utils
|
|
443
|
+
```
|
|
444
|
+
5. (オプション) デフォルトでは図の周囲に大きめの余白ができてしまいます。これを詰めるには、TeXLive に含まれる `pdfcrop` コマンドが必要です。Debian およびその派生物では以下のようにしてインストールできます。
|
|
445
|
+
```
|
|
446
|
+
apt install texlive-extra-utils
|
|
447
|
+
```
|
|
448
|
+
|
|
449
|
+
プロジェクトの `config.yml` を適宜調整します。デフォルト値は以下のとおりです。
|
|
450
|
+
|
|
451
|
+
```
|
|
452
|
+
playwright_options:
|
|
453
|
+
playwright_path: "./node_modules/.bin/playwright"
|
|
454
|
+
selfcrop: true
|
|
455
|
+
pdfcrop_path: "pdfcrop"
|
|
456
|
+
pdftocairo_path: "pdftocairo"
|
|
457
|
+
```
|
|
458
|
+
|
|
459
|
+
- `playwright_path`: `playwright` コマンドのパスを相対パスまたは絶対パスで指定する
|
|
460
|
+
- `selfcrop`: `playwright-runner` の画像切り出しを使う。`pdfcrop` が不要になるが、周囲に余白が生じる。`pdfcrop` を使うときには `false` に設定する
|
|
461
|
+
- `pdfcrop_path`: `pdfcrop` コマンドのパス。`selfcrop` が `true` のときには無視される
|
|
462
|
+
- `pdftocairo_path`: `pdftocairo` コマンドのパス
|
|
463
|
+
|
|
464
|
+
Re:VIEW 側の記法としては `//graph[ID][mermaid][キャプション]` または `//graph[ID][mermaid]` となりますが、この ID に基づき、`images/html/ID.svg`(EPUB の場合)や `images/latex/ID.pdf`(LaTeX PDF の場合)が生成されます。
|
|
417
465
|
|
|
418
466
|
## 表
|
|
419
467
|
|
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.
|
|
7
|
+
This document explains about the format of Re:VIEW 5.8.
|
|
8
8
|
|
|
9
9
|
## Paragraph
|
|
10
10
|
|
|
@@ -425,7 +425,7 @@ plot sin(x)
|
|
|
425
425
|
//}
|
|
426
426
|
```
|
|
427
427
|
|
|
428
|
-
You can use `graphviz`, `gnuplot`, `blockdiag`, `aafigure`, and `
|
|
428
|
+
You can use `graphviz`, `gnuplot`, `blockdiag`, `aafigure`, `plantuml`, and `mermaid` as the command name.
|
|
429
429
|
Before using these tools, you should installed them and configured path appropriately.
|
|
430
430
|
|
|
431
431
|
* Graphviz ( https://www.graphviz.org/ ) : set path to `dot` command
|
|
@@ -433,6 +433,54 @@ Before using these tools, you should installed them and configured path appropri
|
|
|
433
433
|
* Blockdiag ( http://blockdiag.com/ ) : set path to `blockdiag` command. Install ReportLab also to make a PDF
|
|
434
434
|
* aafigure ( https://launchpad.net/aafigure ) : set path to `aafigure` command
|
|
435
435
|
* PlantUML ( http://plantuml.com/ ) : set path to `java` command. place `plantuml.jar` on working folder, `/usr/share/plantuml` or `/usr/share/java`.
|
|
436
|
+
* Mermaid ( https://mermaid.js.org/ ) : see below
|
|
437
|
+
|
|
438
|
+
### using Mermaid
|
|
439
|
+
|
|
440
|
+
Mermaid is a JavaScript-based diagram tool that runs in a Web browser. For use with EPUB or LaTeX PDF, Re:VIEW calls the Web browser internally to create images. At this time, we have not confirmed that Mermaid works on any platforms other than Linux.
|
|
441
|
+
|
|
442
|
+
1. Create `package.json` in your project (if you have an existing file, add the line `"playwright"...` to the `dependencies`).
|
|
443
|
+
```
|
|
444
|
+
{
|
|
445
|
+
"name": "book",
|
|
446
|
+
"dependencies": {
|
|
447
|
+
"playwright": "^1.32.2"
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
```
|
|
451
|
+
2. Install Playwright library. If you don't have `npm`, set up [Node.js](https://nodejs.org/) first.
|
|
452
|
+
```
|
|
453
|
+
npm install
|
|
454
|
+
```
|
|
455
|
+
3. Install [playwright-runner](https://github.com/kmuto/playwright-runner), a module that calls the Playwright library from Ruby.
|
|
456
|
+
```
|
|
457
|
+
gem install playwright-runner
|
|
458
|
+
```
|
|
459
|
+
4. (Optional) Since EPUB cannot handle PDF, the images must be in SVG format; to convert them to SVG, you need the `pdftocairo` command included in [poppler](https://gitlab.freedesktop.org/poppler/poppler). It can be installed in Debian and its derivatives as follows:
|
|
460
|
+
```
|
|
461
|
+
apt install poppler-utils
|
|
462
|
+
```
|
|
463
|
+
5. (Optional )By default, there will be white margins around the figure. To crop them, you need the `pdfcrop` command included in TeXLive, which can be installed in Debian and its derivatives as follows:
|
|
464
|
+
```
|
|
465
|
+
apt install texlive-extra-utils
|
|
466
|
+
```
|
|
467
|
+
|
|
468
|
+
Adjust `config.yml`. The default values are as follows:
|
|
469
|
+
|
|
470
|
+
```
|
|
471
|
+
playwright_options:
|
|
472
|
+
playwright_path: "./node_modules/.bin/playwright"
|
|
473
|
+
selfcrop: true
|
|
474
|
+
pdfcrop_path: "pdfcrop"
|
|
475
|
+
pdftocairo_path: "pdftocairo"
|
|
476
|
+
```
|
|
477
|
+
|
|
478
|
+
- `playwright_path`: path of the `playwright` command.
|
|
479
|
+
- `selfcrop`: use the default cropper of `playwright-runner`. The `pdfcrop` will not be needed, but there will be margins around it. Set to `false` if you can use `pdfcrop`.
|
|
480
|
+
- `pdfcrop_path`: path of the `pdfcrop` command. Ignored if `selfcrop` is `true`.
|
|
481
|
+
- `pdftocairo_path`: path of the `pdftocairo` command.
|
|
482
|
+
|
|
483
|
+
The notation in Re:VIEW is `//graph[ID][mermaid][caption]` or `//graph[ID][mermaid]`. Based on this ID, `images/html/ID.svg` (for EPUB) or `images/latex/ID.pdf` (for LaTeX PDF) will be generated.
|
|
436
484
|
|
|
437
485
|
## Tables
|
|
438
486
|
|
data/lib/review/book/base.rb
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#
|
|
2
|
-
# Copyright (c) 2009-
|
|
2
|
+
# Copyright (c) 2009-2023 Minero Aoki, Kenshi Muto, Masayoshi Takahashi
|
|
3
3
|
# 2002-2008 Minero Aoki
|
|
4
4
|
#
|
|
5
5
|
# This program is free software.
|
|
@@ -73,7 +73,7 @@ module ReVIEW
|
|
|
73
73
|
end
|
|
74
74
|
|
|
75
75
|
def imagedir
|
|
76
|
-
|
|
76
|
+
config['imagedir']
|
|
77
77
|
end
|
|
78
78
|
|
|
79
79
|
def image_types
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#
|
|
2
|
-
# Copyright (c) 2014-
|
|
2
|
+
# Copyright (c) 2014-2023 Minero Aoki, Kenshi Muto, Masayoshi Takahashi
|
|
3
3
|
#
|
|
4
4
|
# This program is free software.
|
|
5
5
|
# You can distribute or modify this program under the terms of
|
|
@@ -13,35 +13,50 @@ require 'review/exception'
|
|
|
13
13
|
module ReVIEW
|
|
14
14
|
module Book
|
|
15
15
|
class ImageFinder
|
|
16
|
-
def initialize(
|
|
17
|
-
@
|
|
18
|
-
@
|
|
19
|
-
@
|
|
20
|
-
@
|
|
21
|
-
@entries = dir_entries
|
|
16
|
+
def initialize(chapter)
|
|
17
|
+
@book = chapter.book
|
|
18
|
+
@basedir = @book.imagedir
|
|
19
|
+
@chapid = chapter.id
|
|
20
|
+
@builder = @book.config['builder']
|
|
21
|
+
@entries = dir_entries.map { |path| entry_object(path) }
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def entry_object(path)
|
|
25
|
+
{ path: path, basename: path.sub(/\.[^.]+$/, ''), downcase: path.sub(/\.[^.]+$/, $&.downcase) }
|
|
22
26
|
end
|
|
23
27
|
|
|
24
28
|
def dir_entries
|
|
25
|
-
Dir.glob(File.join(@basedir, '**{,/*/**}/*.*')).uniq.sort
|
|
29
|
+
Dir.glob(File.join(@basedir, '**{,/*/**}/*.*')).uniq.sort.map { |entry| entry.sub(%r{^\./}, '') }
|
|
26
30
|
end
|
|
27
31
|
|
|
28
32
|
def add_entry(path)
|
|
29
|
-
|
|
33
|
+
path.sub!(%r{^\./}, '')
|
|
34
|
+
unless @entries.find { |entry| entry[:path] == path }
|
|
35
|
+
@entries << entry_object(path)
|
|
36
|
+
end
|
|
30
37
|
@entries
|
|
31
38
|
end
|
|
32
39
|
|
|
33
40
|
def find_path(id)
|
|
34
41
|
targets = target_list(id)
|
|
35
42
|
targets.each do |target|
|
|
36
|
-
@
|
|
37
|
-
@entries.
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
43
|
+
@book.image_types.each do |ext|
|
|
44
|
+
entries = @entries.select do |entry|
|
|
45
|
+
entry[:basename] == target
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
unless entries
|
|
49
|
+
break
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
entries.find do |entry|
|
|
53
|
+
if entry[:downcase] == "#{target}#{ext}"
|
|
54
|
+
return entry[:path]
|
|
41
55
|
end
|
|
42
56
|
end
|
|
43
57
|
end
|
|
44
58
|
end
|
|
59
|
+
|
|
45
60
|
nil
|
|
46
61
|
end
|
|
47
62
|
|
data/lib/review/book/index.rb
CHANGED
|
@@ -138,14 +138,7 @@ module ReVIEW
|
|
|
138
138
|
def initialize(chapter)
|
|
139
139
|
super()
|
|
140
140
|
@chapter = chapter
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
chapid = chapter.id
|
|
144
|
-
basedir = book.imagedir
|
|
145
|
-
builder = book.config['builder']
|
|
146
|
-
types = book.image_types
|
|
147
|
-
|
|
148
|
-
@image_finder = ReVIEW::Book::ImageFinder.new(basedir, chapid, builder, types)
|
|
141
|
+
@image_finder = ReVIEW::Book::ImageFinder.new(@chapter)
|
|
149
142
|
end
|
|
150
143
|
|
|
151
144
|
def find_path(id)
|
data/lib/review/builder.rb
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright (c) 2002-
|
|
1
|
+
# Copyright (c) 2002-2023 Minero Aoki, Kenshi Muto
|
|
2
2
|
#
|
|
3
3
|
# This program is free software.
|
|
4
4
|
# You can distribute or modify this program under the terms of
|
|
@@ -11,6 +11,7 @@ require 'review/textutils'
|
|
|
11
11
|
require 'review/compiler'
|
|
12
12
|
require 'review/sec_counter'
|
|
13
13
|
require 'review/img_math'
|
|
14
|
+
require 'review/img_graph'
|
|
14
15
|
require 'review/loggable'
|
|
15
16
|
require 'stringio'
|
|
16
17
|
require 'fileutils'
|
|
@@ -35,13 +36,14 @@ module ReVIEW
|
|
|
35
36
|
attr_accessor :doc_status
|
|
36
37
|
attr_reader :location
|
|
37
38
|
|
|
38
|
-
def initialize(strict = false, *_args, img_math: nil)
|
|
39
|
+
def initialize(strict = false, *_args, img_math: nil, img_graph: nil)
|
|
39
40
|
@strict = strict
|
|
40
41
|
@output = nil
|
|
41
42
|
@logger = ReVIEW.logger
|
|
42
43
|
@doc_status = {}
|
|
43
44
|
@dictionary = {}
|
|
44
45
|
@img_math = img_math
|
|
46
|
+
@img_graph = img_graph
|
|
45
47
|
@shown_endnotes = true
|
|
46
48
|
end
|
|
47
49
|
|
|
@@ -61,6 +63,7 @@ module ReVIEW
|
|
|
61
63
|
@tsize = nil
|
|
62
64
|
if @book && @book.config
|
|
63
65
|
@img_math ||= ReVIEW::ImgMath.new(@book.config)
|
|
66
|
+
@img_graph ||= ReVIEW::ImgGraph.new(@book.config, target_name)
|
|
64
67
|
if words_file_path = @book.config['words_file']
|
|
65
68
|
words_files = if words_file_path.is_a?(String)
|
|
66
69
|
[words_file_path]
|
|
@@ -234,7 +237,8 @@ module ReVIEW
|
|
|
234
237
|
sepidx = nil
|
|
235
238
|
rows = []
|
|
236
239
|
lines.each_with_index do |line, idx|
|
|
237
|
-
|
|
240
|
+
# {} is for LaTeX
|
|
241
|
+
if /\A[=-]{12}/ =~ line || /\A[={}-]{12}/ =~ line
|
|
238
242
|
sepidx ||= idx
|
|
239
243
|
next
|
|
240
244
|
end
|
|
@@ -512,12 +516,7 @@ module ReVIEW
|
|
|
512
516
|
end
|
|
513
517
|
|
|
514
518
|
def inline_wb(s)
|
|
515
|
-
|
|
516
|
-
if translated
|
|
517
|
-
inline_b(translated)
|
|
518
|
-
else
|
|
519
|
-
inline_b("[missing word: #{s}]")
|
|
520
|
-
end
|
|
519
|
+
inline_b(@dictionary[s] || "[missing word: #{s}]")
|
|
521
520
|
end
|
|
522
521
|
|
|
523
522
|
def raw(str)
|
|
@@ -703,6 +702,16 @@ EOTGNUPLOT
|
|
|
703
702
|
file_path
|
|
704
703
|
end
|
|
705
704
|
|
|
705
|
+
def graph_mermaid(id, _file_path, _line, tf_path)
|
|
706
|
+
begin
|
|
707
|
+
require 'playwrightrunner'
|
|
708
|
+
rescue LoadError
|
|
709
|
+
app_error "#{@location}: could not handle Mermaid of //graph in this builder."
|
|
710
|
+
end
|
|
711
|
+
|
|
712
|
+
@img_graph.defer_mermaid_image(File.read(tf_path), id)
|
|
713
|
+
end
|
|
714
|
+
|
|
706
715
|
def image_ext
|
|
707
716
|
raise NotImplementedError
|
|
708
717
|
end
|
data/lib/review/configure.rb
CHANGED
|
@@ -68,6 +68,13 @@ module ReVIEW
|
|
|
68
68
|
'externallink' => true,
|
|
69
69
|
'join_lines_by_lang' => nil, # experimental. default should be nil
|
|
70
70
|
'table_row_separator' => 'tabs',
|
|
71
|
+
# for Playwright
|
|
72
|
+
'playwright_options' => {
|
|
73
|
+
'playwright_path' => './node_modules/.bin/playwright',
|
|
74
|
+
'selfcrop' => true,
|
|
75
|
+
'pdfcrop_path' => 'pdfcrop',
|
|
76
|
+
'pdftocairo_path' => 'pdftocairo'
|
|
77
|
+
},
|
|
71
78
|
# for IDGXML
|
|
72
79
|
'tableopt' => nil,
|
|
73
80
|
'listinfo' => nil,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# = epubcommon.rb -- super class for EPUBv2 and EPUBv3
|
|
2
2
|
#
|
|
3
|
-
# Copyright (c) 2010-
|
|
3
|
+
# Copyright (c) 2010-2023 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
|
|
@@ -231,6 +231,10 @@ module ReVIEW
|
|
|
231
231
|
ReVIEW::Template.generate(path: template_name, binding: binding)
|
|
232
232
|
end
|
|
233
233
|
|
|
234
|
+
def coveritem
|
|
235
|
+
[]
|
|
236
|
+
end
|
|
237
|
+
|
|
234
238
|
def hierarchy_ncx(type)
|
|
235
239
|
require 'rexml/document'
|
|
236
240
|
level = 1
|
|
@@ -264,7 +268,7 @@ module ReVIEW
|
|
|
264
268
|
doc.context[:attribute_quote] = :quote
|
|
265
269
|
|
|
266
270
|
e = doc.root.elements[1] # first <li/>
|
|
267
|
-
contents.each do |item|
|
|
271
|
+
(coveritem + contents).each do |item|
|
|
268
272
|
next if !item.notoc.nil? || item.level.nil? || item.file.nil? || item.title.nil? || item.level > toclevel
|
|
269
273
|
|
|
270
274
|
if item.level == level
|
|
@@ -304,7 +308,7 @@ module ReVIEW
|
|
|
304
308
|
|
|
305
309
|
def flat_ncx(type, indent = nil)
|
|
306
310
|
s = %Q(<#{type} class="toc-h1">\n)
|
|
307
|
-
contents.each do |item|
|
|
311
|
+
(coveritem + contents).each do |item|
|
|
308
312
|
next if !item.notoc.nil? || item.level.nil? || item.file.nil? || item.title.nil? || item.level > config['toclevel'].to_i
|
|
309
313
|
|
|
310
314
|
is = indent == true ? ' ' * item.level : ''
|
|
@@ -324,10 +328,12 @@ module ReVIEW
|
|
|
324
328
|
FileUtils.mkdir_p("#{tmpdir}/OEBPS")
|
|
325
329
|
File.write(File.join(tmpdir, opf_path), opf)
|
|
326
330
|
|
|
327
|
-
if
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
+
if config['cover']
|
|
332
|
+
if File.exist?("#{basedir}/#{config['cover']}")
|
|
333
|
+
FileUtils.cp("#{basedir}/#{config['cover']}", "#{tmpdir}/OEBPS")
|
|
334
|
+
else
|
|
335
|
+
File.write("#{tmpdir}/OEBPS/#{config['cover']}", cover)
|
|
336
|
+
end
|
|
331
337
|
end
|
|
332
338
|
|
|
333
339
|
if config['colophon'] && !config['colophon'].is_a?(String)
|
|
@@ -22,11 +22,6 @@ module ReVIEW
|
|
|
22
22
|
CREATOR_ATTRIBUTES = %w[aut a-adp a-ann a-arr a-art a-asn a-aqt a-aft a-aui a-ant a-bkp a-clb a-cmm a-dsr a-edt a-ill a-lyr a-mdc a-mus a-nrt a-oth a-pht a-prt a-red a-rev a-spn a-ths a-trc a-trl]
|
|
23
23
|
CONTRIBUTER_ATTRIBUTES = %w[adp ann arr art asn aqt aft aui ant bkp clb cmm dsr edt ill lyr mdc mus nrt oth pht prt red rev spn ths trc trl]
|
|
24
24
|
|
|
25
|
-
# Construct object with parameter hash +config+ and message resource hash +res+.
|
|
26
|
-
def initialize(producer) # rubocop:disable Lint/UselessMethodDefinition
|
|
27
|
-
super
|
|
28
|
-
end
|
|
29
|
-
|
|
30
25
|
# Return opf file content.
|
|
31
26
|
def opf
|
|
32
27
|
@opf_metainfo = opf_metainfo
|