review 5.2.0 → 5.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby-win.yml +1 -1
- data/.rubocop.yml +3 -0
- data/NEWS.ja.md +53 -0
- data/NEWS.md +53 -0
- data/doc/format.ja.md +29 -3
- data/doc/format.md +32 -3
- data/lib/review/book/book_unit.rb +12 -2
- data/lib/review/book/index.rb +4 -1
- data/lib/review/builder.rb +51 -16
- data/lib/review/catalog.rb +1 -0
- data/lib/review/compiler.rb +4 -1
- data/lib/review/epubmaker/epubcommon.rb +4 -4
- data/lib/review/epubmaker.rb +3 -1
- data/lib/review/htmlbuilder.rb +24 -0
- data/lib/review/i18n.yml +6 -0
- data/lib/review/idgxmlbuilder.rb +21 -1
- data/lib/review/img_math.rb +1 -0
- data/lib/review/index_builder.rb +84 -18
- data/lib/review/latexbuilder.rb +16 -1
- data/lib/review/markdownbuilder.rb +10 -2
- data/lib/review/pdfmaker.rb +18 -3
- data/lib/review/plaintextbuilder.rb +3 -2
- data/lib/review/rstbuilder.rb +11 -2
- data/lib/review/textutils.rb +8 -7
- data/lib/review/tocprinter.rb +11 -6
- data/lib/review/topbuilder.rb +19 -1
- data/lib/review/version.rb +1 -1
- data/lib/review/volumeprinter.rb +9 -9
- data/samples/syntax-book/ch02.re +9 -0
- data/templates/latex/config.erb +3 -0
- data/templates/latex/review-jlreq/review-base.sty +2 -1
- data/templates/latex/review-jlreq/review-jlreq.cls +36 -3
- data/templates/latex/review-jsbook/review-base.sty +7 -1
- data/templates/latex/review-jsbook/review-jsbook.cls +31 -4
- data/test/assets/syntax_book_index_detail.txt +10 -8
- data/test/assets/test_template.tex +4 -1
- data/test/assets/test_template_backmatter.tex +4 -1
- data/test/test_book_chapter.rb +25 -2
- data/test/test_builder.rb +5 -3
- data/test/test_htmlbuilder.rb +42 -3
- data/test/test_idgxmlbuilder.rb +3 -3
- data/test/test_index.rb +30 -4
- data/test/test_latexbuilder.rb +17 -3
- data/test/test_markdownbuilder.rb +13 -0
- data/test/test_pdfmaker.rb +19 -0
- data/test/test_plaintextbuilder.rb +20 -4
- data/test/test_rstbuilder.rb +13 -0
- data/test/test_topbuilder.rb +18 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f75b248a75c068752f6940450fce0815923dd26423d339b50df3b137601742e0
|
4
|
+
data.tar.gz: 37607fe69c2fa934968ee1a0f2f66415ee341b5ac777480a19d97086f99a9c15
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 88444aa04c1503229eab1a1342d672f9149f499ebc3d15025134f3bdbf96fe1036a96ae9729622eea72fcf39b42aead1c17a1fa802e51838d9dfe25d5e8b5df8
|
7
|
+
data.tar.gz: 7096c49f6db52f29d81ec977479803fc55f6772d319ea96d30e673a72638a59d2031ca4bc88453d83e85e1141a1984724b2a88e253b6b786abe7a2c090565426
|
data/.rubocop.yml
CHANGED
data/NEWS.ja.md
CHANGED
@@ -1,3 +1,56 @@
|
|
1
|
+
# Version 5.3.0
|
2
|
+
## 新機能
|
3
|
+
* 後注のサポートを追加しました。`//endnote` 命令で後注内容、`@<endnote>` 命令で後注参照、`//printendnotes` 命令で後注を配置する場所を指定します ([#1724])
|
4
|
+
|
5
|
+
## バグ修正
|
6
|
+
* 新しい jlreq において ifthen パッケージに非依存になったことによるエラーを修正しました ([#1718])
|
7
|
+
* review-jsbook と新しい TeXLive 2020 以降の組み合わせにおいて、隠しノンブルがすべて1になってしまう問題を修正しました ([#1720])
|
8
|
+
* coverimage パラメータに実際に存在しないファイルを指定したときに例外エラーが発生するのを修正しました ([#1726], [#1729])
|
9
|
+
* titlefile・creditfile・profile パラメータに存在しないファイルを指定したときに警告を表示するようにしました ([#1730])
|
10
|
+
* review-jlreq で `@<tcy>` 命令がエラーになるのを修正しました。縦中横の TeX 表現側での抽象名に `\reviewtcy` マクロを使うようにしました ([#1733])
|
11
|
+
* review-vol および review-index の例外エラーを修正しました ([#1740])
|
12
|
+
* 数式ビルドエラーが出たときに `__IMGMATH_BODY__.tex` のコピーを忘れているのを修正しました ([#1747])
|
13
|
+
* `//beginchild`・`//endchild` 命令でエラーが起きたときにエラー位置の表示がされていなかったのを修正しました ([#1742])
|
14
|
+
* `//graph` 命令を使うとビルドエラーになるのを修正しました ([#1744])
|
15
|
+
* epubmaker.rb で未定義の変数を参照している箇所を修正しました ([#1755])
|
16
|
+
* review-catalog-converter がエラーになるのを修正しました ([#1753])
|
17
|
+
|
18
|
+
## 機能強化
|
19
|
+
* 脚注 (`//footnote`)・後注(`//endnote`) を定義したけれども参照(`@<fn>`、`@<endnote>`)していないときに警告するようにしました ([#1725])
|
20
|
+
* 紙面全体に画像を貼り込む `\includefullpagegraphics` マクロを縦書きにも対応するようにしました ([#1734])
|
21
|
+
* plantuml の jar ファイル探索先を作業フォルダのほか、`/usr/share/plantuml`、`/usr/share/java` からも探すようにしました ([#1760])
|
22
|
+
|
23
|
+
## ドキュメント
|
24
|
+
* format.ja.md, format.md: SVG数式を作成するコマンドラインの間違いを修正しました ([#1748])
|
25
|
+
|
26
|
+
## その他
|
27
|
+
* Windows 版 Ruby 2.7 のテストを追加しました ([#1743])
|
28
|
+
* Rubocop 1.22.1 に対応しました ([#1759])
|
29
|
+
|
30
|
+
## コントリビューターのみなさん
|
31
|
+
* [@munepi](https://github.com/munepi)
|
32
|
+
* [@huideyeren](https://github.com/huideyeren)
|
33
|
+
|
34
|
+
[#1718]: https://github.com/kmuto/review/issues/1718
|
35
|
+
[#1720]: https://github.com/kmuto/review/issues/1720
|
36
|
+
[#1724]: https://github.com/kmuto/review/issues/1724
|
37
|
+
[#1725]: https://github.com/kmuto/review/issues/1725
|
38
|
+
[#1726]: https://github.com/kmuto/review/issues/1726
|
39
|
+
[#1729]: https://github.com/kmuto/review/pull/1729
|
40
|
+
[#1730]: https://github.com/kmuto/review/pull/1730
|
41
|
+
[#1733]: https://github.com/kmuto/review/issues/1733
|
42
|
+
[#1734]: https://github.com/kmuto/review/issues/1734
|
43
|
+
[#1740]: https://github.com/kmuto/review/pull/1740
|
44
|
+
[#1742]: https://github.com/kmuto/review/pull/1742
|
45
|
+
[#1743]: https://github.com/kmuto/review/pull/1743
|
46
|
+
[#1744]: https://github.com/kmuto/review/issues/1744
|
47
|
+
[#1747]: https://github.com/kmuto/review/pull/1747
|
48
|
+
[#1748]: https://github.com/kmuto/review/pull/1748
|
49
|
+
[#1753]: https://github.com/kmuto/review/issues/1753
|
50
|
+
[#1755]: https://github.com/kmuto/review/issues/1755
|
51
|
+
[#1759]: https://github.com/kmuto/review/pull/1759
|
52
|
+
[#1760]: https://github.com/kmuto/review/pull/1760
|
53
|
+
|
1
54
|
# Version 5.2.0
|
2
55
|
## 新機能
|
3
56
|
* EPUBMaker: CSS 組版向けに、見出しの存在に応じて `<section>` で階層化する機能を追加しました。config.yml で `epubmaker` セクションの `use_section` パラメータを `true` にすると有効化されます ([#1685])
|
data/NEWS.md
CHANGED
@@ -1,3 +1,56 @@
|
|
1
|
+
# Version 5.3.0
|
2
|
+
## New Features
|
3
|
+
* add the future of endnote. `//endnote` specifies the content of the endnote, `@<endnote>` specifies the reference to the endnote, and `//printendnotes` places endnotes ([#1724])
|
4
|
+
|
5
|
+
## Bug Fixes
|
6
|
+
* fixed an error in new jlreq that caused it to become independent of ifthen package ([#1718])
|
7
|
+
* fixed an issue with hidden folio being set to all 1 when using review-jsbook with TeXLive 2020 or later ([#1720])
|
8
|
+
* fixed an error that occurred when a non-existent file was specified in the coverimage parameter ([#1726], [#1729])
|
9
|
+
* it now warns when a non-existent file is specified in the titlefile, creditfile, and profile parameters ([#1730])
|
10
|
+
* fixed `@<tcy>` op error in review-jlreq. this op will be expanded into `\reviewtcy` macro ([#1733])
|
11
|
+
* fixed exception errors in review-vol and review-index ([#1740])
|
12
|
+
* fixed forgetting to copy `__IMGMATH_BODY__.tex` when math compiling error occurs ([#1747])
|
13
|
+
* fixed the problem that the position of `//beginchild` and `//endchild` is not displayed when an error occurs ([#1742])
|
14
|
+
* fixed a build error when using `//graph` op ([#1744])
|
15
|
+
* fixed undefined variable in epubmaker.rb ([#1755])
|
16
|
+
* fixed execution error in review-catalog-converter ([#1753])
|
17
|
+
|
18
|
+
## Enhancements
|
19
|
+
* warnings are now given when footnotes (`//footnote`) and endnotes (`//endnote`) are defined but not referenced (`@<fn>`, `@<endnote>`) ([#1725])
|
20
|
+
* `\includefullpagegraphics` macro that pastes an image over the entire page now supports vertical writing ([#1734])
|
21
|
+
* try to find plantuml.jar from the working folder, `/usr/share/plantuml`, or `/usr/share/java` ([#1760])
|
22
|
+
|
23
|
+
## Docs
|
24
|
+
* format.ja.md, format.md: fixed a mistake in the command line for creating SVG formulas ([#1748])
|
25
|
+
|
26
|
+
## Others
|
27
|
+
* added tests for Ruby 2.7 for Windows ([#1743])
|
28
|
+
* refactor code with Rubocop 1.22.1 ([#1759])
|
29
|
+
|
30
|
+
## Contributors
|
31
|
+
* [@munepi](https://github.com/munepi)
|
32
|
+
* [@huideyeren](https://github.com/huideyeren)
|
33
|
+
|
34
|
+
[#1718]: https://github.com/kmuto/review/issues/1718
|
35
|
+
[#1720]: https://github.com/kmuto/review/issues/1720
|
36
|
+
[#1724]: https://github.com/kmuto/review/issues/1724
|
37
|
+
[#1725]: https://github.com/kmuto/review/issues/1725
|
38
|
+
[#1726]: https://github.com/kmuto/review/issues/1726
|
39
|
+
[#1729]: https://github.com/kmuto/review/pull/1729
|
40
|
+
[#1730]: https://github.com/kmuto/review/pull/1730
|
41
|
+
[#1733]: https://github.com/kmuto/review/issues/1733
|
42
|
+
[#1734]: https://github.com/kmuto/review/issues/1734
|
43
|
+
[#1740]: https://github.com/kmuto/review/pull/1740
|
44
|
+
[#1742]: https://github.com/kmuto/review/pull/1742
|
45
|
+
[#1743]: https://github.com/kmuto/review/pull/1743
|
46
|
+
[#1744]: https://github.com/kmuto/review/issues/1744
|
47
|
+
[#1747]: https://github.com/kmuto/review/pull/1747
|
48
|
+
[#1748]: https://github.com/kmuto/review/pull/1748
|
49
|
+
[#1753]: https://github.com/kmuto/review/issues/1753
|
50
|
+
[#1755]: https://github.com/kmuto/review/issues/1755
|
51
|
+
[#1759]: https://github.com/kmuto/review/pull/1759
|
52
|
+
[#1760]: https://github.com/kmuto/review/pull/1760
|
53
|
+
|
1
54
|
# Version 5.2.0
|
2
55
|
## New Features
|
3
56
|
* EPUBMaker: added `<section>` based on heading level for CSS formatting, when the `epubmaker/use_section` parameter is set to `true` ([#1685])
|
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.3 に基づいています。
|
6
6
|
|
7
7
|
## 段落
|
8
8
|
|
@@ -396,7 +396,7 @@ plot sin(x)
|
|
396
396
|
* Gnuplot ( http://www.gnuplot.info/ ) : `gnuplot` コマンドへのパスを OS に設定すること
|
397
397
|
* Blockdiag ( http://blockdiag.com/ ) : `blockdiag` コマンドへのパスを OS に設定すること。PDF を生成する場合は ReportLab もインストールすること
|
398
398
|
* aafigure ( https://launchpad.net/aafigure ) : `aafigure` コマンドへのパスを OS に設定すること
|
399
|
-
* PlantUML ( http://plantuml.com/ ) : `java` コマンドへのパスを OS に設定し、`plantuml.jar`
|
399
|
+
* PlantUML ( http://plantuml.com/ ) : `java` コマンドへのパスを OS に設定し、`plantuml.jar` が作業フォルダ、または `/usr/share/plantuml` あるいは `/usr/share/java` フォルダにあること
|
400
400
|
|
401
401
|
## 表
|
402
402
|
|
@@ -524,6 +524,7 @@ Re:VIEW 5.0 以降では、囲み記事に箇条書きや図表・リストを
|
|
524
524
|
```
|
525
525
|
パッケージは本書のサポートサイトから入手できます@<fn>{site}。
|
526
526
|
各自ダウンロードしてインストールしておいてください。
|
527
|
+
|
527
528
|
//footnote[site][本書のサポートサイト: http://i.loveruby.net/ja/stdcompiler ]
|
528
529
|
```
|
529
530
|
|
@@ -538,6 +539,31 @@ TeX PDF において、コラム以外の `//note` などの囲み記事の中
|
|
538
539
|
|
539
540
|
ただし、通常の脚注(footnote)ではなく、footnotemark と footnotetext を使うため、本文と脚注が別ページに分かれる可能性があるなど、いろいろな制約があります。また、採番が別々になるため、footnote と footnotemark/footnotetext を両立させることはできません。
|
540
541
|
|
542
|
+
## 後注
|
543
|
+
|
544
|
+
後注(最後にまとめて出力される注釈)は、「`//endnote`」を使って記述します。
|
545
|
+
|
546
|
+
```
|
547
|
+
パッケージは本書のサポートサイトから入手できます@<endnote>{site}。
|
548
|
+
各自ダウンロードしてインストールしておいてください。
|
549
|
+
|
550
|
+
//endnote[site][本書のサポートサイト: http://i.loveruby.net/ja/stdcompiler ]
|
551
|
+
```
|
552
|
+
|
553
|
+
本文中のインライン命令「`@<endnote>{site}`」は後注番号に置換され、「本書のサポートサイト……」という文は後注として内部に保存されます。
|
554
|
+
|
555
|
+
保存されている後注を書き出すには、書き出したい箇所(通常は章の末尾)に「`//printendnotes`」を置きます。
|
556
|
+
|
557
|
+
```
|
558
|
+
…
|
559
|
+
|
560
|
+
==== 注釈
|
561
|
+
|
562
|
+
//printendnotes
|
563
|
+
```
|
564
|
+
|
565
|
+
後注の管理は章 (re ファイル) 単位であり、複数の章にまたがった後注を作ることはできません。
|
566
|
+
|
541
567
|
## 参考文献の定義
|
542
568
|
|
543
569
|
参考文献は同一ディレクトリ内の `bib.re` ファイルに定義します。
|
@@ -686,7 +712,7 @@ imgmath_options:
|
|
686
712
|
math_format: imgmath
|
687
713
|
imgmath_options:
|
688
714
|
format: svg
|
689
|
-
pdfcrop_pixelize_cmd: "pdftocairo
|
715
|
+
pdfcrop_pixelize_cmd: "pdftocairo -%t -r 90 -f %p -l %p %i %o"
|
690
716
|
```
|
691
717
|
|
692
718
|
デフォルトでは、pdfcrop_pixelize_cmd に指定するコマンドは、1ページあたり1数式からなる複数ページの PDF のファイル名を `%i` プレースホルダで受け取り、`%p` プレースホルダのページ数に基づいて `%o`(拡張子あり)または `%O`(拡張子なし)の画像ファイルに書き出す、という仕組みになっています。
|
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.3.
|
8
8
|
|
9
9
|
## Paragraph
|
10
10
|
|
@@ -423,7 +423,7 @@ Before using these tools, you should installed them and configured path appropri
|
|
423
423
|
* Gnuplot ( http://www.gnuplot.info/ ) : set path to `gnuplot` command
|
424
424
|
* Blockdiag ( http://blockdiag.com/ ) : set path to `blockdiag` command. Install ReportLab also to make a PDF
|
425
425
|
* aafigure ( https://launchpad.net/aafigure ) : set path to `aafigure` command
|
426
|
-
* PlantUML ( http://plantuml.com/ ) : set path to `java` command. place `plantuml.jar` on working folder
|
426
|
+
* PlantUML ( http://plantuml.com/ ) : set path to `java` command. place `plantuml.jar` on working folder, `/usr/share/plantuml` or `/usr/share/java`.
|
427
427
|
|
428
428
|
## Tables
|
429
429
|
|
@@ -551,6 +551,7 @@ Usage:
|
|
551
551
|
```
|
552
552
|
You can get the packages from support site for the book.@<fn>{site}
|
553
553
|
You should get and install it before reading the book.
|
554
|
+
|
554
555
|
//footnote[site][support site of the book: http://i.loveruby.net/ja/stdcompiler ]
|
555
556
|
```
|
556
557
|
|
@@ -572,6 +573,34 @@ Note that with this option, Re:VIEW use footnotemark and footnotetext instead of
|
|
572
573
|
There are some constraints to use this option.
|
573
574
|
You cannot use footnote and footnotemark/footnotetext at the same time.
|
574
575
|
|
576
|
+
## Endnotes
|
577
|
+
|
578
|
+
You can use `//endnote` to write endnotes.
|
579
|
+
|
580
|
+
Usage:
|
581
|
+
|
582
|
+
```
|
583
|
+
You can get the packages from support site for the book.@<endnote>{site}
|
584
|
+
You should get and install it before reading the book.
|
585
|
+
|
586
|
+
//endnote[site][support site of the book: http://i.loveruby.net/ja/stdcompiler ]
|
587
|
+
```
|
588
|
+
|
589
|
+
`@<endnote>{site}` in source are replaced by endnote marks, and the phrase "support site of .."
|
590
|
+
is stored for printing later.
|
591
|
+
|
592
|
+
To print stored endnotes, place "`//printendnotes`" where you want to write down them (usually at the end of the chapter).
|
593
|
+
|
594
|
+
```
|
595
|
+
...
|
596
|
+
|
597
|
+
==== Endnote
|
598
|
+
|
599
|
+
//printendnotes
|
600
|
+
```
|
601
|
+
|
602
|
+
It is not possible to create an endnote that spans multiple chapters.
|
603
|
+
|
575
604
|
## Bibliography
|
576
605
|
|
577
606
|
When you want to use a bibliography, you should write them in the file `bib.re`.
|
@@ -719,7 +748,7 @@ For example, to make SVG:
|
|
719
748
|
math_format: imgmath
|
720
749
|
imgmath_options:
|
721
750
|
format: svg
|
722
|
-
pdfcrop_pixelize_cmd: "pdftocairo
|
751
|
+
pdfcrop_pixelize_cmd: "pdftocairo -%t -r 90 -f %p -l %p %i %o"
|
723
752
|
```
|
724
753
|
|
725
754
|
By default, the command specified in `pdfcrop_pixelize_cmd` takes the filename of multi-page PDF consisting of one formula per page.
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c) 2009-
|
1
|
+
# Copyright (c) 2009-2021 Minero Aoki, Kenshi Muto
|
2
2
|
# 2002-2008 Minero Aoki
|
3
3
|
#
|
4
4
|
# This program is free software.
|
@@ -18,7 +18,8 @@ module ReVIEW
|
|
18
18
|
attr_reader :lines
|
19
19
|
attr_accessor :content
|
20
20
|
|
21
|
-
attr_reader :list_index, :table_index, :equation_index,
|
21
|
+
attr_reader :list_index, :table_index, :equation_index,
|
22
|
+
:footnote_index, :endnote_index,
|
22
23
|
:numberless_image_index, :image_index, :icon_index, :indepimage_index,
|
23
24
|
:headline_index, :column_index
|
24
25
|
|
@@ -56,6 +57,7 @@ module ReVIEW
|
|
56
57
|
@table_index = @indexes.table_index
|
57
58
|
@equation_index = @indexes.equation_index
|
58
59
|
@footnote_index = @indexes.footnote_index
|
60
|
+
@endnote_index = @indexes.endnote_index
|
59
61
|
@headline_index = @indexes.headline_index
|
60
62
|
@column_index = @indexes.column_index
|
61
63
|
if use_bib
|
@@ -116,6 +118,14 @@ module ReVIEW
|
|
116
118
|
footnote_index[id]
|
117
119
|
end
|
118
120
|
|
121
|
+
def endnote(id)
|
122
|
+
endnote_index[id]
|
123
|
+
end
|
124
|
+
|
125
|
+
def endnotes
|
126
|
+
endnote_index
|
127
|
+
end
|
128
|
+
|
119
129
|
def image(id)
|
120
130
|
return image_index[id] if image_index.key?(id)
|
121
131
|
return icon_index[id] if icon_index.key?(id)
|
data/lib/review/book/index.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c) 2008-
|
1
|
+
# Copyright (c) 2008-2021 Minero Aoki, Kenshi Muto
|
2
2
|
# 2002-2007 Minero Aoki
|
3
3
|
#
|
4
4
|
# This program is free software.
|
@@ -125,6 +125,9 @@ module ReVIEW
|
|
125
125
|
class FootnoteIndex < Index
|
126
126
|
end
|
127
127
|
|
128
|
+
class EndnoteIndex < Index
|
129
|
+
end
|
130
|
+
|
128
131
|
class ImageIndex < Index
|
129
132
|
def self.item_type
|
130
133
|
'(image|graph|imgtable)'
|
data/lib/review/builder.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c) 2002-
|
1
|
+
# Copyright (c) 2002-2021 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
|
@@ -42,6 +42,7 @@ module ReVIEW
|
|
42
42
|
@doc_status = {}
|
43
43
|
@dictionary = {}
|
44
44
|
@img_math = img_math
|
45
|
+
@shown_endnotes = true
|
45
46
|
end
|
46
47
|
|
47
48
|
def bind(compiler, chapter, location)
|
@@ -103,11 +104,18 @@ module ReVIEW
|
|
103
104
|
|
104
105
|
def check_nest
|
105
106
|
if @children && !@children.empty?
|
106
|
-
app_error "//beginchild of #{@children.reverse.join(',')} misses //endchild"
|
107
|
+
app_error "#{@location}: //beginchild of #{@children.reverse.join(',')} misses //endchild"
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
def check_printendnotes
|
112
|
+
if @shown_endnotes.nil?
|
113
|
+
app_error "#{@location}: //endnote is found but //printendnotes is not found."
|
107
114
|
end
|
108
115
|
end
|
109
116
|
|
110
117
|
def result
|
118
|
+
check_printendnotes
|
111
119
|
solve_nest(@output.string)
|
112
120
|
end
|
113
121
|
|
@@ -273,17 +281,28 @@ module ReVIEW
|
|
273
281
|
table(lines, nil, caption)
|
274
282
|
end
|
275
283
|
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
284
|
+
def printendnotes
|
285
|
+
@shown_endnotes = true
|
286
|
+
endnote_begin
|
287
|
+
@chapter.endnotes.each do |en|
|
288
|
+
endnote_item(en.id)
|
289
|
+
end
|
290
|
+
endnote_end
|
291
|
+
end
|
292
|
+
|
293
|
+
def endnote(_id, _str)
|
294
|
+
@shown_endnotes = nil
|
295
|
+
end
|
296
|
+
|
297
|
+
def endnote_begin
|
298
|
+
end
|
299
|
+
|
300
|
+
def endnote_end
|
301
|
+
end
|
302
|
+
|
303
|
+
def endnote_item(id)
|
304
|
+
puts "(#{@chapter.endnote(id).number}) #{compile_inline(@chapter.endnote(id).content)}"
|
305
|
+
end
|
287
306
|
|
288
307
|
def blankline
|
289
308
|
puts ''
|
@@ -371,6 +390,12 @@ module ReVIEW
|
|
371
390
|
app_error "unknown footnote: #{id}"
|
372
391
|
end
|
373
392
|
|
393
|
+
def inline_endnote(id)
|
394
|
+
"(#{@chapter.endnote(id).number})"
|
395
|
+
rescue KeyError
|
396
|
+
app_error "unknown endnote: #{id}"
|
397
|
+
end
|
398
|
+
|
374
399
|
def inline_bou(str)
|
375
400
|
text(str)
|
376
401
|
end
|
@@ -644,7 +669,17 @@ EOTGNUPLOT
|
|
644
669
|
ext = 'eps'
|
645
670
|
file_path.sub!(/\.pdf\Z/, '.eps')
|
646
671
|
end
|
647
|
-
|
672
|
+
plant_path = nil
|
673
|
+
if File.exist?('plantuml.jar')
|
674
|
+
plant_path = 'plantuml.jar'
|
675
|
+
elsif File.exist?('/usr/share/plantuml/plantuml.jar')
|
676
|
+
plant_path = '/usr/share/plantuml/plantuml.jar'
|
677
|
+
elsif File.exist?('/usr/share/java/plantuml.jar')
|
678
|
+
plant_path = '/usr/share/java/plantuml.jar'
|
679
|
+
else
|
680
|
+
error!('missing plantuml.jar. Please put plantuml.jar at the working folder.')
|
681
|
+
end
|
682
|
+
system_graph(id, 'java', '-jar', plant_path, "-t#{ext}", '-charset', 'UTF-8', tf_path)
|
648
683
|
FileUtils.mv("#{tf_path}.#{ext}", file_path)
|
649
684
|
file_path
|
650
685
|
end
|
@@ -729,7 +764,7 @@ EOTGNUPLOT
|
|
729
764
|
def beginchild
|
730
765
|
@children ||= []
|
731
766
|
unless previous_list_type
|
732
|
-
app_error "//beginchild is shown, but previous element isn't ul, ol, or dl"
|
767
|
+
app_error "#{@location}: //beginchild is shown, but previous element isn't ul, ol, or dl"
|
733
768
|
end
|
734
769
|
puts "\x01→#{previous_list_type}←\x01"
|
735
770
|
@children.push(previous_list_type)
|
@@ -737,7 +772,7 @@ EOTGNUPLOT
|
|
737
772
|
|
738
773
|
def endchild
|
739
774
|
if @children.nil? || @children.empty?
|
740
|
-
app_error "//endchild is shown, but any opened //beginchild doesn't exist"
|
775
|
+
app_error "#{@location}: //endchild is shown, but any opened //beginchild doesn't exist"
|
741
776
|
else
|
742
777
|
puts "\x01→/#{@children.pop}←\x01"
|
743
778
|
end
|
data/lib/review/catalog.rb
CHANGED
data/lib/review/compiler.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c) 2009-
|
1
|
+
# Copyright (c) 2009-2021 Minero Aoki, Kenshi Muto
|
2
2
|
# Copyright (c) 2002-2007 Minero Aoki
|
3
3
|
#
|
4
4
|
# This program is free software.
|
@@ -196,6 +196,8 @@ module ReVIEW
|
|
196
196
|
defminicolumn :notice, 0..1
|
197
197
|
|
198
198
|
defsingle :footnote, 2
|
199
|
+
defsingle :endnote, 2
|
200
|
+
defsingle :printendnotes, 0
|
199
201
|
defsingle :noindent, 0
|
200
202
|
defsingle :blankline, 0
|
201
203
|
defsingle :pagebreak, 0
|
@@ -220,6 +222,7 @@ module ReVIEW
|
|
220
222
|
definline :table
|
221
223
|
definline :eq
|
222
224
|
definline :fn
|
225
|
+
definline :endnote
|
223
226
|
definline :kw
|
224
227
|
definline :ruby
|
225
228
|
definline :bou
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# = epubcommon.rb -- super class for EPUBv2 and EPUBv3
|
2
2
|
#
|
3
|
-
# Copyright (c) 2010-
|
3
|
+
# Copyright (c) 2010-2021 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
|
@@ -70,7 +70,7 @@ module ReVIEW
|
|
70
70
|
item = contents.find { |content| content.coverimage?(config['coverimage']) }
|
71
71
|
|
72
72
|
unless item
|
73
|
-
raise "coverimage #{config['coverimage']} not found. Abort."
|
73
|
+
raise ApplicationError, "coverimage #{config['coverimage']} not found. Abort."
|
74
74
|
end
|
75
75
|
|
76
76
|
%Q( <meta name="cover" content="#{item.id}"/>\n)
|
@@ -107,7 +107,7 @@ module ReVIEW
|
|
107
107
|
|
108
108
|
if config['coverimage']
|
109
109
|
@coverimage_src = coverimage
|
110
|
-
raise "coverimage #{config['coverimage']} not found. Abort." unless @coverimage_src
|
110
|
+
raise ApplicationError, "coverimage #{config['coverimage']} not found. Abort." unless @coverimage_src
|
111
111
|
end
|
112
112
|
@body = ReVIEW::Template.generate(path: './html/_cover.html.erb', binding: binding)
|
113
113
|
|
@@ -338,7 +338,7 @@ module ReVIEW
|
|
338
338
|
|
339
339
|
fname = "#{basedir}/#{item.file}"
|
340
340
|
unless File.exist?(fname)
|
341
|
-
raise "#{fname} is not found."
|
341
|
+
raise ApplicationError, "#{fname} is not found."
|
342
342
|
end
|
343
343
|
|
344
344
|
FileUtils.mkdir_p(File.dirname("#{tmpdir}/OEBPS/#{item.file}"))
|
data/lib/review/epubmaker.rb
CHANGED
@@ -118,7 +118,9 @@ module ReVIEW
|
|
118
118
|
booktmpname = "#{bookname}-epub"
|
119
119
|
|
120
120
|
@img_math = ReVIEW::ImgMath.new(@config)
|
121
|
-
|
121
|
+
begin
|
122
|
+
@config.check_version(ReVIEW::VERSION, exception: true)
|
123
|
+
rescue ReVIEW::ConfigError => e
|
122
124
|
warn e.message
|
123
125
|
end
|
124
126
|
debug("#{bookname}.epub will be created.")
|
data/lib/review/htmlbuilder.rb
CHANGED
@@ -111,6 +111,8 @@ module ReVIEW
|
|
111
111
|
end
|
112
112
|
|
113
113
|
def result
|
114
|
+
check_printendnotes
|
115
|
+
|
114
116
|
# flush all `</section>`
|
115
117
|
if use_section?
|
116
118
|
print close_sections
|
@@ -825,6 +827,22 @@ module ReVIEW
|
|
825
827
|
end
|
826
828
|
end
|
827
829
|
|
830
|
+
def endnote_begin
|
831
|
+
puts %Q(<div class="endnotes">)
|
832
|
+
end
|
833
|
+
|
834
|
+
def endnote_end
|
835
|
+
puts %Q(</div>)
|
836
|
+
end
|
837
|
+
|
838
|
+
def endnote_item(id)
|
839
|
+
back = ''
|
840
|
+
if @book.config['epubmaker'] && @book.config['epubmaker']['back_footnote']
|
841
|
+
back = %Q(<a href="#endnoteb-#{normalize_id(id)}">#{I18n.t('html_footnote_backmark')}</a>)
|
842
|
+
end
|
843
|
+
puts %Q(<div class="endnote" id="endnote-#{normalize_id(id)}"><p class="endnote">#{back}#{I18n.t('html_endnote_textmark', @chapter.endnote(id).number)}#{compile_inline(@chapter.endnote(id).content)}</p></div>)
|
844
|
+
end
|
845
|
+
|
828
846
|
def indepimage(lines, id, caption = '', metric = nil)
|
829
847
|
metrics = parse_metric('html', metric)
|
830
848
|
caption = '' unless caption.present?
|
@@ -942,6 +960,12 @@ EOS
|
|
942
960
|
app_error "unknown footnote: #{id}"
|
943
961
|
end
|
944
962
|
|
963
|
+
def inline_endnote(id)
|
964
|
+
%Q(<a id="endnoteb-#{normalize_id(id)}" href="#endnote-#{normalize_id(id)}" class="noteref" epub:type="noteref">#{I18n.t('html_endnote_refmark', @chapter.endnote(id).number)}</a>)
|
965
|
+
rescue KeyError
|
966
|
+
app_error "unknown endnote: #{id}"
|
967
|
+
end
|
968
|
+
|
945
969
|
def compile_ruby(base, ruby)
|
946
970
|
if @book.htmlversion == 5
|
947
971
|
%Q(<ruby>#{escape(base)}<rp>#{I18n.t('ruby_prefix')}</rp><rt>#{escape(ruby)}</rt><rp>#{I18n.t('ruby_postfix')}</rp></ruby>)
|
data/lib/review/i18n.yml
CHANGED
@@ -32,6 +32,8 @@ ja:
|
|
32
32
|
html_footnote_refmark: "*%s"
|
33
33
|
html_footnote_textmark: "[*%s] "
|
34
34
|
html_footnote_backmark: "⏎"
|
35
|
+
html_endnote_refmark: "(%s)"
|
36
|
+
html_endnote_textmark: "(%s) "
|
35
37
|
aut: "著 者"
|
36
38
|
csl: "監 修"
|
37
39
|
dsr: "デザイン"
|
@@ -120,6 +122,8 @@ en:
|
|
120
122
|
html_footnote_refmark: "*%s"
|
121
123
|
html_footnote_textmark: "[*%s] "
|
122
124
|
html_footnote_backmark: "⏎"
|
125
|
+
html_endnote_refmark: "(%s)"
|
126
|
+
html_endnote_textmark: "(%s) "
|
123
127
|
aut: "Author"
|
124
128
|
csl: "Consultant"
|
125
129
|
dsr: "Design"
|
@@ -188,6 +192,8 @@ zh-TW:
|
|
188
192
|
html_footnote_refmark: "*%s"
|
189
193
|
html_footnote_textmark: "[*%s] "
|
190
194
|
html_footnote_backmark: "⏎"
|
195
|
+
html_endnote_refmark: "(%s)"
|
196
|
+
html_endnote_textmark: "(%s) "
|
191
197
|
aut: "著作人"
|
192
198
|
csl: "監 修"
|
193
199
|
dsr: "美術編輯"
|
data/lib/review/idgxmlbuilder.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c) 2008-
|
1
|
+
# Copyright (c) 2008-2021 Minero Aoki, Kenshi Muto
|
2
2
|
# 2002-2007 Minero Aoki
|
3
3
|
#
|
4
4
|
# This program is free software.
|
@@ -78,6 +78,8 @@ module ReVIEW
|
|
78
78
|
end
|
79
79
|
|
80
80
|
def result
|
81
|
+
check_printendnotes
|
82
|
+
|
81
83
|
s = ''
|
82
84
|
if @secttags
|
83
85
|
s += '</sect4>' if @subsubsubsection > 0
|
@@ -660,6 +662,24 @@ module ReVIEW
|
|
660
662
|
app_error "unknown footnote: #{id}"
|
661
663
|
end
|
662
664
|
|
665
|
+
def inline_endnote(id)
|
666
|
+
%Q(<span type='endnoteref' idref='endnoteb-#{normalize_id(id)}'>(#{@chapter.endnote(id).number})</span>)
|
667
|
+
rescue KeyError
|
668
|
+
app_error "unknown endnote: #{id}"
|
669
|
+
end
|
670
|
+
|
671
|
+
def endnote_begin
|
672
|
+
puts '<endnotes>'
|
673
|
+
end
|
674
|
+
|
675
|
+
def endnote_end
|
676
|
+
puts '</endnotes>'
|
677
|
+
end
|
678
|
+
|
679
|
+
def endnote_item(id)
|
680
|
+
puts %Q(<endnote id='endnoteb-#{normalize_id(id)}'><span type='endnotenumber'>(#{@chapter.endnote(id).number})</span>\t#{compile_inline(@chapter.endnote(id).content)}</endnote>)
|
681
|
+
end
|
682
|
+
|
663
683
|
def compile_ruby(base, ruby)
|
664
684
|
%Q(<GroupRuby><aid:ruby xmlns:aid="http://ns.adobe.com/AdobeInDesign/3.0/"><aid:rb>#{escape(base.strip)}</aid:rb><aid:rt>#{escape(ruby.strip)}</aid:rt></aid:ruby></GroupRuby>)
|
665
685
|
end
|
data/lib/review/img_math.rb
CHANGED
@@ -104,6 +104,7 @@ module ReVIEW
|
|
104
104
|
end
|
105
105
|
rescue CompileError
|
106
106
|
FileUtils.cp([tex_path,
|
107
|
+
File.join(File.dirname(tex_path), '__IMGMATH_BODY__.tex'),
|
107
108
|
File.join(File.dirname(tex_path), '__IMGMATH__.log')],
|
108
109
|
math_real_dir)
|
109
110
|
error! "LaTeX math compile error. See #{math_real_dir}/__IMGMATH__.log for details."
|