review 5.6.0 → 5.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/rubocop.yml +31 -0
- data/.github/workflows/ruby-tex.yml +1 -1
- data/.github/workflows/ruby-win.yml +1 -1
- data/.github/workflows/ruby.yml +2 -2
- data/.rubocop.yml +13 -2
- data/NEWS.ja.md +22 -0
- data/NEWS.md +21 -0
- data/README.md +1 -1
- data/lib/review/book/base.rb +1 -1
- data/lib/review/builder.rb +4 -8
- data/lib/review/epubmaker/epubcommon.rb +13 -7
- data/lib/review/epubmaker/epubv2.rb +0 -5
- data/lib/review/epubmaker/epubv3.rb +9 -1
- data/lib/review/epubmaker/producer.rb +2 -3
- data/lib/review/epubmaker.rb +2 -4
- data/lib/review/htmlbuilder.rb +2 -2
- data/lib/review/idgxmlbuilder.rb +4 -3
- data/lib/review/img_math.rb +9 -2
- data/lib/review/init.rb +3 -3
- data/lib/review/latexbuilder.rb +1 -1
- data/lib/review/lineinput.rb +2 -2
- data/lib/review/makerhelper.rb +2 -2
- data/lib/review/pdfmaker.rb +3 -5
- data/lib/review/update.rb +3 -7
- data/lib/review/version.rb +1 -1
- data/lib/review/yamlloader.rb +0 -3
- data/review.gemspec +2 -3
- data/samples/syntax-book/Gemfile +1 -1
- data/templates/opf/epubv2.opf.erb +2 -0
- data/templates/opf/epubv3.opf.erb +2 -0
- data/templates/opf/opf_manifest_epubv2.opf.erb +2 -0
- data/templates/opf/opf_manifest_epubv3.opf.erb +2 -0
- data/templates/opf/opf_tocx_epubv3.opf.erb +2 -0
- metadata +10 -139
- data/test/assets/black.eps +0 -280
- data/test/assets/fit.png +0 -0
- data/test/assets/header_listener.html +0 -35
- data/test/assets/img_math/img1.png +0 -0
- data/test/assets/img_math/img2.png +0 -0
- data/test/assets/img_math/img3.png +0 -0
- data/test/assets/large.gif +0 -0
- data/test/assets/large.jpg +0 -0
- data/test/assets/large.png +0 -0
- data/test/assets/large.svg +0 -65
- data/test/assets/syntax_book_index_detail.txt +0 -60
- data/test/assets/test.xml.erb +0 -3
- data/test/assets/test_template.tex +0 -189
- data/test/assets/test_template_backmatter.tex +0 -200
- data/test/book_test_helper.rb +0 -44
- data/test/run_test.rb +0 -12
- data/test/test_book.rb +0 -588
- data/test/test_book_chapter.rb +0 -329
- data/test/test_book_part.rb +0 -53
- data/test/test_builder.rb +0 -128
- data/test/test_catalog.rb +0 -174
- data/test/test_catalog_converter_cmd.rb +0 -73
- data/test/test_compiler.rb +0 -52
- data/test/test_configure.rb +0 -91
- data/test/test_converter.rb +0 -21
- data/test/test_epub3maker.rb +0 -733
- data/test/test_epubmaker.rb +0 -931
- data/test/test_epubmaker_cmd.rb +0 -56
- data/test/test_extentions_hash.rb +0 -66
- data/test/test_helper.rb +0 -62
- data/test/test_htmlbuilder.rb +0 -3315
- data/test/test_htmltoc.rb +0 -29
- data/test/test_htmlutils.rb +0 -43
- data/test/test_i18n.rb +0 -300
- data/test/test_idgxmlbuilder.rb +0 -1529
- data/test/test_idgxmlmaker_cmd.rb +0 -50
- data/test/test_image_finder.rb +0 -81
- data/test/test_img_math.rb +0 -120
- data/test/test_index.rb +0 -287
- data/test/test_indexbuilder.rb +0 -52
- data/test/test_latexbuilder.rb +0 -2972
- data/test/test_latexbuilder_v2.rb +0 -1654
- data/test/test_lineinput.rb +0 -104
- data/test/test_location.rb +0 -30
- data/test/test_logger.rb +0 -33
- data/test/test_makerhelper.rb +0 -44
- data/test/test_markdownbuilder.rb +0 -371
- data/test/test_md2inaobuilder.rb +0 -90
- data/test/test_pdfmaker.rb +0 -354
- data/test/test_pdfmaker_cmd.rb +0 -130
- data/test/test_plaintextbuilder.rb +0 -1214
- data/test/test_preprocessor.rb +0 -196
- data/test/test_review_ext.rb +0 -30
- data/test/test_reviewheaderlistener.rb +0 -49
- data/test/test_rstbuilder.rb +0 -619
- data/test/test_sec_counter.rb +0 -156
- data/test/test_template.rb +0 -33
- data/test/test_textmaker_cmd.rb +0 -58
- data/test/test_textutils.rb +0 -187
- data/test/test_tocprinter.rb +0 -46
- data/test/test_topbuilder.rb +0 -1301
- data/test/test_update.rb +0 -473
- data/test/test_webtocprinter.rb +0 -195
- data/test/test_yamlloader.rb +0 -186
- data/test/test_zip_exporter.rb +0 -106
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 11969067c8cb25999f37895ba330bd5c030c62402d1540510e241c6029c38d90
|
|
4
|
+
data.tar.gz: 4294e10f33abcb6063ea0098c3b7256374a5696d693fe2284dcb0fed4f2b2348
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: dddd61f8870c1f2e0d1117d3318cb456bcf49db10a12c4c93dc8b7638b08e5b6894efdfbdbd635d432196f82d40f906b29435f4f6e5ddbb78d2dcbd3829715af
|
|
7
|
+
data.tar.gz: 695257c02903d581c061cd7813e8951923a4a63986e879aa6e6ee31d963d627bf0e9512f85ffc56ca6a596a8f8f114ed012c3cce9daa7dd41072aabc89a9cb3d
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
name: Lint by RuboCop
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- master
|
|
7
|
+
pull_request:
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
build:
|
|
11
|
+
|
|
12
|
+
runs-on: ${{ matrix.os }}
|
|
13
|
+
strategy:
|
|
14
|
+
fail-fast: false
|
|
15
|
+
matrix:
|
|
16
|
+
ruby: ['2.7', '3.0', '3.1', '3.2']
|
|
17
|
+
os: [ubuntu-latest]
|
|
18
|
+
steps:
|
|
19
|
+
- uses: actions/checkout@v2
|
|
20
|
+
- name: Set up Ruby
|
|
21
|
+
uses: ruby/setup-ruby@v1
|
|
22
|
+
with:
|
|
23
|
+
ruby-version: ${{ matrix.ruby }}
|
|
24
|
+
- name: fix ImageMagick policy.xml on Linux
|
|
25
|
+
if: runner.os == 'Linux'
|
|
26
|
+
run: sudo sed -i 's/none/read|write/g' /etc/ImageMagick-6/policy.xml
|
|
27
|
+
- name: Build and test with Rake
|
|
28
|
+
run: |
|
|
29
|
+
gem install bundler --no-document
|
|
30
|
+
bundle install --retry 3
|
|
31
|
+
bundle exec rubocop -P
|
data/.github/workflows/ruby.yml
CHANGED
|
@@ -13,7 +13,7 @@ jobs:
|
|
|
13
13
|
strategy:
|
|
14
14
|
fail-fast: false
|
|
15
15
|
matrix:
|
|
16
|
-
ruby: ['2.
|
|
16
|
+
ruby: ['2.7', '3.0', '3.1', '3.2']
|
|
17
17
|
os: [ubuntu-latest, macOS-latest]
|
|
18
18
|
steps:
|
|
19
19
|
- uses: actions/checkout@v2
|
|
@@ -28,4 +28,4 @@ jobs:
|
|
|
28
28
|
run: |
|
|
29
29
|
gem install bundler --no-document
|
|
30
30
|
bundle install --retry 3
|
|
31
|
-
bundle exec rake
|
|
31
|
+
bundle exec rake test
|
data/.rubocop.yml
CHANGED
|
@@ -5,7 +5,7 @@ AllCops:
|
|
|
5
5
|
- tmp/*
|
|
6
6
|
DisplayCopNames: true
|
|
7
7
|
NewCops: enable
|
|
8
|
-
TargetRubyVersion: 2.
|
|
8
|
+
TargetRubyVersion: 2.7
|
|
9
9
|
|
|
10
10
|
require:
|
|
11
11
|
- rubocop-performance
|
|
@@ -38,6 +38,9 @@ Performance/StringInclude:
|
|
|
38
38
|
Performance/CollectionLiteralInLoop:
|
|
39
39
|
Enabled: false
|
|
40
40
|
|
|
41
|
+
Performance/MapCompact:
|
|
42
|
+
Enabled: false
|
|
43
|
+
|
|
41
44
|
#### Style
|
|
42
45
|
|
|
43
46
|
Style/AsciiComments:
|
|
@@ -109,7 +112,7 @@ Style/LineEndConcatenation:
|
|
|
109
112
|
Enabled: false
|
|
110
113
|
|
|
111
114
|
Style/MethodCallWithArgsParentheses:
|
|
112
|
-
|
|
115
|
+
AllowedMethods:
|
|
113
116
|
- 'require'
|
|
114
117
|
- 'include'
|
|
115
118
|
- 'file'
|
|
@@ -194,6 +197,9 @@ Style/OptionalBooleanParameter:
|
|
|
194
197
|
Style/CombinableLoops:
|
|
195
198
|
Enabled: false
|
|
196
199
|
|
|
200
|
+
Style/FetchEnvVar:
|
|
201
|
+
Enabled: false
|
|
202
|
+
|
|
197
203
|
### Layout
|
|
198
204
|
|
|
199
205
|
Layout/BlockAlignment:
|
|
@@ -296,3 +302,8 @@ Naming/VariableNumber:
|
|
|
296
302
|
|
|
297
303
|
Gemspec/RequiredRubyVersion:
|
|
298
304
|
Enabled: false
|
|
305
|
+
|
|
306
|
+
Gemspec/DevelopmentDependencies:
|
|
307
|
+
EnforcedStyle: gemspec
|
|
308
|
+
Exclude:
|
|
309
|
+
- samples/syntax-book/Gemfile
|
data/NEWS.ja.md
CHANGED
|
@@ -1,3 +1,25 @@
|
|
|
1
|
+
# Version 5.7.0
|
|
2
|
+
## バグ修正
|
|
3
|
+
* Windows において、`review-init -w` の実行時にバインドアドレスを省略したときにエラーが発生するのを修正しました ([#1824])
|
|
4
|
+
* PDFMaker: `//blankline` でページをまたいだときに、ページの先頭に空行が入るのを抑制しました ([#1872])
|
|
5
|
+
* EPUBMaker: MathJax で数式を表現する際に、`<`, `>`, `&` を変換し、HTML のエラーが出ないようにしました ([#1876], [#1877])
|
|
6
|
+
|
|
7
|
+
## 非互換の変更
|
|
8
|
+
* 動作検証済みバージョンを Ruby 2.7 以降としました ([#1871])
|
|
9
|
+
* EPUMaker: EPUB の検証ルールに従い、EPUB の目次に表紙へのリンクを含めました ([#1874])
|
|
10
|
+
|
|
11
|
+
## その他
|
|
12
|
+
* Ruby 3.2 を動作検証テスト対象に含めました ([#1871])
|
|
13
|
+
* RuboCop 1.45.1 の指摘を反映しました ([#1878])
|
|
14
|
+
|
|
15
|
+
[#1824]: https://github.com/kmuto/review/issues/1824
|
|
16
|
+
[#1871]: https://github.com/kmuto/review/pull/1871
|
|
17
|
+
[#1872]: https://github.com/kmuto/review/issues/1872
|
|
18
|
+
[#1874]: https://github.com/kmuto/review/issues/1874
|
|
19
|
+
[#1876]: https://github.com/kmuto/review/pull/1876
|
|
20
|
+
[#1877]: https://github.com/kmuto/review/pull/1877
|
|
21
|
+
[#1878]: https://github.com/kmuto/review/pull/1878
|
|
22
|
+
|
|
1
23
|
# Version 5.6.0
|
|
2
24
|
## 新機能
|
|
3
25
|
* IDGXMLBuilder: `//texequation` と `@<m>` で `imgmath` math_formatに対応しました ([#1829])
|
data/NEWS.md
CHANGED
|
@@ -1,3 +1,24 @@
|
|
|
1
|
+
# Version 5.7.0
|
|
2
|
+
## Bug Fixes
|
|
3
|
+
* Fixed error when omitting a bind address of `review-init -w` on Windows ([#1824])
|
|
4
|
+
* EPUBMaker: escape `<`, `>`, and `&` when converting to MathJax to avoid HTML errors ([#1876], [#1877])
|
|
5
|
+
|
|
6
|
+
## Breaking Changes
|
|
7
|
+
* Ruby 2.6 or earlier was excluded from the operation verification ([#1871])
|
|
8
|
+
* EPUMaker: included a link to the cover in the table of contents according to EPUB validation rules ([#1874])
|
|
9
|
+
|
|
10
|
+
## Others
|
|
11
|
+
* Ruby 3.2 is now included in the testing target ([#1871])
|
|
12
|
+
* refactor code with RuboCop 1.45.1 ([#1878])
|
|
13
|
+
|
|
14
|
+
[#1824]: https://github.com/kmuto/review/issues/1824
|
|
15
|
+
[#1871]: https://github.com/kmuto/review/pull/1871
|
|
16
|
+
[#1872]: https://github.com/kmuto/review/issues/1872
|
|
17
|
+
[#1874]: https://github.com/kmuto/review/issues/1874
|
|
18
|
+
[#1876]: https://github.com/kmuto/review/pull/1876
|
|
19
|
+
[#1877]: https://github.com/kmuto/review/pull/1877
|
|
20
|
+
[#1878]: https://github.com/kmuto/review/pull/1878
|
|
21
|
+
|
|
1
22
|
# Version 5.6.0
|
|
2
23
|
## New Features
|
|
3
24
|
* IDGXMLBuilder: support `imgmath` math_format in `//texequation` and `@<m>` ([#1829])
|
data/README.md
CHANGED
data/lib/review/book/base.rb
CHANGED
data/lib/review/builder.rb
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright (c) 2002-
|
|
1
|
+
# Copyright (c) 2002-2023 Minero Aoki, Kenshi Muto
|
|
2
2
|
#
|
|
3
3
|
# This program is free software.
|
|
4
4
|
# You can distribute or modify this program under the terms of
|
|
@@ -234,7 +234,8 @@ module ReVIEW
|
|
|
234
234
|
sepidx = nil
|
|
235
235
|
rows = []
|
|
236
236
|
lines.each_with_index do |line, idx|
|
|
237
|
-
|
|
237
|
+
# {} is for LaTeX
|
|
238
|
+
if /\A[=-]{12}/ =~ line || /\A[={}-]{12}/ =~ line
|
|
238
239
|
sepidx ||= idx
|
|
239
240
|
next
|
|
240
241
|
end
|
|
@@ -512,12 +513,7 @@ module ReVIEW
|
|
|
512
513
|
end
|
|
513
514
|
|
|
514
515
|
def inline_wb(s)
|
|
515
|
-
|
|
516
|
-
if translated
|
|
517
|
-
inline_b(translated)
|
|
518
|
-
else
|
|
519
|
-
inline_b("[missing word: #{s}]")
|
|
520
|
-
end
|
|
516
|
+
inline_b(@dictionary[s] || "[missing word: #{s}]")
|
|
521
517
|
end
|
|
522
518
|
|
|
523
519
|
def raw(str)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# = epubcommon.rb -- super class for EPUBv2 and EPUBv3
|
|
2
2
|
#
|
|
3
|
-
# Copyright (c) 2010-
|
|
3
|
+
# Copyright (c) 2010-2023 Kenshi Muto and Masayoshi Takahashi
|
|
4
4
|
#
|
|
5
5
|
# This program is free software.
|
|
6
6
|
# You can distribute or modify this program under the terms of
|
|
@@ -231,6 +231,10 @@ module ReVIEW
|
|
|
231
231
|
ReVIEW::Template.generate(path: template_name, binding: binding)
|
|
232
232
|
end
|
|
233
233
|
|
|
234
|
+
def coveritem
|
|
235
|
+
[]
|
|
236
|
+
end
|
|
237
|
+
|
|
234
238
|
def hierarchy_ncx(type)
|
|
235
239
|
require 'rexml/document'
|
|
236
240
|
level = 1
|
|
@@ -264,7 +268,7 @@ module ReVIEW
|
|
|
264
268
|
doc.context[:attribute_quote] = :quote
|
|
265
269
|
|
|
266
270
|
e = doc.root.elements[1] # first <li/>
|
|
267
|
-
contents.each do |item|
|
|
271
|
+
(coveritem + contents).each do |item|
|
|
268
272
|
next if !item.notoc.nil? || item.level.nil? || item.file.nil? || item.title.nil? || item.level > toclevel
|
|
269
273
|
|
|
270
274
|
if item.level == level
|
|
@@ -304,7 +308,7 @@ module ReVIEW
|
|
|
304
308
|
|
|
305
309
|
def flat_ncx(type, indent = nil)
|
|
306
310
|
s = %Q(<#{type} class="toc-h1">\n)
|
|
307
|
-
contents.each do |item|
|
|
311
|
+
(coveritem + contents).each do |item|
|
|
308
312
|
next if !item.notoc.nil? || item.level.nil? || item.file.nil? || item.title.nil? || item.level > config['toclevel'].to_i
|
|
309
313
|
|
|
310
314
|
is = indent == true ? ' ' * item.level : ''
|
|
@@ -324,10 +328,12 @@ module ReVIEW
|
|
|
324
328
|
FileUtils.mkdir_p("#{tmpdir}/OEBPS")
|
|
325
329
|
File.write(File.join(tmpdir, opf_path), opf)
|
|
326
330
|
|
|
327
|
-
if
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
+
if config['cover']
|
|
332
|
+
if File.exist?("#{basedir}/#{config['cover']}")
|
|
333
|
+
FileUtils.cp("#{basedir}/#{config['cover']}", "#{tmpdir}/OEBPS")
|
|
334
|
+
else
|
|
335
|
+
File.write("#{tmpdir}/OEBPS/#{config['cover']}", cover)
|
|
336
|
+
end
|
|
331
337
|
end
|
|
332
338
|
|
|
333
339
|
if config['colophon'] && !config['colophon'].is_a?(String)
|
|
@@ -22,11 +22,6 @@ module ReVIEW
|
|
|
22
22
|
CREATOR_ATTRIBUTES = %w[aut a-adp a-ann a-arr a-art a-asn a-aqt a-aft a-aui a-ant a-bkp a-clb a-cmm a-dsr a-edt a-ill a-lyr a-mdc a-mus a-nrt a-oth a-pht a-prt a-red a-rev a-spn a-ths a-trc a-trl]
|
|
23
23
|
CONTRIBUTER_ATTRIBUTES = %w[adp ann arr art asn aqt aft aui ant bkp clb cmm dsr edt ill lyr mdc mus nrt oth pht prt red rev spn ths trc trl]
|
|
24
24
|
|
|
25
|
-
# Construct object with parameter hash +config+ and message resource hash +res+.
|
|
26
|
-
def initialize(producer) # rubocop:disable Lint/UselessMethodDefinition
|
|
27
|
-
super
|
|
28
|
-
end
|
|
29
|
-
|
|
30
25
|
# Return opf file content.
|
|
31
26
|
def opf
|
|
32
27
|
@opf_metainfo = opf_metainfo
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# = epubv3.rb -- EPUB version 3 producer.
|
|
2
2
|
#
|
|
3
|
-
# Copyright (c) 2010-
|
|
3
|
+
# Copyright (c) 2010-2023 Kenshi Muto
|
|
4
4
|
#
|
|
5
5
|
# This program is free software.
|
|
6
6
|
# You can distribute or modify this program under the terms of
|
|
@@ -213,6 +213,14 @@ module ReVIEW
|
|
|
213
213
|
ReVIEW::Template.generate(path: template_name, binding: binding)
|
|
214
214
|
end
|
|
215
215
|
|
|
216
|
+
def coveritem
|
|
217
|
+
if config['cover']
|
|
218
|
+
[Content.new(file: config['cover'], title: ReVIEW::I18n.t('covertitle'), level: 1, chaptype: 'cover')]
|
|
219
|
+
else
|
|
220
|
+
[]
|
|
221
|
+
end
|
|
222
|
+
end
|
|
223
|
+
|
|
216
224
|
# Produce EPUB file +epubfile+.
|
|
217
225
|
# +work_dir+ points the directory has contents.
|
|
218
226
|
# +tmpdir+ defines temporary directory.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# = producer.rb -- EPUB producer.
|
|
2
2
|
#
|
|
3
|
-
# Copyright (c) 2010-
|
|
3
|
+
# Copyright (c) 2010-2023 Kenshi Muto
|
|
4
4
|
#
|
|
5
5
|
# This program is free software.
|
|
6
6
|
# You can distribute or modify this program under the terms of
|
|
@@ -119,8 +119,7 @@ module ReVIEW
|
|
|
119
119
|
epubfile = "#{current}/#{epubfile}"
|
|
120
120
|
end
|
|
121
121
|
|
|
122
|
-
|
|
123
|
-
File.unlink(epubfile) if File.exist?(epubfile)
|
|
122
|
+
FileUtils.rm_f(epubfile)
|
|
124
123
|
|
|
125
124
|
begin
|
|
126
125
|
@epub.produce(epubfile, work_dir, new_tmpdir, base_dir: base_dir)
|
data/lib/review/epubmaker.rb
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright (c) 2010-
|
|
1
|
+
# Copyright (c) 2010-2023 Kenshi Muto and Masayoshi Takahashi
|
|
2
2
|
#
|
|
3
3
|
# This program is free software.
|
|
4
4
|
# You can distribute or modify this program under the terms of
|
|
@@ -106,9 +106,7 @@ module ReVIEW
|
|
|
106
106
|
def build_path
|
|
107
107
|
if @config['debug']
|
|
108
108
|
path = File.expand_path("#{@config['bookname']}-epub", Dir.pwd)
|
|
109
|
-
|
|
110
|
-
FileUtils.rm_rf(path, secure: true)
|
|
111
|
-
end
|
|
109
|
+
FileUtils.rm_rf(path, secure: true)
|
|
112
110
|
Dir.mkdir(path)
|
|
113
111
|
path
|
|
114
112
|
else
|
data/lib/review/htmlbuilder.rb
CHANGED
|
@@ -656,7 +656,7 @@ module ReVIEW
|
|
|
656
656
|
p = MathML::LaTeX::Parser.new(symbol: MathML::Symbol::CharacterReference)
|
|
657
657
|
print p.parse(lines.join("\n") + "\n", true)
|
|
658
658
|
elsif @book.config['math_format'] == 'mathjax'
|
|
659
|
-
puts "$$#{lines.join("\n")}$$"
|
|
659
|
+
puts "$$#{lines.join("\n").gsub('<', '\lt{}').gsub('>', '\gt{}').gsub('&', '&')}$$"
|
|
660
660
|
elsif @book.config['math_format'] == 'imgmath'
|
|
661
661
|
fontsize = @book.config['imgmath_options']['fontsize'].to_f
|
|
662
662
|
lineheight = @book.config['imgmath_options']['lineheight'].to_f
|
|
@@ -1051,7 +1051,7 @@ EOS
|
|
|
1051
1051
|
parser = MathML::LaTeX::Parser.new(symbol: MathML::Symbol::CharacterReference)
|
|
1052
1052
|
%Q(<span class="equation">#{parser.parse(str, nil)}</span>)
|
|
1053
1053
|
elsif @book.config['math_format'] == 'mathjax'
|
|
1054
|
-
%Q(<span class="equation">\\( #{str} \\)</span>)
|
|
1054
|
+
%Q(<span class="equation">\\( #{str.gsub('<', '\lt{}').gsub('>', '\gt{}').gsub('&', '&')} \\)</span>)
|
|
1055
1055
|
elsif @book.config['math_format'] == 'imgmath'
|
|
1056
1056
|
math_str = '$' + str + '$'
|
|
1057
1057
|
key = Digest::SHA256.hexdigest(str)
|
data/lib/review/idgxmlbuilder.rb
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright (c) 2008-
|
|
1
|
+
# Copyright (c) 2008-2023 Minero Aoki, Kenshi Muto
|
|
2
2
|
# 2002-2007 Minero Aoki
|
|
3
3
|
#
|
|
4
4
|
# This program is free software.
|
|
@@ -136,7 +136,8 @@ module ReVIEW
|
|
|
136
136
|
when 5
|
|
137
137
|
@subsubsubsection += 1
|
|
138
138
|
print %Q(<sect4 id="sect:#{@chapter.number}.#{@section}.#{@subsection}.#{@subsubsection}.#{@subsubsubsection}">) if @secttags
|
|
139
|
-
when 6
|
|
139
|
+
when 6
|
|
140
|
+
# ignore
|
|
140
141
|
else
|
|
141
142
|
raise "caption level too deep or unsupported: #{level}"
|
|
142
143
|
end
|
|
@@ -526,7 +527,7 @@ module ReVIEW
|
|
|
526
527
|
sepidx = nil
|
|
527
528
|
rows = []
|
|
528
529
|
lines.each_with_index do |line, idx|
|
|
529
|
-
if /\A[
|
|
530
|
+
if /\A[=-]{12}/.match?(line)
|
|
530
531
|
sepidx ||= idx
|
|
531
532
|
next
|
|
532
533
|
end
|
data/lib/review/img_math.rb
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Copyright (c) 2021-2023 Masayoshi Takahashi, 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
|
+
#
|
|
1
8
|
require 'fileutils'
|
|
2
9
|
require 'shellwords'
|
|
3
10
|
require 'review/loggable'
|
|
@@ -29,7 +36,7 @@ module ReVIEW
|
|
|
29
36
|
# Re:VIEW 2 compatibility
|
|
30
37
|
|
|
31
38
|
img_path = File.join(@math_dir, "_gen_#{key}.#{@config['imgmath_options']['format']}")
|
|
32
|
-
|
|
39
|
+
FileUtils.mkdir_p(@math_dir)
|
|
33
40
|
fontsize2 = (fontsize * 1.2).round.to_i
|
|
34
41
|
texsrc = <<-EOB
|
|
35
42
|
\\documentclass[12pt]{article}
|
|
@@ -63,7 +70,7 @@ module ReVIEW
|
|
|
63
70
|
def make_math_images
|
|
64
71
|
return if @math_maps.empty?
|
|
65
72
|
|
|
66
|
-
|
|
73
|
+
FileUtils.mkdir_p(@math_dir)
|
|
67
74
|
fontsize = @config['imgmath_options']['fontsize'].to_f
|
|
68
75
|
lineheight = @config['imgmath_options']['lineheight'].to_f
|
|
69
76
|
|
data/lib/review/init.rb
CHANGED
|
@@ -61,7 +61,7 @@ module ReVIEW
|
|
|
61
61
|
|
|
62
62
|
def parse_options(args)
|
|
63
63
|
@port = 18000
|
|
64
|
-
@bind = '0'
|
|
64
|
+
@bind = '0.0.0.0'
|
|
65
65
|
|
|
66
66
|
opts = OptionParser.new
|
|
67
67
|
opts.version = ReVIEW::VERSION
|
|
@@ -97,7 +97,7 @@ module ReVIEW
|
|
|
97
97
|
opts.on('', '--port port', 'port to use for Web based layout configuration. (default: 18000)') do |port|
|
|
98
98
|
@port = port
|
|
99
99
|
end
|
|
100
|
-
opts.on('', '--bind bindaddress', 'address to use for Web based layout configuration. (default: 0 (any))') do |bind|
|
|
100
|
+
opts.on('', '--bind bindaddress', 'address to use for Web based layout configuration. (default: 0.0.0.0 (any))') do |bind|
|
|
101
101
|
@bind = bind
|
|
102
102
|
end
|
|
103
103
|
|
|
@@ -321,7 +321,7 @@ EOS
|
|
|
321
321
|
AccessLog: [[File.open(IO::NULL, 'w'), '']]
|
|
322
322
|
}
|
|
323
323
|
|
|
324
|
-
bind_address = (@bind == '0') ? '<thishost>' : @bind
|
|
324
|
+
bind_address = (@bind == '0.0.0.0') ? '<thishost>' : @bind
|
|
325
325
|
puts "Please access http://#{bind_address}:#{web_config[:Port]} from Web browser."
|
|
326
326
|
begin
|
|
327
327
|
@web_server = WEBrick::HTTPServer.new(web_config)
|
data/lib/review/latexbuilder.rb
CHANGED
data/lib/review/lineinput.rb
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#
|
|
2
|
-
# Copyright (c) 2002-
|
|
2
|
+
# Copyright (c) 2002-2023 Minero Aoki, Masayoshi Takahashi, Kenshi Muto
|
|
3
3
|
#
|
|
4
4
|
# This program is free software.
|
|
5
5
|
# You can distribute/modify this program under the terms of
|
|
@@ -21,7 +21,7 @@ module ReVIEW
|
|
|
21
21
|
end
|
|
22
22
|
|
|
23
23
|
def inspect
|
|
24
|
-
"
|
|
24
|
+
"#<#{self.class} file=#{@input.inspect} line=#{lineno}>"
|
|
25
25
|
end
|
|
26
26
|
|
|
27
27
|
def eof?
|
data/lib/review/makerhelper.rb
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright (c) 2012-
|
|
1
|
+
# Copyright (c) 2012-2023 Yuto HAYAMIZU, Kenshi Muto
|
|
2
2
|
#
|
|
3
3
|
# This program is free software.
|
|
4
4
|
# You can distribute or modify this program under the terms of
|
|
@@ -48,7 +48,7 @@ module ReVIEW
|
|
|
48
48
|
if FileTest.directory?("#{from_dir}/#{fname}")
|
|
49
49
|
image_files += copy_images_to_dir("#{from_dir}/#{fname}", "#{to_dir}/#{fname}", options)
|
|
50
50
|
else
|
|
51
|
-
FileUtils.mkdir_p(to_dir)
|
|
51
|
+
FileUtils.mkdir_p(to_dir)
|
|
52
52
|
|
|
53
53
|
is_converted = false
|
|
54
54
|
(options[:convert] || {}).each do |orig_type, conv_type|
|
data/lib/review/pdfmaker.rb
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright (c) 2010-
|
|
1
|
+
# Copyright (c) 2010-2023 Kenshi Muto and Masayoshi Takahashi
|
|
2
2
|
#
|
|
3
3
|
# This program is free software.
|
|
4
4
|
# You can distribute or modify this program under the terms of
|
|
@@ -69,9 +69,7 @@ module ReVIEW
|
|
|
69
69
|
def build_path
|
|
70
70
|
if @config['debug']
|
|
71
71
|
path = "#{@config['bookname']}-pdf"
|
|
72
|
-
|
|
73
|
-
FileUtils.rm_rf(path, secure: true)
|
|
74
|
-
end
|
|
72
|
+
FileUtils.rm_rf(path, secure: true)
|
|
75
73
|
Dir.mkdir(path)
|
|
76
74
|
path
|
|
77
75
|
else
|
|
@@ -517,7 +515,7 @@ module ReVIEW
|
|
|
517
515
|
dir.sort.each do |fname|
|
|
518
516
|
next unless File.extname(fname).downcase == '.' + extname
|
|
519
517
|
|
|
520
|
-
FileUtils.mkdir_p(copybase)
|
|
518
|
+
FileUtils.mkdir_p(copybase)
|
|
521
519
|
if extname == 'erb'
|
|
522
520
|
File.open(File.join(copybase, fname.sub(/\.erb\Z/, '')), 'w') do |f|
|
|
523
521
|
f.print erb_content(File.join(dirname, fname))
|
data/lib/review/update.rb
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#
|
|
2
|
-
# Copyright (c) 2018-
|
|
2
|
+
# Copyright (c) 2018-2023 Kenshi Muto
|
|
3
3
|
#
|
|
4
4
|
# This program is free software.
|
|
5
5
|
# You can distribute or modify this program under the terms of
|
|
@@ -258,9 +258,7 @@ module ReVIEW
|
|
|
258
258
|
|
|
259
259
|
def update_rakefile(dir)
|
|
260
260
|
taskdir = File.join(dir, 'lib/tasks')
|
|
261
|
-
|
|
262
|
-
FileUtils.mkdir_p(taskdir)
|
|
263
|
-
end
|
|
261
|
+
FileUtils.mkdir_p(taskdir)
|
|
264
262
|
|
|
265
263
|
master_rakefile = File.join(@review_dir, 'samples/sample-book/src/Rakefile')
|
|
266
264
|
|
|
@@ -474,9 +472,7 @@ module ReVIEW
|
|
|
474
472
|
|
|
475
473
|
def update_tex_stys(template, dir)
|
|
476
474
|
texmacrodir = File.join(dir, 'sty')
|
|
477
|
-
|
|
478
|
-
FileUtils.mkdir(texmacrodir)
|
|
479
|
-
end
|
|
475
|
+
FileUtils.mkdir_p(texmacrodir)
|
|
480
476
|
|
|
481
477
|
tdir = File.join(@review_dir, 'templates/latex', template)
|
|
482
478
|
Dir.glob(File.join(tdir, '*.*')).each do |master_styfile|
|
data/lib/review/version.rb
CHANGED
data/lib/review/yamlloader.rb
CHANGED
data/review.gemspec
CHANGED
|
@@ -14,8 +14,7 @@ Gem::Specification.new do |gem|
|
|
|
14
14
|
gem.required_rubygems_version = Gem::Requirement.new('>= 0') if gem.respond_to?(:required_rubygems_version=)
|
|
15
15
|
gem.metadata = { 'rubygems_mfa_required' => 'true' }
|
|
16
16
|
|
|
17
|
-
gem.files = `git ls-files`.split("\n")
|
|
18
|
-
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
|
17
|
+
gem.files = `git ls-files`.split("\n").reject { |f| f.match(/^test/) }
|
|
19
18
|
gem.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
|
|
20
19
|
gem.extra_rdoc_files = []
|
|
21
20
|
gem.require_paths = ['lib']
|
|
@@ -28,7 +27,7 @@ Gem::Specification.new do |gem|
|
|
|
28
27
|
gem.add_development_dependency('mini_magick')
|
|
29
28
|
gem.add_development_dependency('pygments.rb')
|
|
30
29
|
gem.add_development_dependency('rake')
|
|
31
|
-
gem.add_development_dependency('rubocop', '~> 1.
|
|
30
|
+
gem.add_development_dependency('rubocop', '~> 1.45.1')
|
|
32
31
|
gem.add_development_dependency('rubocop-performance')
|
|
33
32
|
gem.add_development_dependency('rubocop-rake')
|
|
34
33
|
gem.add_development_dependency('simplecov')
|
data/samples/syntax-book/Gemfile
CHANGED
|
@@ -7,7 +7,9 @@
|
|
|
7
7
|
<%= @opf_manifest %>
|
|
8
8
|
<%= @opf_toc %>
|
|
9
9
|
<guide>
|
|
10
|
+
<% if @config['cover'].present? %>
|
|
10
11
|
<reference type="cover" title="<%= ReVIEW::I18n.t('covertitle') %>" href="<%= @config['cover'] %>"/>
|
|
12
|
+
<% end %>
|
|
11
13
|
<% if @config['titlepage'].present? %>
|
|
12
14
|
<reference type="title-page" title="<%= ReVIEW::I18n.t('titlepagetitle') %>" href="titlepage.<%= @config['htmlext'] %>"/>
|
|
13
15
|
<% end %>
|
|
@@ -7,7 +7,9 @@
|
|
|
7
7
|
<%= @opf_manifest %>
|
|
8
8
|
<%= @opf_toc %>
|
|
9
9
|
<guide>
|
|
10
|
+
<% if @config['cover'].present? %>
|
|
10
11
|
<reference type="cover" title="<%= ReVIEW::I18n.t('covertitle') %>" href="<%= @config['cover'] %>"/>
|
|
12
|
+
<% end %>
|
|
11
13
|
<% if @config["titlepage"].present? %>
|
|
12
14
|
<reference type="title-page" title="<%= ReVIEW::I18n.t('titlepagetitle') %>" href="titlepage.<%= @config['htmlext'] %>"/>
|
|
13
15
|
<% end %>
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
<manifest>
|
|
2
2
|
<item id="ncx" href="<%= @config['bookname'] %>.ncx" media-type="application/x-dtbncx+xml"/>
|
|
3
|
+
<% if @config['cover'] %>
|
|
3
4
|
<item id="<%= @config['bookname'] %>" href="<%= @config['cover'] %>" media-type="application/xhtml+xml"/>
|
|
5
|
+
<% end %>
|
|
4
6
|
<% if @config['toc'] && @config['mytoc'] %>
|
|
5
7
|
<item id="toc" href="<%= @config['bookname'] %>-toc.<%= @config['htmlext'] %>" media-type="application/xhtml+xml"/>
|
|
6
8
|
<% end %>
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
<manifest>
|
|
2
2
|
<item properties="nav" id="<%= @config['bookname'] %>-toc.<%= @config['htmlext'] %>" href="<%= @config['bookname'] %>-toc.<%= @config['htmlext'] %>" media-type="application/xhtml+xml"/>
|
|
3
|
+
<% if @config['cover'] %>
|
|
3
4
|
<item id="<%= @config['bookname'] %>" href="<%= @config['cover'] %>" media-type="application/xhtml+xml"/>
|
|
5
|
+
<% end %>
|
|
4
6
|
<% if @coverimage %>
|
|
5
7
|
<item properties="cover-image" id="cover-<%= @coverimage.id %>" href="<%= @coverimage.file %>" media-type="<%= @coverimage.media %>"/>
|
|
6
8
|
<% end %>
|