review 3.2.0 → 4.0.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.
Files changed (105) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +26 -4
  3. data/.travis.yml +1 -1
  4. data/NEWS.ja.md +97 -1
  5. data/NEWS.md +97 -1
  6. data/bin/review-catalog-converter +1 -1
  7. data/bin/review-check +5 -5
  8. data/bin/review-checkdep +1 -1
  9. data/bin/review-compile +5 -5
  10. data/bin/review-idgxmlmaker +16 -0
  11. data/bin/review-index +7 -7
  12. data/bin/review-preproc +9 -9
  13. data/bin/review-validate +2 -2
  14. data/bin/review-vol +5 -5
  15. data/doc/config.yml.sample +14 -6
  16. data/doc/config.yml.sample-simple +1 -1
  17. data/doc/format.ja.md +15 -5
  18. data/doc/format.md +30 -18
  19. data/doc/pdfmaker.ja.md +1 -1
  20. data/doc/pdfmaker.md +1 -1
  21. data/lib/review/book.rb +1 -1
  22. data/lib/review/book/base.rb +23 -63
  23. data/lib/review/book/chapter.rb +18 -3
  24. data/lib/review/book/compilable.rb +5 -0
  25. data/lib/review/book/index.rb +26 -65
  26. data/lib/review/book/index/item.rb +40 -0
  27. data/lib/review/book/part.rb +22 -2
  28. data/lib/review/builder.rb +60 -40
  29. data/lib/review/catalog.rb +12 -15
  30. data/lib/review/compiler.rb +68 -36
  31. data/lib/review/configure.rb +10 -7
  32. data/lib/review/epubmaker.rb +5 -2
  33. data/lib/review/htmlbuilder.rb +24 -71
  34. data/lib/review/htmlutils.rb +2 -3
  35. data/lib/review/i18n.rb +2 -2
  36. data/lib/review/idgxmlbuilder.rb +101 -55
  37. data/lib/review/idgxmlmaker.rb +184 -0
  38. data/lib/review/init-web/finish.html +10 -0
  39. data/lib/review/init-web/index.html +190 -0
  40. data/lib/review/init-web/review-layout-design.js +691 -0
  41. data/lib/review/init.rb +110 -26
  42. data/lib/review/latexbuilder.rb +76 -54
  43. data/lib/review/lineinput.rb +1 -1
  44. data/lib/review/logger.rb +4 -8
  45. data/lib/review/makerhelper.rb +6 -4
  46. data/lib/review/markdownbuilder.rb +25 -38
  47. data/lib/review/md2inaobuilder.rb +3 -5
  48. data/lib/review/pdfmaker.rb +15 -15
  49. data/lib/review/plaintextbuilder.rb +67 -76
  50. data/lib/review/preprocessor.rb +13 -13
  51. data/lib/review/rstbuilder.rb +31 -31
  52. data/lib/review/textmaker.rb +13 -3
  53. data/lib/review/textutils.rb +77 -2
  54. data/lib/review/tocparser.rb +17 -17
  55. data/lib/review/tocprinter.rb +8 -8
  56. data/lib/review/topbuilder.rb +76 -57
  57. data/lib/review/update.rb +16 -16
  58. data/lib/review/version.rb +1 -1
  59. data/lib/review/webmaker.rb +2 -2
  60. data/lib/review/yamlloader.rb +3 -0
  61. data/review.gemspec +4 -3
  62. data/samples/sample-book/README.md +7 -2
  63. data/samples/sample-book/src/.gitignore +153 -0
  64. data/samples/sample-book/src/config-jlreq.yml +6 -0
  65. data/samples/sample-book/src/lib/tasks/review.rake +20 -9
  66. data/samples/sample-book/src/lib/tasks/z01_copy_sty.rake +14 -8
  67. data/samples/syntax-book/ch03.re +3 -6
  68. data/samples/syntax-book/config-jlreq.yml +5 -0
  69. data/samples/syntax-book/lib/tasks/review.rake +7 -7
  70. data/samples/syntax-book/lib/tasks/z01_copy_sty.rake +14 -8
  71. data/templates/latex/config.erb +6 -0
  72. data/templates/latex/layout.tex.erb +1 -0
  73. data/templates/latex/review-jlreq/review-base.sty +93 -31
  74. data/templates/latex/review-jlreq/review-jlreq.cls +6 -0
  75. data/templates/latex/review-jlreq/review-style.sty +3 -0
  76. data/templates/latex/review-jsbook/README.md +39 -0
  77. data/templates/latex/review-jsbook/review-base.sty +65 -10
  78. data/templates/latex/review-jsbook/review-jsbook.cls +4 -0
  79. data/templates/latex/review-jsbook/review-style.sty +4 -1
  80. data/test/assets/test_template.tex +11 -3
  81. data/test/assets/test_template_backmatter.tex +11 -3
  82. data/test/test_book.rb +65 -19
  83. data/test/test_catalog.rb +18 -42
  84. data/test/test_catalog_converter_cmd.rb +1 -1
  85. data/test/test_epubmaker_cmd.rb +2 -2
  86. data/test/test_helper.rb +1 -1
  87. data/test/test_htmlbuilder.rb +144 -55
  88. data/test/test_i18n.rb +25 -25
  89. data/test/test_idgxmlbuilder.rb +60 -18
  90. data/test/test_image_finder.rb +6 -6
  91. data/test/test_latexbuilder.rb +128 -24
  92. data/test/test_latexbuilder_v2.rb +23 -23
  93. data/test/test_logger.rb +14 -1
  94. data/test/test_makerhelper.rb +3 -3
  95. data/test/test_markdownbuilder.rb +45 -4
  96. data/test/test_md2inaobuilder.rb +12 -2
  97. data/test/test_pdfmaker.rb +1 -1
  98. data/test/test_pdfmaker_cmd.rb +1 -1
  99. data/test/test_plaintextbuilder.rb +31 -6
  100. data/test/test_rstbuilder.rb +33 -4
  101. data/test/test_textutils.rb +109 -2
  102. data/test/test_topbuilder.rb +35 -7
  103. data/test/test_update.rb +17 -8
  104. data/test/test_yamlloader.rb +13 -0
  105. metadata +26 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fd7268a71d883dbd67373a3a6c3d4d151b67cb01e6545bf83fc1b26ce9eaee02
