review 5.7.0 → 5.9.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 +1 -1
- data/.github/workflows/ruby-tex.yml +7 -3
- data/.github/workflows/ruby-win.yml +1 -1
- data/.github/workflows/ruby.yml +1 -1
- data/.rubocop.yml +4 -1
- data/NEWS.ja.md +34 -0
- data/NEWS.md +34 -0
- data/README.md +1 -1
- data/doc/config.yml.sample +12 -1
- data/doc/format.ja.md +50 -2
- data/doc/format.md +50 -2
- data/lib/review/book/base.rb +1 -1
- data/lib/review/book/image_finder.rb +29 -14
- data/lib/review/book/index.rb +1 -8
- data/lib/review/builder.rb +21 -8
- data/lib/review/compiler.rb +2 -2
- data/lib/review/configure.rb +7 -0
- data/lib/review/epubmaker.rb +12 -1
- data/lib/review/htmlbuilder.rb +1 -1
- data/lib/review/htmltoc.rb +1 -1
- data/lib/review/idgxmlbuilder.rb +3 -3
- data/lib/review/idgxmlmaker.rb +13 -2
- data/lib/review/img_graph.rb +79 -0
- data/lib/review/logger.rb +1 -1
- data/lib/review/markdownbuilder.rb +4 -4
- data/lib/review/pdfmaker.rb +11 -1
- data/lib/review/plaintextbuilder.rb +13 -1
- data/lib/review/textmaker.rb +14 -3
- data/lib/review/textutils.rb +2 -2
- data/lib/review/version.rb +1 -1
- data/lib/review/yamlloader.rb +2 -0
- data/review.gemspec +2 -1
- data/samples/sample-book/src/config-epub2.yml +1 -1
- data/samples/syntax-book/ch02.re +6 -0
- data/samples/syntax-book/config-jlreq.yml +3 -3
- data/templates/latex/review-jlreq/README.md +4 -1
- data/templates/latex/review-jlreq/review-base.sty +9 -4
- data/templates/latex/review-jlreq/review-jlreq.cls +14 -0
- data/templates/latex/review-jsbook/review-base.sty +9 -4
- data/templates/latex/review-jsbook/review-jsbook.cls +14 -0
- metadata +23 -8
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6140d24dcd1cdbb98fe8f67131bb080c3bd82a397eb2569d11455b7ac954ef9b
|
|
4
|
+
data.tar.gz: 23ca68ed05c615d4535d65ca1120f8180336310a5ea0c157f4001cea8e1e4223
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4d23fb91a4951a077c2d48ff9cf68227dc91e0bc238e4c0825795b7708da887da3bd1f3467c4cace936f07972a279b14cdd57fa8bb3d176e274a47918a3858a0
|
|
7
|
+
data.tar.gz: '0005176058f24404f388c55c1b5db58daa034b6b1be049b9b4ca8348c2f8a889cef2bfc3df3eaa96b504186014058a5ca90530b5dd3b60453981816b9c580f11'
|
|
@@ -13,11 +13,11 @@ jobs:
|
|
|
13
13
|
strategy:
|
|
14
14
|
fail-fast: false
|
|
15
15
|
matrix:
|
|
16
|
-
ruby: ['
|
|
17
|
-
os: [ubuntu-
|
|
16
|
+
ruby: ['3.2']
|
|
17
|
+
os: [ubuntu-22.04]
|
|
18
18
|
steps:
|
|
19
19
|
- uses: actions/checkout@v2
|
|
20
|
-
- name: Install TeXLive
|
|
20
|
+
- name: Install TeXLive 2021 in ubuntu
|
|
21
21
|
if: runner.os == 'Linux'
|
|
22
22
|
run: |
|
|
23
23
|
sudo apt-get update -y -qq && sudo apt-get install -y -qq texlive-lang-japanese texlive-fonts-recommended texlive-fonts-extra texlive-luatex texlive-extra-utils texlive-latex-extra dvipng poppler-utils
|
|
@@ -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
data/.rubocop.yml
CHANGED
|
@@ -5,7 +5,7 @@ AllCops:
|
|
|
5
5
|
- tmp/*
|
|
6
6
|
DisplayCopNames: true
|
|
7
7
|
NewCops: enable
|
|
8
|
-
TargetRubyVersion:
|
|
8
|
+
TargetRubyVersion: 3.0
|
|
9
9
|
|
|
10
10
|
require:
|
|
11
11
|
- rubocop-performance
|
|
@@ -41,6 +41,9 @@ Performance/CollectionLiteralInLoop:
|
|
|
41
41
|
Performance/MapCompact:
|
|
42
42
|
Enabled: false
|
|
43
43
|
|
|
44
|
+
Performance/StringIdentifierArgument:
|
|
45
|
+
Enabled: false
|
|
46
|
+
|
|
44
47
|
#### Style
|
|
45
48
|
|
|
46
49
|
Style/AsciiComments:
|
data/NEWS.ja.md
CHANGED
|
@@ -1,3 +1,37 @@
|
|
|
1
|
+
# Version 5.9.0
|
|
2
|
+
## バグ修正
|
|
3
|
+
* LATEXBuilder: `@<code>`, `@<tt>`, `@<tti>`, `@<ttb>`での空白幅が適切になるよう修正しました。またPDF栞の扱いを改善しました([#1906],[#1907])。
|
|
4
|
+
|
|
5
|
+
## 機能強化
|
|
6
|
+
* `review-jlreq.cls`のUsers Guideで用紙サイズの指定にJIS B列とISO B列を区別するようにしました([#1904])
|
|
7
|
+
* `config.yml.sample`での誤記を修正しました([#1909])
|
|
8
|
+
|
|
9
|
+
## コントリビューターのみなさん
|
|
10
|
+
* [@munepi](https://github.com/munepi)
|
|
11
|
+
* [@koshikawa](https://github.com/koshikawa)
|
|
12
|
+
|
|
13
|
+
[#1904]: https://github.com/kmuto/review/pull/1904
|
|
14
|
+
[#1906]: https://github.com/kmuto/review/issues/1906
|
|
15
|
+
[#1907]: https://github.com/kmuto/review/pull/1907
|
|
16
|
+
[#1909]: https://github.com/kmuto/review/pull/1909
|
|
17
|
+
|
|
18
|
+
# Version 5.8.0
|
|
19
|
+
## 新機能
|
|
20
|
+
* `//graph` 命令でMermaid記法によるグラフ記述ができるようになりました。外部ツールの用意や設定については`doc/format.ja.md`を参照してください ([#1885])
|
|
21
|
+
|
|
22
|
+
## バグ修正
|
|
23
|
+
* EPUBMaker: 自動生成される部の内容に`<title>`が入らないのを修正しました ([#1898])
|
|
24
|
+
|
|
25
|
+
## 機能強化
|
|
26
|
+
* PDFMaker: `@<href>`命令で長いURLを記述したときに、ページをはみ出さずに折り返すようにしました ([#1890])
|
|
27
|
+
|
|
28
|
+
## コントリビューターのみなさん
|
|
29
|
+
* [@munepi](https://github.com/munepi)
|
|
30
|
+
|
|
31
|
+
[#1885]: https://github.com/kmuto/review/pull/1885
|
|
32
|
+
[#1890]: https://github.com/kmuto/review/issues/1890
|
|
33
|
+
[#1898]: https://github.com/kmuto/review/pull/1898
|
|
34
|
+
|
|
1
35
|
# Version 5.7.0
|
|
2
36
|
## バグ修正
|
|
3
37
|
* Windows において、`review-init -w` の実行時にバインドアドレスを省略したときにエラーが発生するのを修正しました ([#1824])
|
data/NEWS.md
CHANGED
|
@@ -1,3 +1,37 @@
|
|
|
1
|
+
# Version 5.9.0
|
|
2
|
+
## Bug Fixes
|
|
3
|
+
* LATEXBuilder: fix the spacing for `@<code>`, `@<tt>`, `@<tti>`, `@<ttb>` to be more appropriate. Also improved handling of PDF bookmarks ([#1906], [#1907]).
|
|
4
|
+
|
|
5
|
+
## Enhancements
|
|
6
|
+
* differentiated between JIS B and ISO B paper sizes in `review-jlreq.cls` Users Guide ([#1904]).
|
|
7
|
+
* fix typos in `config.yml.sample` ([#1909]).
|
|
8
|
+
|
|
9
|
+
## Contributors
|
|
10
|
+
* [@munepi](https://github.com/munepi)
|
|
11
|
+
* [@koshikawa](https://github.com/koshikawa)
|
|
12
|
+
|
|
13
|
+
[#1904]: https://github.com/kmuto/review/pull/1904
|
|
14
|
+
[#1906]: https://github.com/kmuto/review/issues/1906
|
|
15
|
+
[#1907]: https://github.com/kmuto/review/pull/1907
|
|
16
|
+
[#1909]: https://github.com/kmuto/review/pull/1909
|
|
17
|
+
|
|
18
|
+
# Version 5.8.0
|
|
19
|
+
## New Features
|
|
20
|
+
* The `//graph` operator allows graphical description in Mermaid notation. See `doc/format.md` for details on prepairing and setting up external tools ([#1885])
|
|
21
|
+
|
|
22
|
+
## Bug Fixes
|
|
23
|
+
* EPUBMaker: fix `<title>` not being included in the auto-generated part content ([#1898])
|
|
24
|
+
|
|
25
|
+
## Enhancements
|
|
26
|
+
* PDFMaker: fix to wrap long URLs with `@<href>` operator ([#1890])
|
|
27
|
+
|
|
28
|
+
## Contributors
|
|
29
|
+
* [@munepi](https://github.com/munepi)
|
|
30
|
+
|
|
31
|
+
[#1885]: https://github.com/kmuto/review/pull/1885
|
|
32
|
+
[#1890]: https://github.com/kmuto/review/issues/1890
|
|
33
|
+
[#1898]: https://github.com/kmuto/review/pull/1898
|
|
34
|
+
|
|
1
35
|
# Version 5.7.0
|
|
2
36
|
## Bug Fixes
|
|
3
37
|
* Fixed error when omitting a bind address of `review-init -w` on Windows ([#1824])
|
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
|
# パラメータ: 値
|
|
@@ -321,7 +332,7 @@ epubmaker:
|
|
|
321
332
|
# 画像ファイルの縦x横の最大ピクセル数許容値
|
|
322
333
|
# image_maxpixels: 4000000
|
|
323
334
|
#
|
|
324
|
-
# Re:VIEWファイル名を使わず、前付にpre01,pre02...、本文にchap01,
|
|
335
|
+
# Re:VIEWファイル名を使わず、前付にpre01,pre02...、本文にchap01,chap02...、後付にpost01,post02...という名前付けルールにするか
|
|
325
336
|
# rename_for_legacy: null
|
|
326
337
|
#
|
|
327
338
|
# ePUBアーカイブの非圧縮実行
|
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) 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-2024 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]
|
|
@@ -130,7 +133,7 @@ module ReVIEW
|
|
|
130
133
|
end
|
|
131
134
|
|
|
132
135
|
def target_name
|
|
133
|
-
self.class.to_s.gsub(
|
|
136
|
+
self.class.to_s.gsub('ReVIEW::', '').gsub('Builder', '').downcase
|
|
134
137
|
end
|
|
135
138
|
|
|
136
139
|
def load_words(file)
|
|
@@ -402,10 +405,10 @@ module ReVIEW
|
|
|
402
405
|
def inline_ruby(arg)
|
|
403
406
|
base, *ruby = *arg.scan(/(?:(?:(?:\\\\)*\\,)|[^,\\]+)+/)
|
|
404
407
|
if base
|
|
405
|
-
base = base.gsub(
|
|
408
|
+
base = base.gsub('\,', ',').strip
|
|
406
409
|
end
|
|
407
410
|
if ruby
|
|
408
|
-
ruby = ruby.join(',').gsub(
|
|
411
|
+
ruby = ruby.join(',').gsub('\,', ',').strip
|
|
409
412
|
end
|
|
410
413
|
compile_ruby(base, ruby)
|
|
411
414
|
end
|
|
@@ -417,9 +420,9 @@ module ReVIEW
|
|
|
417
420
|
|
|
418
421
|
def inline_href(arg)
|
|
419
422
|
url, label = *arg.scan(/(?:(?:(?:\\\\)*\\,)|[^,\\]+)+/).map(&:lstrip)
|
|
420
|
-
url = url.gsub(
|
|
423
|
+
url = url.gsub('\,', ',').strip
|
|
421
424
|
if label
|
|
422
|
-
label = label.gsub(
|
|
425
|
+
label = label.gsub('\,', ',').strip
|
|
423
426
|
end
|
|
424
427
|
compile_href(url, label)
|
|
425
428
|
end
|
|
@@ -637,7 +640,7 @@ module ReVIEW
|
|
|
637
640
|
tf.puts content
|
|
638
641
|
tf.close
|
|
639
642
|
begin
|
|
640
|
-
file_path = send("graph_#{command}"
|
|
643
|
+
file_path = send(:"graph_#{command}", id, file_path, content, tf.path)
|
|
641
644
|
ensure
|
|
642
645
|
tf.unlink
|
|
643
646
|
end
|
|
@@ -699,6 +702,16 @@ EOTGNUPLOT
|
|
|
699
702
|
file_path
|
|
700
703
|
end
|
|
701
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
|
+
|
|
702
715
|
def image_ext
|
|
703
716
|
raise NotImplementedError
|
|
704
717
|
end
|
data/lib/review/compiler.rb
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright (c) 2009-
|
|
1
|
+
# Copyright (c) 2009-2024 Minero Aoki, Kenshi Muto
|
|
2
2
|
# Copyright (c) 2002-2007 Minero Aoki
|
|
3
3
|
#
|
|
4
4
|
# This program is free software.
|
|
@@ -681,7 +681,7 @@ module ReVIEW
|
|
|
681
681
|
end
|
|
682
682
|
break if words.empty?
|
|
683
683
|
|
|
684
|
-
result << compile_inline(revert_replace_fence(words.shift.gsub(
|
|
684
|
+
result << compile_inline(revert_replace_fence(words.shift.gsub('\\}', '}').gsub('\\\\', '\\')))
|
|
685
685
|
end
|
|
686
686
|
result
|
|
687
687
|
rescue StandardError => e
|
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,
|
data/lib/review/epubmaker.rb
CHANGED
|
@@ -17,6 +17,7 @@ require 'review/version'
|
|
|
17
17
|
require 'review/htmltoc'
|
|
18
18
|
require 'review/htmlbuilder'
|
|
19
19
|
require 'review/img_math'
|
|
20
|
+
require 'review/img_graph'
|
|
20
21
|
|
|
21
22
|
require 'rexml/document'
|
|
22
23
|
require 'rexml/streamlistener'
|
|
@@ -41,6 +42,7 @@ module ReVIEW
|
|
|
41
42
|
@buildlogtxt = 'build-log.txt'
|
|
42
43
|
@logger = ReVIEW.logger
|
|
43
44
|
@img_math = nil
|
|
45
|
+
@img_graph = nil
|
|
44
46
|
@basedir = nil
|
|
45
47
|
end
|
|
46
48
|
|
|
@@ -282,11 +284,12 @@ module ReVIEW
|
|
|
282
284
|
@manifeststr = ''
|
|
283
285
|
@ncxstr = ''
|
|
284
286
|
@tocdesc = []
|
|
287
|
+
@img_graph = ReVIEW::ImgGraph.new(@config, 'html', path_name: '_review_graph')
|
|
285
288
|
|
|
286
289
|
basedir = File.dirname(yamlfile)
|
|
287
290
|
base_path = Pathname.new(basedir)
|
|
288
291
|
book = ReVIEW::Book::Base.new(basedir, config: @config)
|
|
289
|
-
@converter = ReVIEW::Converter.new(book, ReVIEW::HTMLBuilder.new(img_math: @img_math))
|
|
292
|
+
@converter = ReVIEW::Converter.new(book, ReVIEW::HTMLBuilder.new(img_math: @img_math, img_graph: @img_graph))
|
|
290
293
|
@compile_errors = nil
|
|
291
294
|
|
|
292
295
|
book.parts.each do |part|
|
|
@@ -310,6 +313,13 @@ module ReVIEW
|
|
|
310
313
|
end
|
|
311
314
|
end
|
|
312
315
|
check_compile_status
|
|
316
|
+
|
|
317
|
+
begin
|
|
318
|
+
@img_graph.make_mermaid_images
|
|
319
|
+
rescue ApplicationError => e
|
|
320
|
+
error! e.message
|
|
321
|
+
end
|
|
322
|
+
@img_graph.cleanup_graphimg
|
|
313
323
|
end
|
|
314
324
|
|
|
315
325
|
def build_part(part, basetmpdir, htmlfile)
|
|
@@ -317,6 +327,7 @@ module ReVIEW
|
|
|
317
327
|
File.open(File.join(basetmpdir, htmlfile), 'w') do |f|
|
|
318
328
|
@part_number = part.number
|
|
319
329
|
@part_title = part.name.strip
|
|
330
|
+
@title = @part_title
|
|
320
331
|
@body = ReVIEW::Template.generate(path: template_name(localfile: '_part_body.html.erb', systemfile: 'html/_part_body.html.erb'), binding: binding)
|
|
321
332
|
@language = @producer.config['language']
|
|
322
333
|
@stylesheets = @producer.config['stylesheet']
|
data/lib/review/htmlbuilder.rb
CHANGED
data/lib/review/htmltoc.rb
CHANGED
data/lib/review/idgxmlbuilder.rb
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright (c) 2008-
|
|
1
|
+
# Copyright (c) 2008-2024 Minero Aoki, Kenshi Muto
|
|
2
2
|
# 2002-2007 Minero Aoki
|
|
3
3
|
#
|
|
4
4
|
# This program is free software.
|
|
@@ -532,9 +532,9 @@ module ReVIEW
|
|
|
532
532
|
next
|
|
533
533
|
end
|
|
534
534
|
if @tablewidth
|
|
535
|
-
rows.push(line.gsub(
|
|
535
|
+
rows.push(line.gsub("\t.\t", "\tDUMMYCELLSPLITTER\t").gsub("\t..\t", "\t.\t").gsub(/\t\.\Z/, "\tDUMMYCELLSPLITTER").gsub(/\t\.\.\Z/, "\t.").gsub(/\A\./, ''))
|
|
536
536
|
else
|
|
537
|
-
rows.push(line.gsub(
|
|
537
|
+
rows.push(line.gsub("\t.\t", "\t\t").gsub("\t..\t", "\t.\t").gsub(/\t\.\Z/, "\t").gsub(/\t\.\.\Z/, "\t.").gsub(/\A\./, ''))
|
|
538
538
|
end
|
|
539
539
|
col2 = rows[rows.length - 1].split(table_row_separator_regexp).length
|
|
540
540
|
@col = col2 if col2 > @col
|
data/lib/review/idgxmlmaker.rb
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright (c) 2019-
|
|
1
|
+
# Copyright (c) 2019-2023 Kenshi Muto
|
|
2
2
|
#
|
|
3
3
|
# This program is free software.
|
|
4
4
|
# You can distribute or modify this program under the terms of
|
|
@@ -17,6 +17,7 @@ require 'review/idgxmlbuilder'
|
|
|
17
17
|
require 'review/version'
|
|
18
18
|
require 'review/makerhelper'
|
|
19
19
|
require 'review/img_math'
|
|
20
|
+
require 'review/img_graph'
|
|
20
21
|
require 'review/loggable'
|
|
21
22
|
|
|
22
23
|
module ReVIEW
|
|
@@ -30,6 +31,7 @@ module ReVIEW
|
|
|
30
31
|
@basedir = nil
|
|
31
32
|
@logger = ReVIEW.logger
|
|
32
33
|
@img_math = nil
|
|
34
|
+
@img_graph = nil
|
|
33
35
|
@plaintext = nil
|
|
34
36
|
@compile_errors = nil
|
|
35
37
|
end
|
|
@@ -70,6 +72,7 @@ module ReVIEW
|
|
|
70
72
|
|
|
71
73
|
def remove_old_files(path)
|
|
72
74
|
@img_math.cleanup_mathimg
|
|
75
|
+
@img_graph.cleanup_graphimg
|
|
73
76
|
FileUtils.rm_rf(path)
|
|
74
77
|
end
|
|
75
78
|
|
|
@@ -86,6 +89,7 @@ module ReVIEW
|
|
|
86
89
|
end
|
|
87
90
|
|
|
88
91
|
@img_math = ReVIEW::ImgMath.new(@config)
|
|
92
|
+
@img_graph = ReVIEW::ImgGraph.new(@config, 'idgxml', path_name: '_review_graph')
|
|
89
93
|
|
|
90
94
|
I18n.setup(@config['language'])
|
|
91
95
|
begin
|
|
@@ -100,6 +104,13 @@ module ReVIEW
|
|
|
100
104
|
if @config['math_format'] == 'imgmath'
|
|
101
105
|
@img_math.make_math_images
|
|
102
106
|
end
|
|
107
|
+
|
|
108
|
+
begin
|
|
109
|
+
@img_graph.make_mermaid_images
|
|
110
|
+
rescue ApplicationError => e
|
|
111
|
+
error! e.message
|
|
112
|
+
end
|
|
113
|
+
@img_graph.cleanup_graphimg
|
|
103
114
|
end
|
|
104
115
|
|
|
105
116
|
def generate_idgxml_files(yamlfile)
|
|
@@ -140,7 +151,7 @@ module ReVIEW
|
|
|
140
151
|
|
|
141
152
|
def build_body(basetmpdir, _yamlfile)
|
|
142
153
|
base_path = Pathname.new(@basedir)
|
|
143
|
-
@converter = ReVIEW::Converter.new(@book, ReVIEW::IDGXMLBuilder.new(img_math: @img_math))
|
|
154
|
+
@converter = ReVIEW::Converter.new(@book, ReVIEW::IDGXMLBuilder.new(img_math: @img_math, img_graph: @img_graph))
|
|
144
155
|
@book.parts.each do |part|
|
|
145
156
|
if part.name.present?
|
|
146
157
|
if part.file?
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Copyright (c) 2023 Kenshi Muto
|
|
3
|
+
#
|
|
4
|
+
# This program is free software.
|
|
5
|
+
# You can distribute/modify this program under the terms of
|
|
6
|
+
# the GNU LGPL, Lesser General Public License version 2.1.
|
|
7
|
+
#
|
|
8
|
+
require 'review/loggable'
|
|
9
|
+
|
|
10
|
+
module ReVIEW
|
|
11
|
+
class ImgGraph
|
|
12
|
+
include Loggable
|
|
13
|
+
|
|
14
|
+
def initialize(config, target_name, path_name: '_review_graph')
|
|
15
|
+
@config = config
|
|
16
|
+
@target_name = target_name
|
|
17
|
+
@logger = ReVIEW.logger
|
|
18
|
+
@graph_dir = File.join(@config['imagedir'], target_name, path_name)
|
|
19
|
+
@graph_maps = {}
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
attr_reader :graph_maps
|
|
23
|
+
|
|
24
|
+
def cleanup_graphimg
|
|
25
|
+
FileUtils.rm_rf(@graph_dir)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def graph_ext
|
|
29
|
+
if %w[html markdown rst].include?(@target_name)
|
|
30
|
+
'svg'
|
|
31
|
+
else
|
|
32
|
+
'pdf'
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def defer_mermaid_image(str, key)
|
|
37
|
+
@graph_maps[key] = { type: 'mermaid', content: str }
|
|
38
|
+
File.join('.', @config['imagedir'], @target_name, "#{key}.#{graph_ext}")
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def mermaid_html(content)
|
|
42
|
+
<<-EOB
|
|
43
|
+
<!DOCTYPE html>
|
|
44
|
+
<html>
|
|
45
|
+
<head><meta charset="UTF-8"><script type="module">import mermaid from 'https://cdn.jsdelivr.net/npm/mermaid@10/dist/mermaid.esm.min.mjs'; mermaid.initialize({ startOnLoad: true });</script></head>
|
|
46
|
+
<body><div><pre class="mermaid">#{content}</pre></div></body></html>
|
|
47
|
+
EOB
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def make_mermaid_images
|
|
51
|
+
mermaid_graph_maps = @graph_maps.select { |_k, v| v[:type] == 'mermaid' }
|
|
52
|
+
return if mermaid_graph_maps.empty?
|
|
53
|
+
|
|
54
|
+
FileUtils.mkdir_p(File.join(@graph_dir, 'mermaid'))
|
|
55
|
+
mermaid_graph_maps.each_pair do |key, val|
|
|
56
|
+
File.write(File.join(@graph_dir, 'mermaid', "#{key}.html"), mermaid_html(val[:content]))
|
|
57
|
+
end
|
|
58
|
+
@logger.info 'calling Playwright'
|
|
59
|
+
|
|
60
|
+
begin
|
|
61
|
+
require 'playwrightrunner'
|
|
62
|
+
PlaywrightRunner.mermaids_to_images(
|
|
63
|
+
{ playwright_path: @config['playwright_options']['playwright_path'],
|
|
64
|
+
selfcrop: @config['playwright_options']['selfcrop'],
|
|
65
|
+
pdfcrop_path: @config['playwright_options']['pdfcrop_path'],
|
|
66
|
+
pdftocairo_path: @config['playwright_options']['pdftocairo_path'] },
|
|
67
|
+
src: File.join(@graph_dir, 'mermaid'),
|
|
68
|
+
dest: File.join(@config['imagedir'], @target_name),
|
|
69
|
+
type: graph_ext
|
|
70
|
+
)
|
|
71
|
+
rescue SystemCallError => e
|
|
72
|
+
raise ApplicationError, "converting mermaid failed: #{e}"
|
|
73
|
+
rescue LoadError
|
|
74
|
+
raise ApplicationError, 'could not handle Mermaid of //graph in this builder.'
|
|
75
|
+
end
|
|
76
|
+
FileUtils.rm_rf(File.join(@graph_dir, 'mermaid'))
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
end
|
data/lib/review/logger.rb
CHANGED
|
@@ -190,19 +190,19 @@ module ReVIEW
|
|
|
190
190
|
end
|
|
191
191
|
|
|
192
192
|
def inline_i(str)
|
|
193
|
-
"*#{str.gsub(
|
|
193
|
+
"*#{str.gsub('*', '\*')}*"
|
|
194
194
|
end
|
|
195
195
|
|
|
196
196
|
def inline_em(str)
|
|
197
|
-
"*#{str.gsub(
|
|
197
|
+
"*#{str.gsub('*', '\*')}*"
|
|
198
198
|
end
|
|
199
199
|
|
|
200
200
|
def inline_b(str)
|
|
201
|
-
"**#{str.gsub(
|
|
201
|
+
"**#{str.gsub('*', '\*')}**"
|
|
202
202
|
end
|
|
203
203
|
|
|
204
204
|
def inline_strong(str)
|
|
205
|
-
"**#{str.gsub(
|
|
205
|
+
"**#{str.gsub('*', '\*')}**"
|
|
206
206
|
end
|
|
207
207
|
|
|
208
208
|
def inline_code(str)
|
data/lib/review/pdfmaker.rb
CHANGED
|
@@ -25,6 +25,7 @@ require 'review/template'
|
|
|
25
25
|
require 'review/latexbox'
|
|
26
26
|
require 'review/call_hook'
|
|
27
27
|
require 'review/loggable'
|
|
28
|
+
require 'review/img_graph'
|
|
28
29
|
|
|
29
30
|
module ReVIEW
|
|
30
31
|
class PDFMaker
|
|
@@ -260,17 +261,26 @@ module ReVIEW
|
|
|
260
261
|
def generate_pdf
|
|
261
262
|
remove_old_file
|
|
262
263
|
@path = build_path
|
|
264
|
+
@img_graph = ReVIEW::ImgGraph.new(@config, 'latex', path_name: '_review_graph')
|
|
265
|
+
|
|
263
266
|
begin
|
|
264
267
|
@compile_errors = nil
|
|
265
268
|
|
|
266
269
|
book = ReVIEW::Book::Base.new(@basedir, config: @config)
|
|
267
|
-
@converter = ReVIEW::Converter.new(book, ReVIEW::LATEXBuilder.new)
|
|
270
|
+
@converter = ReVIEW::Converter.new(book, ReVIEW::LATEXBuilder.new(img_graph: @img_graph))
|
|
268
271
|
erb_config
|
|
269
272
|
|
|
270
273
|
@input_files = make_input_files(book)
|
|
271
274
|
|
|
272
275
|
check_compile_status(@config['ignore-errors'])
|
|
273
276
|
|
|
277
|
+
begin
|
|
278
|
+
@img_graph.make_mermaid_images
|
|
279
|
+
rescue ApplicationError => e
|
|
280
|
+
error! e.message
|
|
281
|
+
end
|
|
282
|
+
@img_graph.cleanup_graphimg
|
|
283
|
+
|
|
274
284
|
# for backward compatibility
|
|
275
285
|
@config['usepackage'] = ''
|
|
276
286
|
@config['usepackage'] = "\\usepackage{#{@config['texstyle']}}" if @config['texstyle']
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright (c) 2018-
|
|
1
|
+
# Copyright (c) 2018-2023 Kenshi Muto
|
|
2
2
|
#
|
|
3
3
|
# This program is free software.
|
|
4
4
|
# You can distribute or modify this program under the terms of
|
|
@@ -723,6 +723,18 @@ module ReVIEW
|
|
|
723
723
|
str
|
|
724
724
|
end
|
|
725
725
|
|
|
726
|
+
def graph_mermaid(_id, file_path, _line, _tf_path)
|
|
727
|
+
if self.instance_of?(ReVIEW::PLAINTEXTBuilder)
|
|
728
|
+
file_path
|
|
729
|
+
else
|
|
730
|
+
super
|
|
731
|
+
end
|
|
732
|
+
end
|
|
733
|
+
|
|
734
|
+
def image_ext
|
|
735
|
+
'png'
|
|
736
|
+
end
|
|
737
|
+
|
|
726
738
|
alias_method :th, :nofunc_text
|
|
727
739
|
alias_method :td, :nofunc_text
|
|
728
740
|
alias_method :inline_sup, :nofunc_text
|
data/lib/review/textmaker.rb
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright (c) 2018-
|
|
1
|
+
# Copyright (c) 2018-2023 Kenshi Muto
|
|
2
2
|
#
|
|
3
3
|
# This program is free software.
|
|
4
4
|
# You can distribute or modify this program under the terms of
|
|
@@ -17,6 +17,7 @@ require 'review/topbuilder'
|
|
|
17
17
|
require 'review/version'
|
|
18
18
|
require 'review/makerhelper'
|
|
19
19
|
require 'review/img_math'
|
|
20
|
+
require 'review/img_graph'
|
|
20
21
|
require 'review/loggable'
|
|
21
22
|
|
|
22
23
|
module ReVIEW
|
|
@@ -31,6 +32,7 @@ module ReVIEW
|
|
|
31
32
|
@logger = ReVIEW.logger
|
|
32
33
|
@plaintext = nil
|
|
33
34
|
@img_math = nil
|
|
35
|
+
@img_graph = nil
|
|
34
36
|
@compile_errors = nil
|
|
35
37
|
end
|
|
36
38
|
|
|
@@ -67,6 +69,7 @@ module ReVIEW
|
|
|
67
69
|
|
|
68
70
|
def remove_old_files(path)
|
|
69
71
|
@img_math.cleanup_mathimg
|
|
72
|
+
@img_graph.cleanup_graphimg
|
|
70
73
|
FileUtils.rm_rf(path)
|
|
71
74
|
end
|
|
72
75
|
|
|
@@ -83,6 +86,7 @@ module ReVIEW
|
|
|
83
86
|
end
|
|
84
87
|
|
|
85
88
|
@img_math = ReVIEW::ImgMath.new(@config, path_name: '_review_math_text')
|
|
89
|
+
@img_graph = ReVIEW::ImgGraph.new(@config, 'top', path_name: '_review_graph')
|
|
86
90
|
|
|
87
91
|
I18n.setup(@config['language'])
|
|
88
92
|
begin
|
|
@@ -97,6 +101,13 @@ module ReVIEW
|
|
|
97
101
|
if @config['math_format'] == 'imgmath'
|
|
98
102
|
@img_math.make_math_images
|
|
99
103
|
end
|
|
104
|
+
|
|
105
|
+
begin
|
|
106
|
+
@img_graph.make_mermaid_images
|
|
107
|
+
rescue ApplicationError => e
|
|
108
|
+
error! e.message
|
|
109
|
+
end
|
|
110
|
+
@img_graph.cleanup_graphimg
|
|
100
111
|
end
|
|
101
112
|
|
|
102
113
|
def generate_text_files(yamlfile)
|
|
@@ -117,9 +128,9 @@ module ReVIEW
|
|
|
117
128
|
def build_body(basetmpdir, _yamlfile)
|
|
118
129
|
base_path = Pathname.new(@basedir)
|
|
119
130
|
builder = if @plaintext
|
|
120
|
-
ReVIEW::PLAINTEXTBuilder.new(img_math: @img_math)
|
|
131
|
+
ReVIEW::PLAINTEXTBuilder.new(img_math: @img_math, img_graph: @img_graph)
|
|
121
132
|
else
|
|
122
|
-
ReVIEW::TOPBuilder.new(img_math: @img_math)
|
|
133
|
+
ReVIEW::TOPBuilder.new(img_math: @img_math, img_graph: @img_graph)
|
|
123
134
|
end
|
|
124
135
|
@converter = ReVIEW::Converter.new(@book, builder)
|
|
125
136
|
@book.parts.each do |part|
|
data/lib/review/textutils.rb
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright (c) 2008-
|
|
1
|
+
# Copyright (c) 2008-2023 Minero Aoki, Kenshi Muto, Masayoshi Takahashi,
|
|
2
2
|
# KADO Masanori
|
|
3
3
|
# 2002-2007 Minero Aoki
|
|
4
4
|
#
|
|
@@ -49,7 +49,7 @@ module ReVIEW
|
|
|
49
49
|
tail = line1[-1]
|
|
50
50
|
head = line2[0]
|
|
51
51
|
if tail.nil? || head.nil?
|
|
52
|
-
return
|
|
52
|
+
return false
|
|
53
53
|
end
|
|
54
54
|
|
|
55
55
|
space = true
|
data/lib/review/version.rb
CHANGED
data/lib/review/yamlloader.rb
CHANGED
data/review.gemspec
CHANGED
|
@@ -25,9 +25,10 @@ Gem::Specification.new do |gem|
|
|
|
25
25
|
gem.add_dependency('rubyzip')
|
|
26
26
|
gem.add_dependency('tty-logger')
|
|
27
27
|
gem.add_development_dependency('mini_magick')
|
|
28
|
+
gem.add_development_dependency('playwright-runner')
|
|
28
29
|
gem.add_development_dependency('pygments.rb')
|
|
29
30
|
gem.add_development_dependency('rake')
|
|
30
|
-
gem.add_development_dependency('rubocop', '~> 1.
|
|
31
|
+
gem.add_development_dependency('rubocop', '~> 1.59.0')
|
|
31
32
|
gem.add_development_dependency('rubocop-performance')
|
|
32
33
|
gem.add_development_dependency('rubocop-rake')
|
|
33
34
|
gem.add_development_dependency('simplecov')
|
|
@@ -153,7 +153,7 @@ colophon: true
|
|
|
153
153
|
# verify_target_images: null
|
|
154
154
|
# verify_target_imagesがtrueの状態において、解析で発見されなくても強制的に取り込むファイルの相対パスの配列
|
|
155
155
|
# force_include_images: []
|
|
156
|
-
# Re:VIEWファイル名を使わず、前付にpre01,pre02...、本文にchap01,
|
|
156
|
+
# Re:VIEWファイル名を使わず、前付にpre01,pre02...、本文にchap01,chap02...、後付にpost01,post02...という名前付けルールにするか
|
|
157
157
|
# rename_for_legacy: null
|
|
158
158
|
# ePUBアーカイブの非圧縮実行
|
|
159
159
|
# zip_stage1: "zip -0Xq"
|
data/samples/syntax-book/ch02.re
CHANGED
|
@@ -365,6 +365,12 @@ labelで定義したラベルへの参照の例です。EPUBだと@<href>{#inlin
|
|
|
365
365
|
: @<column>{ch03|column2}
|
|
366
366
|
コラム参照
|
|
367
367
|
|
|
368
|
+
URLは@<embed>{@}<href>を使います。@<href>{https://localhost/longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglong}@<fn>{fnref}
|
|
369
|
+
|
|
370
|
+
//footnote[fnref][脚注に長いURLを入れてみます。@<href>{https://localhost/longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglong}]
|
|
371
|
+
|
|
372
|
+
|
|
373
|
+
|
|
368
374
|
=== 参考文献
|
|
369
375
|
参考文献@<tt>{bib.re}ファイルへの文献参照は、@<bib>{lins}とします。
|
|
370
376
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# call me by 'REVIEW_TEMPLATE=review-jlreq REVIEW_CONFIG_FILE=config-jlreq.yml rake pdf'
|
|
2
2
|
inherit: ["config.yml"]
|
|
3
|
-
# texdocumentclass: ["review-jlreq", "media=print,paper=
|
|
4
|
-
texdocumentclass: ["review-jlreq", "media=ebook,paper=
|
|
5
|
-
# texdocumentclass: ["review-jlreq", "media=print,paper=
|
|
3
|
+
# texdocumentclass: ["review-jlreq", "media=print,paper=b5j"]
|
|
4
|
+
texdocumentclass: ["review-jlreq", "media=ebook,paper=b5j"]
|
|
5
|
+
# texdocumentclass: ["review-jlreq", "media=print,paper=b5j,bleed_margin=3mm,cover=true,Q=14,startpage=3,serial_pagination=true,hiddenfolio=nikko-pc"]
|
|
@@ -47,7 +47,8 @@ texdocumentclass: ["review-jlreq", "クラスオプションたち(省略可
|
|
|
47
47
|
利用可能な特定の用紙サイズを指定できます。[デフォルト]は a5 です。
|
|
48
48
|
|
|
49
49
|
* `a0` 〜 `a10`:A 列
|
|
50
|
-
* `
|
|
50
|
+
* `b0j` 〜 `b10j`:JIS B 列
|
|
51
|
+
* `b0` 〜 `b10`:ISO B 列
|
|
51
52
|
* `c0` 〜 `c8`:C 列
|
|
52
53
|
* `a4var`:210mm x 283mm
|
|
53
54
|
* `b5var`:182mm x 230mm
|
|
@@ -57,6 +58,8 @@ texdocumentclass: ["review-jlreq", "クラスオプションたち(省略可
|
|
|
57
58
|
* `hagaki`:葉書き、100mm x 148mm
|
|
58
59
|
* `{横幅,縦幅}`:任意の指定サイズ
|
|
59
60
|
|
|
61
|
+
日本の B 列サイズにするには `b5j` のように j 付きで指定することに注意してください。
|
|
62
|
+
|
|
60
63
|
### トンボ用紙サイズ `tombopaper=<用紙サイズ>` および塗り足し幅 `bleed_margin=<幅>`
|
|
61
64
|
|
|
62
65
|
`tombopaper` ではトンボ用紙サイズを指定できます。
|
|
@@ -202,6 +202,11 @@
|
|
|
202
202
|
\def\reviewinsert#1{#1}
|
|
203
203
|
\def\reviewstrike#1{#1}
|
|
204
204
|
\def\reviewunderline#1{#1}
|
|
205
|
+
\def\reviewtt#1{#1}
|
|
206
|
+
\def\reviewcode#1{#1}
|
|
207
|
+
\def\reviewtti#1{#1}
|
|
208
|
+
\def\reviewttb#1{#1}
|
|
209
|
+
\let\reviewicon\@gobble
|
|
205
210
|
}
|
|
206
211
|
\newif\ifreview@ba@break
|
|
207
212
|
\def\review@ba@end{\review@ba@end@}
|
|
@@ -247,10 +252,10 @@
|
|
|
247
252
|
\review@ba@breaktrue
|
|
248
253
|
\review@break@all@a
|
|
249
254
|
}
|
|
250
|
-
\DeclareRobustCommand{\reviewtt}[1]{{\ttfamily\reviewbreakall{#1}}}
|
|
251
|
-
\DeclareRobustCommand{\reviewcode}[1]{{\ttfamily\reviewbreakall{#1}}}
|
|
252
|
-
\DeclareRobustCommand{\reviewtti}[1]{{\ttfamily\itshape\reviewbreakall{#1}}}
|
|
253
|
-
\DeclareRobustCommand{\reviewttb}[1]{{\ttfamily\bfseries\reviewbreakall{#1}}}
|
|
255
|
+
\DeclareRobustCommand{\reviewtt}[1]{{\frenchspacing\ttfamily\reviewbreakall{#1}}}
|
|
256
|
+
\DeclareRobustCommand{\reviewcode}[1]{{\frenchspacing\ttfamily\reviewbreakall{#1}}}
|
|
257
|
+
\DeclareRobustCommand{\reviewtti}[1]{{\frenchspacing\ttfamily\itshape\reviewbreakall{#1}}}
|
|
258
|
+
\DeclareRobustCommand{\reviewttb}[1]{{\frenchspacing\ttfamily\bfseries\reviewbreakall{#1}}}
|
|
254
259
|
|
|
255
260
|
\DeclareRobustCommand{\reviewbou}[1]{\kenten{#1}}
|
|
256
261
|
|
|
@@ -224,6 +224,20 @@
|
|
|
224
224
|
\RequirePackage{pxjahyper}
|
|
225
225
|
\fi
|
|
226
226
|
|
|
227
|
+
%% better line breaks for long urls
|
|
228
|
+
\AtBeginDocument{%
|
|
229
|
+
%% modified url.sty
|
|
230
|
+
\def\UrlBreaks{%
|
|
231
|
+
\do\0\do\1\do\2\do\3\do\4\do\5\do\6\do\7\do\8\do\9%
|
|
232
|
+
\do\A\do\B\do\C\do\D\do\E\do\F\do\G\do\H\do\I\do\J\do\K\do\L\do\M\do\N%
|
|
233
|
+
\do\O\do\P\do\Q\do\R\do\S\do\T\do\U\do\V\do\W\do\X\do\Y\do\Z%
|
|
234
|
+
\do\a\do\b\do\c\do\d\do\e\do\f\do\g\do\h\do\i\do\j\do\k\do\l\do\m\do\n%
|
|
235
|
+
\do\o\do\p\do\q\do\r\do\s\do\t\do\u\do\v\do\w\do\x\do\y\do\z%
|
|
236
|
+
%%
|
|
237
|
+
\do\.\do\@\do\\\do\/\do\!\do\_\do\|\do\;\do\>\do\]%
|
|
238
|
+
\do\)\do\,\do\?\do\&\do\'\do+\do\=\do\#}%
|
|
239
|
+
}
|
|
240
|
+
|
|
227
241
|
%% include fullpage graphics
|
|
228
242
|
\edef\grnchry@head{\dimexpr\topmargin+1in+\headheight+\headsep}
|
|
229
243
|
\edef\grnchry@gutter{\evensidemargin}
|
|
@@ -277,6 +277,11 @@
|
|
|
277
277
|
\def\reviewinsert#1{#1}
|
|
278
278
|
\def\reviewstrike#1{#1}
|
|
279
279
|
\def\reviewunderline#1{#1}
|
|
280
|
+
\def\reviewtt#1{#1}
|
|
281
|
+
\def\reviewcode#1{#1}
|
|
282
|
+
\def\reviewtti#1{#1}
|
|
283
|
+
\def\reviewttb#1{#1}
|
|
284
|
+
\let\reviewicon\@gobble
|
|
280
285
|
}
|
|
281
286
|
\newif\ifreview@ba@break
|
|
282
287
|
\def\review@ba@end{\review@ba@end@}
|
|
@@ -322,10 +327,10 @@
|
|
|
322
327
|
\review@ba@breaktrue
|
|
323
328
|
\review@break@all@a
|
|
324
329
|
}
|
|
325
|
-
\DeclareRobustCommand{\reviewtt}[1]{{\ttfamily\reviewbreakall{#1}}}
|
|
326
|
-
\DeclareRobustCommand{\reviewcode}[1]{{\ttfamily\reviewbreakall{#1}}}
|
|
327
|
-
\DeclareRobustCommand{\reviewtti}[1]{{\ttfamily\itshape\reviewbreakall{#1}}}
|
|
328
|
-
\DeclareRobustCommand{\reviewttb}[1]{{\ttfamily\bfseries\reviewbreakall{#1}}}
|
|
330
|
+
\DeclareRobustCommand{\reviewtt}[1]{{\frenchspacing\ttfamily\reviewbreakall{#1}}}
|
|
331
|
+
\DeclareRobustCommand{\reviewcode}[1]{{\frenchspacing\ttfamily\reviewbreakall{#1}}}
|
|
332
|
+
\DeclareRobustCommand{\reviewtti}[1]{{\frenchspacing\ttfamily\itshape\reviewbreakall{#1}}}
|
|
333
|
+
\DeclareRobustCommand{\reviewttb}[1]{{\frenchspacing\ttfamily\bfseries\reviewbreakall{#1}}}
|
|
329
334
|
|
|
330
335
|
\DeclareRobustCommand{\reviewbou}[1]{\kenten{#1}}
|
|
331
336
|
|
|
@@ -400,6 +400,20 @@
|
|
|
400
400
|
]{hyperref}
|
|
401
401
|
\RequirePackage{pxjahyper}
|
|
402
402
|
|
|
403
|
+
%% better line breaks for long urls
|
|
404
|
+
\AtBeginDocument{%
|
|
405
|
+
%% modified url.sty
|
|
406
|
+
\def\UrlBreaks{%
|
|
407
|
+
\do\0\do\1\do\2\do\3\do\4\do\5\do\6\do\7\do\8\do\9%
|
|
408
|
+
\do\A\do\B\do\C\do\D\do\E\do\F\do\G\do\H\do\I\do\J\do\K\do\L\do\M\do\N%
|
|
409
|
+
\do\O\do\P\do\Q\do\R\do\S\do\T\do\U\do\V\do\W\do\X\do\Y\do\Z%
|
|
410
|
+
\do\a\do\b\do\c\do\d\do\e\do\f\do\g\do\h\do\i\do\j\do\k\do\l\do\m\do\n%
|
|
411
|
+
\do\o\do\p\do\q\do\r\do\s\do\t\do\u\do\v\do\w\do\x\do\y\do\z%
|
|
412
|
+
%%
|
|
413
|
+
\do\.\do\@\do\\\do\/\do\!\do\_\do\|\do\;\do\>\do\]%
|
|
414
|
+
\do\)\do\,\do\?\do\&\do\'\do+\do\=\do\#}%
|
|
415
|
+
}
|
|
416
|
+
|
|
403
417
|
%% more useful macros
|
|
404
418
|
%% ----------
|
|
405
419
|
%% include fullpage graphics
|
metadata
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: review
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 5.
|
|
4
|
+
version: 5.9.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- kmuto
|
|
8
8
|
- takahashim
|
|
9
|
-
autorequire:
|
|
9
|
+
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date:
|
|
12
|
+
date: 2024-05-04 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: image_size
|
|
@@ -95,6 +95,20 @@ dependencies:
|
|
|
95
95
|
- - ">="
|
|
96
96
|
- !ruby/object:Gem::Version
|
|
97
97
|
version: '0'
|
|
98
|
+
- !ruby/object:Gem::Dependency
|
|
99
|
+
name: playwright-runner
|
|
100
|
+
requirement: !ruby/object:Gem::Requirement
|
|
101
|
+
requirements:
|
|
102
|
+
- - ">="
|
|
103
|
+
- !ruby/object:Gem::Version
|
|
104
|
+
version: '0'
|
|
105
|
+
type: :development
|
|
106
|
+
prerelease: false
|
|
107
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
108
|
+
requirements:
|
|
109
|
+
- - ">="
|
|
110
|
+
- !ruby/object:Gem::Version
|
|
111
|
+
version: '0'
|
|
98
112
|
- !ruby/object:Gem::Dependency
|
|
99
113
|
name: pygments.rb
|
|
100
114
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -129,14 +143,14 @@ dependencies:
|
|
|
129
143
|
requirements:
|
|
130
144
|
- - "~>"
|
|
131
145
|
- !ruby/object:Gem::Version
|
|
132
|
-
version: 1.
|
|
146
|
+
version: 1.59.0
|
|
133
147
|
type: :development
|
|
134
148
|
prerelease: false
|
|
135
149
|
version_requirements: !ruby/object:Gem::Requirement
|
|
136
150
|
requirements:
|
|
137
151
|
- - "~>"
|
|
138
152
|
- !ruby/object:Gem::Version
|
|
139
|
-
version: 1.
|
|
153
|
+
version: 1.59.0
|
|
140
154
|
- !ruby/object:Gem::Dependency
|
|
141
155
|
name: rubocop-performance
|
|
142
156
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -354,6 +368,7 @@ files:
|
|
|
354
368
|
- lib/review/i18n.yml
|
|
355
369
|
- lib/review/idgxmlbuilder.rb
|
|
356
370
|
- lib/review/idgxmlmaker.rb
|
|
371
|
+
- lib/review/img_graph.rb
|
|
357
372
|
- lib/review/img_math.rb
|
|
358
373
|
- lib/review/index_builder.rb
|
|
359
374
|
- lib/review/init-web/finish.html
|
|
@@ -590,7 +605,7 @@ licenses:
|
|
|
590
605
|
- LGPL
|
|
591
606
|
metadata:
|
|
592
607
|
rubygems_mfa_required: 'true'
|
|
593
|
-
post_install_message:
|
|
608
|
+
post_install_message:
|
|
594
609
|
rdoc_options: []
|
|
595
610
|
require_paths:
|
|
596
611
|
- lib
|
|
@@ -605,8 +620,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
605
620
|
- !ruby/object:Gem::Version
|
|
606
621
|
version: '0'
|
|
607
622
|
requirements: []
|
|
608
|
-
rubygems_version: 3.
|
|
609
|
-
signing_key:
|
|
623
|
+
rubygems_version: 3.5.3
|
|
624
|
+
signing_key:
|
|
610
625
|
specification_version: 4
|
|
611
626
|
summary: 'Re:VIEW: a easy-to-use digital publishing system'
|
|
612
627
|
test_files: []
|