4
- data.tar.gz: 3214804b54cba60f961ceda0ee83f8f2d50080ba3bbd691cca179057bd8dc3ac
3
+ metadata.gz: 89a4cecb9a961ec87c1238e52ceadaf474caeeef156ff3d22f2d856ed0959511
4
+ data.tar.gz: 869b3b59d13a0fa2fc8b5812f0c52ae63f3e1faaad59c3ce0d0230d7baacefc4
5
5
  SHA512:
6
- metadata.gz: bc7ccb389d4c6d836adf683f53961646e126149a63c29cda14ecbc4b95b44745a856169326ab98e84d5189b8fca4bb08dbf7292089990231a1c22063ccf58557
7
- data.tar.gz: 49790ebe6d85e685b1e9fbc0f1bc635a050ca844c8dd34369e79dee8972884c5bb1f2f9cce194ce7c7947d303503b4ba549741ab1f8069a924309b6696934701
6
+ metadata.gz: 45a497fd65af6dce68031d1ebf4fd04e961462e667c37b1e81082dae503c7d562aa165664c67794731a6997c439066161be3344b58811b6e04ec482b7a07c0ec
7
+ data.tar.gz: 8944e5336301dc89c65de91656b7084a322b50fdf699ca3e82748206a0c0a5b49a0199e095e25be8258145ec3bde1564de5e7273e31e4272cfc12641f1d0b163
@@ -193,6 +193,31 @@ Style/LineEndConcatenation:
193
193
  Style/MethodCallWithoutArgsParentheses:
194
194
  Enabled: true
195
195
 
196
+ Style/MethodCallWithArgsParentheses:
197
+ IgnoredMethods:
198
+ - 'require'
199
+ - 'include'
200
+ - 'file'
201
+ - 'task'
202
+ - 'desc'
203
+ - 'info'
204
+ - 'gem'
205
+ - 'exit'
206
+ - 'print'
207
+ - 'puts'
208
+ - 'write'
209
+ - 'warn'
210
+ - 'error'
211
+ - 'raise'
212
+ - 'yield'
213
+ - 'source'
214
+ - 'assert'
215
+ - 'assert_equal'
216
+ - 'sh'
217
+ - 'mv'
218
+ - 'rm_rf'
219
+ Enabled: true
220
+
196
221
  Style/MixinUsage:
197
222
  Enabled: false
198
223
 
@@ -480,8 +505,5 @@ Naming/VariableNumber:
480
505
 
481
506
  #### Security
482
507
 
483
- # we use Date object in config.yml so should use YAML.load :-/
484
508
  Security/YAMLLoad:
485
- Exclude:
486
- - 'lib/review/catalog.rb'
487
- - 'test/test_helper.rb'
509
+ Enabled: true
@@ -16,7 +16,7 @@ addons:
16
16
 
17
17
  before_install:
18
18
  - |-
19
- gem update --system
19
+ ## gem update --system
20
20
  gem install bundler
21
21
  gem install epubcheck-ruby
22
22
 
data/NEWS.ja.md CHANGED
@@ -1,6 +1,102 @@
1
+ # Version 4.0.0
2
+ ## 新機能
3
+ * IDGXML ファイルをまとめて生成する、review-idgxmlmaker を導入しました ([#1337])
4
+ * review-textmaker は、imgmath パラメータが有効になっている場合に、数式を画像化するようになりました ([#1338])
5
+ * review-init に `-w` オプションを指定することで、Web ブラウザ上で TeX のレイアウトができるウィザードモードを用意しました。なお、この機能は実験的であり、将来別のものに置き換える可能性もあります ([#1403])
6
+ * 実験的実装として、複数行から段落を結合する際に、前後の文字の種類に基づいて空白文字の挿入を行う機能を追加しました。この機能を利用するには、unicode-eaw gem をインストールした上で、config.yml に `join_lines_by_lang: true` を追加してください [#1362]
7
+
8
+ ## 非互換の変更
9
+ * 通常の利用では使われることがないので、review-init の実行時に空の layouts フォルダを作成するのをやめました ([#1340])
10
+ * PDFMaker: `@<code>`、`@<tt>`、`@<tti>`、`@<ttb>` で空白文字が消えてしまう問題を修正しました。および利便性のために、文字列が版面からあふれるときに途中で改行するようにもしました ([#1348])
11
+ * `//texequation`、`//embed`、`//graph` はもともとインライン命令を許容しないので、内容のエスケープもしないようにしました。また、末尾に余計な空行が加わるのも防ぐようにしました ([#1371], [#1374])
12
+ * PDFMaker: コラム内での使用を考えて、表の配置のデフォルトを htp (指定位置→ページ上→独立ページの順に試行) から H (絶対に指定位置) にしました (review-style.sty の `\floatplacement{table}` の値) [#1385]
13
+ * PDFMaker: コードリスト内では和文欧文間の空きを 1/4 文字ではなく 0 にするようにしました ([#1401])
14
+ * config.yml の目次を制御する toc パラメータの値は、これまで null (false、目次は作らない) でしたが、一般的な利用方法を鑑みて、デフォルトを true (目次を作る) に切り替えました ([#1405])
15
+
16
+ ## バグ修正
17
+ * review-jlreq がタイプミスのために一部の jlreq.cls バージョンで正しく動作しないのを修正しました ([#1350])
18
+ * re ファイルが改行コード CR で記述されたときに不正な結果になるのを修正しました ([#1341])
19
+ * PDFMaker: review-jlreq において `//cmd` のブロックがページをまたいだときに文字色が黒になって見えなくなってしまうのを修正しました ([#1363])
20
+ * PDFMaker: `@<column>` で「コラム」ラベルが重複して出力されるのを修正しました ([#1367])
21
+ * PDFMaker: gentombow.sty と jsbook.cls は review-jsbook の場合のみコピーするようにしました ([#1381])
22
+ * PDFMaker: LuaLaTeX で review-jlreq を使ったときに壊れた PDFDocumentInformation ができる問題を修正しました ([#1392])
23
+ * PDFMaker: review-jlreq で偶数ページに隠しノンブルが入らなかったのを修正しました ([#1395])
24
+
25
+ ## 機能強化
26
+ * IDGXML ビルダで `@<em>` および `@<strong>` をサポートしました ([#1353])
27
+ * PDFMaker: コードブロックの各行の処理を `code_line`, `code_line_num` のメソッドに切り出しました ([#1368])
28
+ * PDFMaker: デフォルトのコンパイルオプションに `-halt-on-error` を追加しました。TeX のコンパイルエラーが発生したときに即終了することで問題が把握しやすくなります ([#1378])
29
+ * PDFMaker: コラム内に脚注 (`@<fn>`) があるときの挙動がコラムの実装手段によって異なり、番号がずれるなどの問題を起こすことがあるため、脚注の文章 (`//footnote`) はコラムの後に置くことを推奨します。コラム内に脚注文章が存在する場合は警告するようにしました ([#1379])
30
+ * YAML ファイルのエラーチェックを強化しました ([#1386])
31
+ * Logger での表示時に標準の progname を使うようにしました ([#1388])
32
+ * PDFMaker: 電子版の作成時に、表紙のページ番号を偶数とし、名前を「cover」にするようにしました ([#1402])
33
+ * PDFMaker: `generate_pdf` メソッドのリファクタリングを行いました ([#1404])
34
+ * プロジェクトの新規作成時に登録除外ファイル一覧の .gitignore ファイルを置くようにしました ([#1407])
35
+
36
+ ## ドキュメント
37
+ * sample-book の README.md を更新しました ([#1354])
38
+ * review-jsbook の README.md に jsbook.cls のオプションの説明を追加しました ([#1365])
39
+
40
+ ## その他
41
+ * メソッド引数のコーディングルールを統一しました ([#1360])
42
+ * `Catalog#{chaps,parts,predef,postdef,appendix}` は String ではなく Array を返すようにしました ([#1372])
43
+ * YAML ファイルの読み込みに `safe_load` を使うようにしました ([#1375])
44
+ * `table` メソッドをリファクタリングし、ビルダ個々の処理を簡略化しました ([#1356])
45
+ * `XXX_header` と `XXX_body` まわりをリファクタリングしました ([#1359])
46
+ * `Builder#highlight?` メソッドを HTMLBuilder 以外でも利用できるようにしました ([#1373])
47
+ * mkchap* と mkpart* まわりをリファクタリングしました ([#1383])
48
+ * Travis CI で rubygems を更新しないようにしました ([#1389])
49
+ * Index まわりをリファクタリングしました ([#1390])
50
+ * samples フォルダのサンプルドキュメントに review-jlreq のための設定を追加しました ([#1391])
51
+ * 用語リストは `:` の前にスペースを入れることを強く推奨するようにしました。スペースがない場合、警告されます ([#1398])
52
+
53
+ ## コントリビューターのみなさん
54
+ * [@m-shibata](https://github.com/m-shibata)
55
+ * [@masarakki](https://github.com/masarakki)
56
+
57
+ [#1337]: https://github.com/kmuto/review/issues/1337
58
+ [#1338]: https://github.com/kmuto/review/issues/1338
59
+ [#1340]: https://github.com/kmuto/review/issues/1340
60
+ [#1341]: https://github.com/kmuto/review/issues/1341
61
+ [#1348]: https://github.com/kmuto/review/issues/1348
62
+ [#1350]: https://github.com/kmuto/review/issues/1350
63
+ [#1353]: https://github.com/kmuto/review/pull/1353
64
+ [#1354]: https://github.com/kmuto/review/pull/1354
65
+ [#1356]: https://github.com/kmuto/review/pull/1356
66
+ [#1359]: https://github.com/kmuto/review/pull/1359
67
+ [#1360]: https://github.com/kmuto/review/pull/1360
68
+ [#1362]: https://github.com/kmuto/review/pull/1362
69
+ [#1363]: https://github.com/kmuto/review/issues/1363
70
+ [#1365]: https://github.com/kmuto/review/pull/1365
71
+ [#1367]: https://github.com/kmuto/review/issues/1367
72
+ [#1368]: https://github.com/kmuto/review/issues/1368
73
+ [#1371]: https://github.com/kmuto/review/pull/1371
74
+ [#1372]: https://github.com/kmuto/review/pull/1372
75
+ [#1373]: https://github.com/kmuto/review/pull/1373
76
+ [#1374]: https://github.com/kmuto/review/pull/1374
77
+ [#1375]: https://github.com/kmuto/review/pull/1375
78
+ [#1378]: https://github.com/kmuto/review/pull/1378
79
+ [#1379]: https://github.com/kmuto/review/issues/1379
80
+ [#1381]: https://github.com/kmuto/review/issues/1381
81
+ [#1383]: https://github.com/kmuto/review/issues/1383
82
+ [#1385]: https://github.com/kmuto/review/issues/1385
83
+ [#1386]: https://github.com/kmuto/review/pull/1386
84
+ [#1388]: https://github.com/kmuto/review/pull/1388
85
+ [#1389]: https://github.com/kmuto/review/pull/1389
86
+ [#1390]: https://github.com/kmuto/review/pull/1390
87
+ [#1391]: https://github.com/kmuto/review/pull/1391
88
+ [#1392]: https://github.com/kmuto/review/issues/1392
89
+ [#1395]: https://github.com/kmuto/review/issues/1395
90
+ [#1398]: https://github.com/kmuto/review/issues/1398
91
+ [#1401]: https://github.com/kmuto/review/pull/1401
92
+ [#1402]: https://github.com/kmuto/review/pull/1402
93
+ [#1403]: https://github.com/kmuto/review/pull/1403
94
+ [#1404]: https://github.com/kmuto/review/pull/1404
95
+ [#1405]: https://github.com/kmuto/review/pull/1405
96
+ [#1407]: https://github.com/kmuto/review/pull/1407
97
+
1
98
  # Version 3.2.0
2
99
 
3
- ## 新機能
4
100
  ## 非互換の変更
5
101
  * PDFMaker: `//image` 命令などで画像を配置するときに `\includegraphics` ではなく、それを抽象化した `\reviewincludegraphics` を使うようにしました ([#1318])
6
102
 
data/NEWS.md CHANGED
@@ -1,6 +1,102 @@
1
+ # Version 4.0.0
2
+ ## New Features
3
+ * introduce review-idgxmlmaker which generates IDGXML files at once ([#1337])
4
+ * review-textmaker converts the math in the document to image files when `imgmath` parameter has `true` ([#1338])
5
+ * introduce wizard mode to layout of LaTeX on Web browser. Add `-w` option to review-init. This feature is experimental and may be replaced in the future ([#1403])
6
+ * experimental feature: introduce the feature to insert whitespace based on character when combining lines into a paragraph. To enable this, install unicode-eaw gem and add `join_lines_by_lang: true` into config.yml [#1362]
7
+
8
+ ## Breaking Changes
9
+ * review-init no longer creates empty `layouts` folder ([#1340])
10
+ * PDFMaker: fix a problem that white space characters disappeared in `@<code>`, `@<tt>`, `@<tti>`, and `@<ttb>`. Also the string is automatically wrapped ([#1348])
11
+ * `//texequation`、`//embed` and `//graph` that don't allow inline op no longer escape inline op in strings. And don't put extra line break ([#1371], [#1374])
12
+ * PDFMaker: change the default table placement from `htp` to `H` for use in columns (`\floatplacement{table}` value in review-style.sty) [#1385]
13
+ * PDFMaker: the space between Japanese/Western characters in the code lists is changed to 0 from 1/4 character ([#1401])
14
+ * change the default value of `toc` parameter from null (false, don't create a table of contents) to true (create a table of contents) ([#1405])
15
+
16
+ ## Bug Fixes
17
+ * fix a typo in review-jlreq ([#1350])
18
+ * fix incorrect result when `re` file uses CR for line-feed code ([#1341])
19
+ * PDFMaker: fix foreground color of `//cmd` with review-jlreq after page breaking ([#1363])
20
+ * PDFMaker: fix duplicate 'column' label for `@<column>` ([#1367])
21
+ * PDFMaker: copy gentombow.sty and jsbook.cls only for review-jsbook ([#1381])
22
+ * PDFMaker: fix invalid PDFDocumentInformation on review-jlreq with LuaLaTeX ([#1392])
23
+ * PDFMaker: fix missing hiddenfolio information at even pages on review-jlreq ([#1395])
24
+
25
+ ## Enhancements
26
+ * support `@<em>` and `@<strong>` in IDGXMLBuilder ([#1353])
27
+ * PDFMaker: extract `code_line` and `code_line_num` from code blocks for ease handling each line ([#1368])
28
+ * PDFMaker: add new compile option `-halt-on-error` to make it easier to find the problem when an error occurs ([#1378])
29
+ * PDFMaker: when there is a footnote text (`//footnote`) in the column block, it may cuse problems such as numbering. So warn it if there is. ([#1379])
30
+ * Logger: progname should be add in logger, not in message arguments ([#1388])
31
+ * improve error checking for yaml files ([#1386])
32
+ * PDFMaker: the cover page becomes even number (p.0) and is named "cover" ([#1402])
33
+ * PDFMaker: refactor `generate_pdf` method ([#1404])
34
+ * create `.gitignore` for new project ([#1407])
35
+
36
+ ## Docs
37
+ * update sample-book/README.md ([#1354])
38
+ * add descriptions about options of jsbook.cls to review-jsbook/README.md ([#1365])
39
+
40
+ ## Others
41
+ * unify styles of a method with arguments ([#1360])
42
+ * `Catalog#{chaps,parts,predef,postdef,appendix}` should return Array, not String ([#1372])
43
+ * use `safe_load` for loading YAML ([#1375])
44
+ * refactor `table` method to simplify each builder ([#1356])
45
+ * refactor `XXX_header` and `XXX_body` ([#1359])
46
+ * enable `Builder#highlight?` method on each builder ([#1373])
47
+ * refactor mkdchap* and mkpart* ([#1383])
48
+ * don't update rubygems in Travis CI ([#1389])
49
+ * refactor around Index ([#1390])
50
+ * add configration for review-jlreq to sample documents ([#1391])
51
+ * definition list should start with spaces ([#1398])
52
+
53
+ ## Contributors
54
+ * [@m-shibata](https://github.com/m-shibata)
55
+ * [@masarakki](https://github.com/masarakki)
56
+
57
+ [#1337]: https://github.com/kmuto/review/issues/1337
58
+ [#1338]: https://github.com/kmuto/review/issues/1338
59
+ [#1340]: https://github.com/kmuto/review/issues/1340
60
+ [#1341]: https://github.com/kmuto/review/issues/1341
61
+ [#1348]: https://github.com/kmuto/review/issues/1348
62
+ [#1350]: https://github.com/kmuto/review/issues/1350
63
+ [#1353]: https://github.com/kmuto/review/pull/1353
64
+ [#1354]: https://github.com/kmuto/review/pull/1354
65
+ [#1356]: https://github.com/kmuto/review/pull/1356
66
+ [#1359]: https://github.com/kmuto/review/pull/1359
67
+ [#1360]: https://github.com/kmuto/review/pull/1360
68
+ [#1362]: https://github.com/kmuto/review/pull/1362
69
+ [#1363]: https://github.com/kmuto/review/issues/1363
70
+ [#1365]: https://github.com/kmuto/review/pull/1365
71
+ [#1367]: https://github.com/kmuto/review/issues/1367
72
+ [#1368]: https://github.com/kmuto/review/issues/1368
73
+ [#1371]: https://github.com/kmuto/review/pull/1371
74
+ [#1372]: https://github.com/kmuto/review/pull/1372
75
+ [#1373]: https://github.com/kmuto/review/pull/1373
76
+ [#1374]: https://github.com/kmuto/review/pull/1374
77
+ [#1375]: https://github.com/kmuto/review/pull/1375
78
+ [#1378]: https://github.com/kmuto/review/pull/1378
79
+ [#1379]: https://github.com/kmuto/review/issues/1379
80
+ [#1381]: https://github.com/kmuto/review/issues/1381
81
+ [#1383]: https://github.com/kmuto/review/issues/1383
82
+ [#1385]: https://github.com/kmuto/review/issues/1385
83
+ [#1386]: https://github.com/kmuto/review/pull/1386
84
+ [#1388]: https://github.com/kmuto/review/pull/1388
85
+ [#1389]: https://github.com/kmuto/review/pull/1389
86
+ [#1390]: https://github.com/kmuto/review/pull/1390
87
+ [#1391]: https://github.com/kmuto/review/pull/1391
88
+ [#1392]: https://github.com/kmuto/review/issues/1392
89
+ [#1395]: https://github.com/kmuto/review/issues/1395
90
+ [#1398]: https://github.com/kmuto/review/issues/1398
91
+ [#1401]: https://github.com/kmuto/review/pull/1401
92
+ [#1402]: https://github.com/kmuto/review/pull/1402
93
+ [#1403]: https://github.com/kmuto/review/pull/1403
94
+ [#1404]: https://github.com/kmuto/review/pull/1404
95
+ [#1405]: https://github.com/kmuto/review/pull/1405
96
+ [#1407]: https://github.com/kmuto/review/pull/1407
97
+
1
98
  # Version 3.2.0
2
99
 
3
- ## New Features
4
100
  ## Breaking Changes
5
101
  * PDFMaker: changed to use the abstract name `\reviewincludegraphics` instead of `\includegraphics` for image placements (such as `//image`) ([#1318])
6
102
 
@@ -140,7 +140,7 @@ end
140
140
  def replace_old_style_part(dir)
141
141
  catalog = ReVIEW::Catalog.new(File.open("#{dir}/catalog.yml"))
142
142
  Array.new(catalog.parts.split("\n")).each_with_index do |part, part_idx|
143
- next if part.end_with? '.re'
143
+ next if part.end_with?('.re')
144
144
 
145
145
  allow_overwrite = true
146
146
  part_name = sprintf('part%d.re', part_idx + 1)
@@ -50,7 +50,7 @@ def main
50
50
  end
51
51
  opts.on('--text', 'Check text.') do
52
52
  modes ||= []
53
- modes.push :text
53
+ modes.push(:text)
54
54
  end
55
55
  opts.on('--help', 'print this message and quit.') do
56
56
  puts opts.help
@@ -72,7 +72,7 @@ def main
72
72
  modes.each do |mode|
73
73
  case mode
74
74
  when :text
75
- check_text files
75
+ check_text(files)
76
76
  else
77
77
  raise 'must not happen'
78
78
  end
@@ -122,9 +122,9 @@ def words_re(rc)
122
122
  next if line[0, 1] == '#'
123
123
  if / !/ =~ line
124
124
  line, n = *line.split('!', 2)
125
- nega.push n.strip
125
+ nega.push(n.strip)
126
126
  end
127
- words.push line.strip
127
+ words.push(line.strip)
128
128
  end
129
129
  return Regexp.compile(words.join('|')),
130
130
  nega.empty? ? nil : Regexp.compile(nega.join('|'))
@@ -157,7 +157,7 @@ def each_paragraph(f)
157
157
  break if line.strip.empty?
158
158
  break if %r{\A(?:=|//[\w\}])} =~ line
159
159
  next if /\A\#@/ =~ line
160
- buf.push line.strip
160
+ buf.push(line.strip)
161
161
  end
162
162
  yield buf, lineno
163
163
  @review_utils_word_ok = nil
@@ -28,7 +28,7 @@ def main
28
28
  @unprovided[kw] = location
29
29
  end
30
30
  when /\A\#@provide\((.*)\)/
31
- provide $1
31
+ provide($1)
32
32
  else
33
33
  line.scan(/@<kw>\{(.*?)[,\}]/) { provide $1 }
34
34
  end
@@ -88,7 +88,7 @@ def _main
88
88
  compiler = ReVIEW::Compiler.new(load_strategy_class(@target, @check_only))
89
89
  result = compiler.compile(chap)
90
90
  if @output_filename
91
- write @output_filename, result
91
+ write(@output_filename, result)
92
92
  else
93
93
  puts result unless @check_only
94
94
  end
@@ -99,12 +99,12 @@ def _main
99
99
  compiler = ReVIEW::Compiler.new(load_strategy_class(@target, @check_only))
100
100
  book.chapters.each do |chap|
101
101
  str = compiler.compile(chap)
102
- write "#{chap.name}#{compiler.strategy.extname}", str unless @check_only
102
+ write("#{chap.name}#{compiler.strategy.extname}", str) unless @check_only
103
103
  end
104
104
  # PART
105
105
  book.parts_in_file.each do |part|
106
106
  str = compiler.compile(part)
107
- write "#{part.name}#{compiler.strategy.extname}", str unless @check_only
107
+ write("#{part.name}#{compiler.strategy.extname}", str) unless @check_only
108
108
  end
109
109
  else
110
110
  raise "must not happen: #{@mode}"
@@ -170,12 +170,12 @@ def parse_opts
170
170
  end
171
171
 
172
172
  def error(msg)
173
- @logger.error "#{File.basename($PROGRAM_NAME, '.*')}: #{msg}"
173
+ @logger.error msg
174
174
  exit 1
175
175
  end
176
176
 
177
177
  def warn(msg)
178
- @logger.warn "#{File.basename($PROGRAM_NAME, '.*')}: #{msg}"
178
+ @logger.warn msg
179
179
  end
180
180
 
181
181
  def load_strategy_class(target, strict)
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env ruby
2
+ # Copyright (c) 2019 Kenshi Muto
3
+ #
4
+ # This program is free software.
5
+ # You can distribute or modify this program under the terms of
6
+ # the GNU LGPL, Lesser General Public License version 2.1.
7
+ # For details of the GNU LGPL, see the file "COPYING".
8
+ #
9
+
10
+ require 'pathname'
11
+ bindir = Pathname.new(__FILE__).realpath.dirname
12
+ $LOAD_PATH.unshift((bindir + '../lib').realpath)
13
+
14
+ require 'review/idgxmlmaker'
15
+
16
+ ReVIEW::IDGXMLMaker.execute(*ARGV)
@@ -45,13 +45,13 @@ def _main
45
45
  opts.on('-a', '--all', 'print all chapters.') { source = book }
46
46
  opts.on('-p', '--part N', 'list only part N.') do |n|
47
47
  source = book.part(Integer(n)) or
48
- error_exit "part #{n} does not exist in this book"
48
+ error_exit("part #{n} does not exist in this book")
49
49
  end
50
50
  opts.on('-c', '--chapter C', 'list only chapter C.') do |c|
51
51
  begin
52
52
  source = ReVIEW::Book::Part.new(nil, 1, [book.chapter(c)])
53
53
  rescue
54
- error_exit "chapter #{c} does not exist in this book"
54
+ error_exit("chapter #{c} does not exist in this book")
55
55
  end
56
56
  end
57
57
  opts.on('-l', '--level N', 'list upto N level (1..4, default=4)') do |n|
@@ -79,7 +79,7 @@ def _main
79
79
  book.load_config(yamlfile) if yamlfile
80
80
 
81
81
  if source
82
- error_exit '-a/-s option and file arguments are exclusive' unless ARGV.empty?
82
+ error_exit('-a/-s option and file arguments are exclusive') unless ARGV.empty?
83
83
  else
84
84
  puts opts.help
85
85
  exit 0
@@ -88,18 +88,18 @@ def _main
88
88
  begin
89
89
  printer = printer_class.new(upper, param)
90
90
  if source.is_a?(ReVIEW::Book::Part)
91
- printer.print_part source
91
+ printer.print_part(source)
92
92
  else
93
- printer.print_book source
93
+ printer.print_book(source)
94
94
  end
95
95
  rescue ReVIEW::Error, Errno::ENOENT => e
96
96
  raise if $DEBUG
97
- error_exit e.message
97
+ error_exit(e.message)
98
98
  end
99
99
  end
100
100
 
101
101
  def error_exit(msg)
102
- @logger.error "#{File.basename($PROGRAM_NAME)}: #{msg}"
102
+ @logger.error msg
103
103
  exit 1
104
104
  end
105
105
 
@@ -39,7 +39,7 @@ def main
39
39
  if ENV['REVIEW_SAFE_MODE'].to_i & 2 > 0
40
40
  @logger.warn 'review-preproc-ext.rb is prohibited in safe mode. ignored.'
41
41
  else
42
- Kernel.load File.expand_path('review-preproc-ext.rb')
42
+ Kernel.load(File.expand_path('review-preproc-ext.rb'))
43
43
  end
44
44
  end
45
45
 
@@ -71,21 +71,21 @@ def main
71
71
  current_file = path
72
72
  case mode
73
73
  when :output
74
- File.open(path) { |f| pp.process f, $stdout }
74
+ File.open(path) { |f| pp.process(f, $stdout) }
75
75
  when :replace
76
- File.write "#{path}.pptmp", preproc(pp, path)
77
- File.rename "#{path}.pptmp", path
76
+ File.write("#{path}.pptmp", preproc(pp, path))
77
+ File.rename("#{path}.pptmp", path)
78
78
  when :diff, :check
79
79
  tmp = '/tmp/review.pptmp'
80
80
  begin
81
- File.write tmp, preproc(pp, path)
81
+ File.write(tmp, preproc(pp, path))
82
82
  if mode == :check
83
- system "diff -qu #{path} #{tmp} >/dev/null || echo #{path}"
83
+ system("diff -qu #{path} #{tmp} >/dev/null || echo #{path}")
84
84
  else
85
- system "diff -u #{path} #{tmp}"
85
+ system("diff -u #{path} #{tmp}")
86
86
  end
87
87
  ensure
88
- FileUtils.rm_f tmp
88
+ FileUtils.rm_f(tmp)
89
89
  end
90
90
  else
91
91
  raise "must not happen: #{mode}"
@@ -99,7 +99,7 @@ end
99
99
 
100
100
  def preproc(pp, path)
101
101
  buf = StringIO.new
102
- File.open(path) { |f| pp.process f, buf }
102
+ File.open(path) { |f| pp.process(f, buf) }
103
103
  buf.string
104
104
  end
105
105