review 4.1.0 → 5.2.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-tex.yml +35 -0
- data/.github/workflows/ruby-win.yml +19 -9
- data/.github/workflows/ruby.yml +7 -3
- data/.rubocop.yml +138 -34
- data/NEWS.ja.md +285 -0
- data/NEWS.md +285 -1
- data/README.md +7 -6
- data/Rakefile +7 -2
- data/bin/review +2 -4
- data/bin/review-catalog-converter +4 -4
- data/bin/review-check +8 -12
- data/bin/review-checkdep +2 -5
- data/bin/review-compile +18 -34
- data/bin/review-epub2html +1 -4
- data/bin/review-epubmaker +3 -4
- data/bin/review-idgxmlmaker +1 -3
- data/bin/review-index +5 -86
- data/bin/review-init +1 -4
- data/bin/review-pdfmaker +1 -3
- data/bin/review-preproc +30 -38
- data/bin/review-textmaker +1 -3
- data/bin/review-update +1 -4
- data/bin/review-validate +4 -4
- data/bin/review-vol +5 -82
- data/bin/review-webmaker +1 -3
- data/doc/config.yml.sample +45 -11
- data/doc/config.yml.sample-simple +3 -3
- data/doc/format.ja.md +103 -13
- data/doc/format.md +104 -16
- data/doc/makeindex.ja.md +2 -2
- data/doc/pdfmaker.ja.md +42 -0
- data/doc/pdfmaker.md +41 -0
- data/doc/quickstart.ja.md +19 -6
- data/doc/quickstart.md +18 -6
- data/doc/writing_vertical.ja.md +6 -0
- data/lib/review.rb +1 -1
- data/lib/review/book.rb +2 -2
- data/lib/review/book/base.rb +67 -29
- data/lib/review/book/bib.rb +21 -0
- data/lib/review/book/book_unit.rb +158 -0
- data/lib/review/book/chapter.rb +33 -26
- data/lib/review/book/index.rb +24 -185
- data/lib/review/book/index/item.rb +7 -1
- data/lib/review/book/page_metric.rb +7 -7
- data/lib/review/book/part.rb +26 -11
- data/lib/review/book/volume.rb +5 -5
- data/lib/review/builder.rb +121 -52
- data/lib/review/call_hook.rb +20 -0
- data/lib/review/catalog.rb +3 -2
- data/lib/review/compiler.rb +230 -111
- data/lib/review/configure.rb +91 -7
- data/lib/review/converter.rb +1 -1
- data/lib/review/epub2html.rb +6 -1
- data/lib/review/epubmaker.rb +124 -152
- data/lib/review/epubmaker/content.rb +113 -0
- data/lib/review/epubmaker/epubcommon.rb +372 -0
- data/lib/review/epubmaker/epubv2.rb +178 -0
- data/lib/review/epubmaker/epubv3.rb +231 -0
- data/lib/review/epubmaker/producer.rb +167 -0
- data/lib/review/epubmaker/reviewheaderlistener.rb +12 -2
- data/lib/review/epubmaker/zip_exporter.rb +84 -0
- data/lib/review/exception.rb +13 -0
- data/lib/review/htmlbuilder.rb +176 -89
- data/lib/review/htmlutils.rb +8 -11
- data/lib/review/i18n.rb +2 -1
- data/lib/review/idgxmlbuilder.rb +165 -75
- data/lib/review/idgxmlmaker.rb +24 -28
- data/lib/review/img_math.rb +238 -0
- data/lib/review/index_builder.rb +645 -0
- data/lib/review/init.rb +9 -17
- data/lib/review/latexbox.rb +58 -0
- data/lib/review/latexbuilder.rb +193 -75
- data/lib/review/latexutils.rb +9 -1
- data/lib/review/lineinput.rb +112 -2
- data/lib/review/loggable.rb +27 -0
- data/lib/review/logger.rb +90 -3
- data/lib/review/makerhelper.rb +17 -188
- data/lib/review/markdownbuilder.rb +54 -4
- data/lib/review/pdfmaker.rb +76 -84
- data/lib/review/plaintextbuilder.rb +106 -22
- data/lib/review/preprocessor.rb +107 -303
- data/lib/review/preprocessor/directive.rb +35 -0
- data/lib/review/preprocessor/line.rb +34 -0
- data/lib/review/preprocessor/repository.rb +177 -0
- data/lib/review/rstbuilder.rb +27 -8
- data/lib/review/sec_counter.rb +14 -0
- data/lib/review/template.rb +11 -1
- data/lib/review/textmaker.rb +27 -32
- data/lib/review/textutils.rb +3 -12
- data/lib/review/tocprinter.rb +242 -97
- data/lib/review/topbuilder.rb +98 -31
- data/lib/review/update.rb +12 -13
- data/lib/review/version.rb +1 -1
- data/lib/review/volumeprinter.rb +97 -0
- data/lib/review/webmaker.rb +40 -47
- data/lib/review/webtocprinter.rb +39 -35
- data/lib/review/yamlloader.rb +2 -1
- data/review.gemspec +5 -3
- data/samples/sample-book/src/config-epub2.yml +1 -1
- data/samples/sample-book/src/config.yml +3 -3
- data/samples/sample-book/src/lib/tasks/review.rake +19 -1
- data/samples/sample-book/src/lib/tasks/z01_copy_sty.rake +2 -1
- data/samples/syntax-book/Gemfile +1 -1
- data/samples/syntax-book/ch01.re +1 -1
- data/samples/syntax-book/ch02.re +21 -6
- data/samples/syntax-book/ch03.re +1 -1
- data/samples/syntax-book/config.yml +1 -1
- data/samples/syntax-book/images/img3-2.png +0 -0
- data/samples/syntax-book/lib/tasks/z01_copy_sty.rake +2 -1
- data/templates/html/_colophon.html.erb +23 -0
- data/templates/html/_colophon_history.html.erb +9 -0
- data/templates/html/_cover.html.erb +10 -0
- data/templates/html/_part_body.html.erb +6 -0
- data/templates/html/_titlepage.html.erb +20 -0
- data/templates/html/layout-html5.html.erb +6 -0
- data/templates/html/layout-xhtml1.html.erb +6 -0
- data/templates/latex/config.erb +35 -23
- data/templates/latex/review-jlreq/README.md +3 -1
- data/templates/latex/review-jlreq/review-base.sty +36 -23
- data/templates/latex/review-jlreq/review-jlreq.cls +18 -25
- data/templates/latex/review-jlreq/review-style.sty +6 -1
- data/templates/latex/review-jlreq/review-tcbox.sty +348 -0
- data/templates/latex/review-jlreq/reviewmacro.sty +5 -0
- data/templates/latex/review-jsbook/README.md +7 -5
- data/templates/latex/review-jsbook/review-base.sty +40 -24
- data/templates/latex/review-jsbook/review-jsbook.cls +13 -3
- data/templates/latex/review-jsbook/review-style.sty +6 -1
- data/templates/latex/review-jsbook/review-tcbox.sty +348 -0
- data/templates/latex/review-jsbook/reviewmacro.sty +5 -0
- data/templates/opf/epubv2.opf.erb +7 -7
- data/templates/opf/epubv3.opf.erb +7 -7
- data/templates/opf/opf_manifest_epubv2.opf.erb +10 -0
- data/templates/opf/opf_manifest_epubv3.opf.erb +10 -0
- data/templates/opf/opf_metainfo_epubv2.opf.erb +17 -0
- data/templates/opf/opf_metainfo_epubv3.opf.erb +49 -0
- data/templates/opf/opf_tocx_epubv2.opf.erb +9 -0
- data/templates/opf/opf_tocx_epubv3.opf.erb +17 -0
- data/templates/web/html/layout-html5.html.erb +9 -8
- data/templates/web/html/layout-xhtml1.html.erb +6 -0
- data/test/assets/header_listener.html +35 -0
- 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/syntax_book_index_detail.txt +58 -0
- data/test/assets/test_template.tex +6 -3
- data/test/assets/test_template_backmatter.tex +6 -3
- data/test/book_test_helper.rb +11 -5
- data/test/run_test.rb +1 -1
- data/test/test_book.rb +54 -63
- data/test/test_book_chapter.rb +95 -54
- data/test/test_book_part.rb +3 -3
- data/test/test_builder.rb +29 -20
- data/test/test_catalog_converter_cmd.rb +1 -1
- data/test/test_converter.rb +1 -0
- data/test/test_epub3maker.rb +170 -126
- data/test/test_epubmaker.rb +254 -129
- data/test/test_epubmaker_cmd.rb +15 -4
- data/test/test_helper.rb +12 -5
- data/test/test_htmlbuilder.rb +926 -76
- data/test/test_htmlutils.rb +0 -12
- data/test/test_i18n.rb +33 -33
- data/test/test_idgxmlbuilder.rb +531 -20
- data/test/test_idgxmlmaker_cmd.rb +7 -3
- data/test/test_img_math.rb +111 -0
- data/test/test_index.rb +62 -52
- data/test/test_indexbuilder.rb +52 -0
- data/test/test_latexbuilder.rb +891 -20
- data/test/test_latexbuilder_v2.rb +56 -10
- data/test/test_lineinput.rb +20 -93
- data/test/test_logger.rb +7 -7
- data/test/test_makerhelper.rb +0 -12
- data/test/test_markdownbuilder.rb +32 -0
- data/test/test_pdfmaker.rb +100 -11
- data/test/test_pdfmaker_cmd.rb +3 -3
- data/test/test_plaintextbuilder.rb +546 -32
- data/test/test_preprocessor.rb +188 -1
- data/test/test_review_ext.rb +2 -1
- data/test/test_reviewheaderlistener.rb +49 -0
- data/test/test_rstbuilder.rb +25 -1
- data/test/test_sec_counter.rb +156 -0
- data/test/test_template.rb +12 -2
- data/test/test_textmaker_cmd.rb +5 -1
- data/test/test_tocprinter.rb +46 -0
- data/test/test_topbuilder.rb +324 -20
- data/test/test_update.rb +44 -44
- data/test/test_webtocprinter.rb +75 -43
- data/test/test_zip_exporter.rb +5 -6
- data/vendor/gentombow/LICENSE +1 -1
- data/vendor/gentombow/Makefile +0 -1
- data/vendor/gentombow/bounddvi-en.pdf +0 -0
- data/vendor/gentombow/bounddvi-en.tex +1 -0
- data/vendor/gentombow/bounddvi.pdf +0 -0
- data/vendor/gentombow/bounddvi.sty +30 -7
- data/vendor/gentombow/bounddvi.tex +1 -0
- data/vendor/gentombow/create_archive.sh +1 -0
- data/vendor/gentombow/gentombow-ja.pdf +0 -0
- data/vendor/gentombow/gentombow-ja.tex +9 -0
- data/vendor/gentombow/gentombow.pdf +0 -0
- data/vendor/gentombow/gentombow.sty +32 -10
- data/vendor/gentombow/gentombow.tex +8 -0
- data/vendor/gentombow/tests/gentombow-01-pdfx.tex +8 -0
- data/vendor/gentombow/tests/gentombow-02-pdfx.tex +8 -0
- data/vendor/jsclasses/Makefile +3 -2
- data/vendor/jsclasses/create_archive.sh +5 -5
- data/vendor/jsclasses/jis/Makefile +3 -2
- data/vendor/jsclasses/jis/jsarticle.cls +22 -18
- data/vendor/jsclasses/jis/jsbook.cls +22 -18
- data/vendor/jsclasses/jis/jsclasses.dtx +94 -13
- data/vendor/jsclasses/jis/jsclasses.ins +15 -5
- data/vendor/jsclasses/jis/jslogo.ins +9 -0
- data/vendor/jsclasses/jis/jslogo.sty +1 -13
- data/vendor/jsclasses/jis/jspf.cls +22 -18
- data/vendor/jsclasses/jis/jsreport.cls +22 -18
- data/vendor/jsclasses/jis/jsverb.ins +9 -0
- data/vendor/jsclasses/jis/jsverb.sty +1 -13
- data/vendor/jsclasses/jis/kiyou.cls +22 -18
- data/vendor/jsclasses/jis/minijs.sty +65 -22
- data/vendor/jsclasses/jis/okumacro.ins +9 -0
- data/vendor/jsclasses/jis/okumacro.sty +1 -13
- data/vendor/jsclasses/jis/okuverb.ins +9 -0
- data/vendor/jsclasses/jis/okuverb.sty +1 -13
- data/vendor/jsclasses/jis/winjis.sty +23 -19
- data/vendor/jsclasses/jsarticle.cls +22 -18
- data/vendor/jsclasses/jsbook.cls +22 -18
- data/vendor/jsclasses/jsclasses.dtx +94 -13
- data/vendor/jsclasses/jsclasses.ins +15 -5
- data/vendor/jsclasses/jsclasses.pdf +0 -0
- data/vendor/jsclasses/jslogo.ins +9 -0
- data/vendor/jsclasses/jslogo.pdf +0 -0
- data/vendor/jsclasses/jslogo.sty +1 -13
- data/vendor/jsclasses/jspf.cls +22 -18
- data/vendor/jsclasses/jsreport.cls +22 -18
- data/vendor/jsclasses/jsverb.ins +9 -0
- data/vendor/jsclasses/jsverb.pdf +0 -0
- data/vendor/jsclasses/jsverb.sty +1 -13
- data/vendor/jsclasses/kiyou.cls +22 -18
- data/vendor/jsclasses/minijs.sty +68 -22
- data/vendor/jsclasses/okumacro.ins +9 -0
- data/vendor/jsclasses/okumacro.pdf +0 -0
- data/vendor/jsclasses/okumacro.sty +1 -13
- data/vendor/jsclasses/okuverb.ins +9 -0
- data/vendor/jsclasses/okuverb.pdf +0 -0
- data/vendor/jsclasses/okuverb.sty +1 -13
- data/vendor/jsclasses/tests/relfont.tex +10 -0
- data/vendor/jsclasses/winjis.sty +23 -19
- metadata +106 -22
- data/.rubocop_todo.yml +0 -7
- data/lib/epubmaker.rb +0 -23
- data/lib/epubmaker/content.rb +0 -110
- data/lib/epubmaker/epubcommon.rb +0 -441
- data/lib/epubmaker/epubv2.rb +0 -143
- data/lib/epubmaker/epubv3.rb +0 -233
- data/lib/epubmaker/producer.rb +0 -375
- data/lib/epubmaker/zip_exporter.rb +0 -81
- data/lib/lineinput.rb +0 -155
- data/lib/review/book/compilable.rb +0 -178
- data/lib/review/tocparser.rb +0 -275
- data/test/test_tocparser.rb +0 -25
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c) 2013-
|
1
|
+
# Copyright (c) 2013-2020 KADO Masanori, Masayoshi Takahashi, Kenshi Muto
|
2
2
|
#
|
3
3
|
# This program is free software.
|
4
4
|
# You can distribute or modify this program under the terms of
|
@@ -18,6 +18,7 @@ module ReVIEW
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def builder_init_file
|
21
|
+
super
|
21
22
|
@noindent = nil
|
22
23
|
@blank_seen = nil
|
23
24
|
@ul_indent = 0
|
@@ -155,10 +156,28 @@ module ReVIEW
|
|
155
156
|
puts %Q(<div class="#{type}">)
|
156
157
|
puts %Q(<p class="caption">#{compile_inline(caption)}</p>) if caption.present?
|
157
158
|
blocked_lines = split_paragraph(lines)
|
158
|
-
puts blocked_lines.join("\n")
|
159
|
+
puts blocked_lines.join("\n\n")
|
159
160
|
puts '</div>'
|
160
161
|
end
|
161
162
|
|
163
|
+
CAPTION_TITLES.each do |name|
|
164
|
+
class_eval %Q(
|
165
|
+
def #{name}_begin(caption = nil)
|
166
|
+
check_nested_minicolumn
|
167
|
+
@doc_status[:minicolumn] = '#{name}'
|
168
|
+
puts %Q(<div class="#{name}">)
|
169
|
+
if caption.present?
|
170
|
+
puts %Q(<p class="caption">\#{compile_inline(caption)}</p>)
|
171
|
+
end
|
172
|
+
end
|
173
|
+
|
174
|
+
def #{name}_end
|
175
|
+
puts '</div>'
|
176
|
+
@doc_status[:minicolumn] = nil
|
177
|
+
end
|
178
|
+
), __FILE__, __LINE__ - 14
|
179
|
+
end
|
180
|
+
|
162
181
|
def hr
|
163
182
|
puts '----'
|
164
183
|
end
|
@@ -206,6 +225,14 @@ module ReVIEW
|
|
206
225
|
"<u>#{str}</u>"
|
207
226
|
end
|
208
227
|
|
228
|
+
def inline_ins(str)
|
229
|
+
"<ins>#{str}</ins>"
|
230
|
+
end
|
231
|
+
|
232
|
+
def inline_del(str)
|
233
|
+
"~~#{str}~~"
|
234
|
+
end
|
235
|
+
|
209
236
|
def image_image(id, caption, _metric)
|
210
237
|
blank
|
211
238
|
puts "![#{compile_inline(caption)}](#{@chapter.image(id).path.sub(%r{\A\./}, '')})"
|
@@ -219,13 +246,35 @@ module ReVIEW
|
|
219
246
|
def inline_img(id)
|
220
247
|
"#{I18n.t('image')}#{@chapter.image(id).number}"
|
221
248
|
rescue KeyError
|
222
|
-
|
249
|
+
app_error "unknown image: #{id}"
|
223
250
|
end
|
224
251
|
|
225
252
|
def inline_dtp(str)
|
226
253
|
"<!-- DTP:#{str} -->"
|
227
254
|
end
|
228
255
|
|
256
|
+
def inline_hd_chap(chap, id)
|
257
|
+
n = chap.headline_index.number(id)
|
258
|
+
if n.present? && chap.number && over_secnolevel?(n)
|
259
|
+
str = I18n.t('hd_quote', [n, compile_inline(chap.headline(id).caption)])
|
260
|
+
else
|
261
|
+
str = I18n.t('hd_quote_without_number', compile_inline(chap.headline(id).caption))
|
262
|
+
end
|
263
|
+
if @book.config['chapterlink']
|
264
|
+
if @chapter == chap
|
265
|
+
anchor = 'h' + n.tr('.', '-')
|
266
|
+
%Q(<a href="##{anchor}">#{str}</a>)
|
267
|
+
else
|
268
|
+
warn 'MARKDOWNBuilder does not support links to other chapters', location: location
|
269
|
+
str
|
270
|
+
end
|
271
|
+
else
|
272
|
+
str
|
273
|
+
end
|
274
|
+
rescue KeyError
|
275
|
+
app_error "unknown headline: #{id}"
|
276
|
+
end
|
277
|
+
|
229
278
|
def indepimage(_lines, id, caption = '', _metric = nil)
|
230
279
|
blank
|
231
280
|
puts "![#{compile_inline(caption)}](#{@chapter.image(id).path.sub(%r{\A\./}, '')})"
|
@@ -340,6 +389,7 @@ module ReVIEW
|
|
340
389
|
|
341
390
|
def comment(lines, comment = nil)
|
342
391
|
return unless @book.config['draft']
|
392
|
+
|
343
393
|
lines ||= []
|
344
394
|
unless comment.blank?
|
345
395
|
lines.unshift(comment)
|
@@ -352,7 +402,7 @@ module ReVIEW
|
|
352
402
|
begin
|
353
403
|
"![](#{@chapter.image(id).path.sub(%r{\A\./}, '')})"
|
354
404
|
rescue
|
355
|
-
warn "image not bound: #{id}"
|
405
|
+
warn "image not bound: #{id}", location: location
|
356
406
|
%Q(<pre>missing image: #{id}</pre>)
|
357
407
|
end
|
358
408
|
end
|
data/lib/review/pdfmaker.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c) 2010-
|
1
|
+
# Copyright (c) 2010-2021 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
|
@@ -22,11 +22,15 @@ require 'review/yamlloader'
|
|
22
22
|
require 'review/version'
|
23
23
|
require 'review/makerhelper'
|
24
24
|
require 'review/template'
|
25
|
+
require 'review/latexbox'
|
26
|
+
require 'review/call_hook'
|
27
|
+
require 'review/loggable'
|
25
28
|
|
26
29
|
module ReVIEW
|
27
30
|
class PDFMaker
|
28
|
-
include FileUtils
|
29
31
|
include ReVIEW::LaTeXUtils
|
32
|
+
include Loggable
|
33
|
+
include ReVIEW::CallHook
|
30
34
|
|
31
35
|
attr_accessor :config, :basedir
|
32
36
|
|
@@ -35,13 +39,14 @@ module ReVIEW
|
|
35
39
|
@logger = ReVIEW.logger
|
36
40
|
@input_files = Hash.new { |h, key| h[key] = '' }
|
37
41
|
@mastertex = '__REVIEW_BOOK__'
|
42
|
+
@compile_errors = nil
|
38
43
|
end
|
39
44
|
|
40
45
|
def system_with_info(*args)
|
41
46
|
@logger.info args.join(' ')
|
42
47
|
out, status = Open3.capture2e(*args)
|
43
48
|
unless status.success?
|
44
|
-
|
49
|
+
error "execution error\n\nError log:\n#{out}"
|
45
50
|
end
|
46
51
|
end
|
47
52
|
|
@@ -49,19 +54,10 @@ module ReVIEW
|
|
49
54
|
@logger.info args.join(' ')
|
50
55
|
out, status = Open3.capture2e(*args)
|
51
56
|
unless status.success?
|
52
|
-
error "failed to run command: #{args.join(' ')}\n\nError log:\n"
|
57
|
+
error! "failed to run command: #{args.join(' ')}\n\nError log:\n#{out}"
|
53
58
|
end
|
54
59
|
end
|
55
60
|
|
56
|
-
def error(msg)
|
57
|
-
@logger.error msg
|
58
|
-
exit 1
|
59
|
-
end
|
60
|
-
|
61
|
-
def warn(msg)
|
62
|
-
@logger.warn msg
|
63
|
-
end
|
64
|
-
|
65
61
|
def pdf_filepath
|
66
62
|
File.join(@basedir, @config['bookname'] + '.pdf')
|
67
63
|
end
|
@@ -89,7 +85,7 @@ module ReVIEW
|
|
89
85
|
if ignore_errors
|
90
86
|
@logger.info 'compile error, but try to generate PDF file'
|
91
87
|
else
|
92
|
-
error 'compile error, No PDF file output.'
|
88
|
+
error! 'compile error, No PDF file output.'
|
93
89
|
end
|
94
90
|
end
|
95
91
|
|
@@ -122,20 +118,13 @@ module ReVIEW
|
|
122
118
|
end
|
123
119
|
|
124
120
|
def execute(*args)
|
125
|
-
@config = ReVIEW::Configure.values
|
126
|
-
@config.maker = 'pdfmaker'
|
127
121
|
cmd_config, yamlfile = parse_opts(args)
|
128
|
-
error "#{yamlfile} not found." unless File.exist?(yamlfile)
|
122
|
+
error! "#{yamlfile} not found." unless File.exist?(yamlfile)
|
129
123
|
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
rescue => e
|
134
|
-
error "yaml error #{e.message}"
|
135
|
-
end
|
124
|
+
@config = ReVIEW::Configure.create(maker: 'pdfmaker',
|
125
|
+
yamlfile: yamlfile,
|
126
|
+
config: cmd_config)
|
136
127
|
|
137
|
-
# YAML configs will be overridden by command line options.
|
138
|
-
@config.deep_merge!(cmd_config)
|
139
128
|
I18n.setup(@config['language'])
|
140
129
|
@basedir = File.absolute_path(File.dirname(yamlfile))
|
141
130
|
|
@@ -158,7 +147,8 @@ module ReVIEW
|
|
158
147
|
generate_pdf
|
159
148
|
rescue ApplicationError => e
|
160
149
|
raise if @config['debug']
|
161
|
-
|
150
|
+
|
151
|
+
error! e.message
|
162
152
|
end
|
163
153
|
end
|
164
154
|
|
@@ -205,7 +195,7 @@ module ReVIEW
|
|
205
195
|
Dir.chdir(@path) do
|
206
196
|
File.open("./#{@mastertex}.tex", 'wb') { |f| f.write template }
|
207
197
|
|
208
|
-
call_hook('hook_beforetexcompile')
|
198
|
+
call_hook('hook_beforetexcompile', Dir.pwd, @basedir, base_dir: @basedir)
|
209
199
|
|
210
200
|
## do compile
|
211
201
|
if ENV['REVIEW_SAFE_MODE'].to_i & 4 > 0
|
@@ -220,7 +210,7 @@ module ReVIEW
|
|
220
210
|
makeindex_dic = ReVIEW::Configure.values['pdfmaker']['makeindex_dic']
|
221
211
|
else
|
222
212
|
unless @config['texcommand'].present?
|
223
|
-
error "texcommand isn't defined."
|
213
|
+
error! "texcommand isn't defined."
|
224
214
|
end
|
225
215
|
texcommand = @config['texcommand']
|
226
216
|
dvicommand = @config['dvicommand']
|
@@ -248,33 +238,32 @@ module ReVIEW
|
|
248
238
|
system_or_raise(*[texcommand, texoptions, "#{@mastertex}.tex"].flatten.compact)
|
249
239
|
end
|
250
240
|
|
251
|
-
call_hook('hook_beforemakeindex')
|
241
|
+
call_hook('hook_beforemakeindex', Dir.pwd, @basedir, base_dir: @basedir)
|
252
242
|
if @config['pdfmaker']['makeindex'] && File.size?("#{@mastertex}.idx")
|
253
243
|
system_or_raise(*[makeindex_command, makeindex_options, @mastertex].flatten.compact)
|
244
|
+
call_hook('hook_aftermakeindex', Dir.pwd, @basedir, base_dir: @basedir)
|
254
245
|
system_or_raise(*[texcommand, texoptions, "#{@mastertex}.tex"].flatten.compact)
|
255
246
|
end
|
256
|
-
call_hook('hook_aftermakeindex')
|
257
247
|
|
258
248
|
system_or_raise(*[texcommand, texoptions, "#{@mastertex}.tex"].flatten.compact)
|
259
|
-
call_hook('hook_aftertexcompile')
|
249
|
+
call_hook('hook_aftertexcompile', Dir.pwd, @basedir, base_dir: @basedir)
|
260
250
|
|
261
251
|
if File.exist?("#{@mastertex}.dvi") && dvicommand.present?
|
262
252
|
system_or_raise(*[dvicommand, dvioptions, "#{@mastertex}.dvi"].flatten.compact)
|
263
|
-
call_hook('hook_afterdvipdf')
|
253
|
+
call_hook('hook_afterdvipdf', Dir.pwd, @basedir, base_dir: @basedir)
|
264
254
|
end
|
265
255
|
end
|
266
256
|
end
|
267
257
|
|
268
258
|
def generate_pdf
|
269
259
|
remove_old_file
|
270
|
-
erb_config
|
271
260
|
@path = build_path
|
272
261
|
begin
|
273
262
|
@compile_errors = nil
|
274
263
|
|
275
|
-
book = ReVIEW::Book.
|
276
|
-
book.config = @config
|
264
|
+
book = ReVIEW::Book::Base.new(@basedir, config: @config)
|
277
265
|
@converter = ReVIEW::Converter.new(book, ReVIEW::LATEXBuilder.new)
|
266
|
+
erb_config
|
278
267
|
|
279
268
|
@input_files = make_input_files(book)
|
280
269
|
|
@@ -284,6 +273,9 @@ module ReVIEW
|
|
284
273
|
@config['usepackage'] = ''
|
285
274
|
@config['usepackage'] = "\\usepackage{#{@config['texstyle']}}" if @config['texstyle']
|
286
275
|
|
276
|
+
if @config['pdfmaker']['use_symlink']
|
277
|
+
logger.info 'use symlink'
|
278
|
+
end
|
287
279
|
copy_images(@config['imagedir'], File.join(@path, @config['imagedir']))
|
288
280
|
copy_sty(File.join(Dir.pwd, 'sty'), @path)
|
289
281
|
copy_sty(File.join(Dir.pwd, 'sty'), @path, 'fd')
|
@@ -295,8 +287,9 @@ module ReVIEW
|
|
295
287
|
build_pdf
|
296
288
|
|
297
289
|
FileUtils.cp(File.join(@path, "#{@mastertex}.pdf"), pdf_filepath)
|
290
|
+
@logger.success("built #{File.basename(pdf_filepath)}")
|
298
291
|
ensure
|
299
|
-
remove_entry_secure(@path) unless @config['debug']
|
292
|
+
FileUtils.remove_entry_secure(@path) unless @config['debug']
|
300
293
|
end
|
301
294
|
end
|
302
295
|
|
@@ -306,27 +299,21 @@ module ReVIEW
|
|
306
299
|
@converter.convert(filename + '.re', File.join(@path, filename + '.tex'))
|
307
300
|
rescue => e
|
308
301
|
@compile_errors = true
|
309
|
-
|
310
|
-
|
302
|
+
error "compile error in #{filename}.tex (#{e.class})"
|
303
|
+
error e.message
|
311
304
|
end
|
312
305
|
end
|
313
306
|
|
314
|
-
# PDFMaker#copy_images should copy image files
|
307
|
+
# PDFMaker#copy_images should copy image files
|
315
308
|
#
|
316
309
|
def copy_images(from, to)
|
317
310
|
return unless File.exist?(from)
|
311
|
+
|
318
312
|
Dir.mkdir(to)
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
if @config['pdfmaker']['bbox']
|
324
|
-
system_with_info('extractbb', '-B', @config['pdfmaker']['bbox'], *images)
|
325
|
-
system_or_raise('ebb', '-B', @config['pdfmaker']['bbox'], *images) unless system('extractbb', '-B', @config['pdfmaker']['bbox'], '-m', *images)
|
326
|
-
else
|
327
|
-
system_with_info('extractbb', *images)
|
328
|
-
system_or_raise('ebb', *images) unless system('extractbb', '-m', *images)
|
329
|
-
end
|
313
|
+
if @config['pdfmaker']['use_symlink']
|
314
|
+
ReVIEW::MakerHelper.copy_images_to_dir(from, to, use_symlink: true)
|
315
|
+
else
|
316
|
+
ReVIEW::MakerHelper.copy_images_to_dir(from, to)
|
330
317
|
end
|
331
318
|
end
|
332
319
|
|
@@ -335,6 +322,7 @@ module ReVIEW
|
|
335
322
|
if File.exist?(file_sty)
|
336
323
|
return File.read(file_sty)
|
337
324
|
end
|
325
|
+
|
338
326
|
nil
|
339
327
|
end
|
340
328
|
|
@@ -385,11 +373,11 @@ module ReVIEW
|
|
385
373
|
items.each_with_index do |item, rev|
|
386
374
|
editstr = edit == 0 ? ReVIEW::I18n.t('first_edition') : ReVIEW::I18n.t('nth_edition', (edit + 1).to_s)
|
387
375
|
revstr = ReVIEW::I18n.t('nth_impression', (rev + 1).to_s)
|
388
|
-
if item =~ /\A\d
|
376
|
+
if item =~ /\A\d+-\d+-\d+\Z/
|
389
377
|
buf << ReVIEW::I18n.t('published_by1', [date_to_s(item), editstr + revstr])
|
390
|
-
elsif item =~ /\A(\d
|
378
|
+
elsif item =~ /\A(\d+-\d+-\d+)[\s ](.+)/
|
391
379
|
# custom date with string
|
392
|
-
item.match(/\A(\d
|
380
|
+
item.match(/\A(\d+-\d+-\d+)[\s ](.+)/) { |m| buf << ReVIEW::I18n.t('published_by3', [date_to_s(m[1]), m[2]]) }
|
393
381
|
else
|
394
382
|
# free format
|
395
383
|
buf << item
|
@@ -455,38 +443,49 @@ module ReVIEW
|
|
455
443
|
end
|
456
444
|
|
457
445
|
@locale_latex = {}
|
458
|
-
part_tuple = I18n.get('part').split(
|
459
|
-
chapter_tuple = I18n.get('chapter').split(
|
460
|
-
appendix_tuple = I18n.get('appendix').split(
|
461
|
-
@locale_latex['prepartname'] = part_tuple[0]
|
462
|
-
@locale_latex['postpartname'] = part_tuple[1]
|
463
|
-
@locale_latex['prechaptername'] = chapter_tuple[0]
|
464
|
-
@locale_latex['postchaptername'] = chapter_tuple[1]
|
465
|
-
@locale_latex['preappendixname'] = appendix_tuple[0]
|
466
|
-
@locale_latex['postappendixname'] = appendix_tuple[1]
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
446
|
+
part_tuple = I18n.get('part').split(/%[A-Za-z]{1,3}/, 2)
|
447
|
+
chapter_tuple = I18n.get('chapter').split(/%[A-Za-z]{1,3}/, 2)
|
448
|
+
appendix_tuple = I18n.get('appendix').split(/%[A-Za-z]{1,3}/, 2)
|
449
|
+
@locale_latex['prepartname'] = part_tuple[0].to_s
|
450
|
+
@locale_latex['postpartname'] = part_tuple[1].to_s
|
451
|
+
@locale_latex['prechaptername'] = chapter_tuple[0].to_s
|
452
|
+
@locale_latex['postchaptername'] = chapter_tuple[1].to_s
|
453
|
+
@locale_latex['preappendixname'] = appendix_tuple[0].to_s
|
454
|
+
@locale_latex['postappendixname'] = appendix_tuple[1].to_s
|
455
|
+
|
456
|
+
if @config['pdfmaker']['boxsetting']
|
457
|
+
begin
|
458
|
+
@boxsetting = ReVIEW::LaTeXBox.new.tcbox(@config)
|
459
|
+
rescue ReVIEW::ConfigError => e
|
460
|
+
error! e
|
461
|
+
end
|
462
|
+
end
|
474
463
|
end
|
475
464
|
|
476
465
|
def latex_config
|
477
|
-
|
466
|
+
result = ReVIEW::Template.generate(path: './latex/config.erb', mode: '-', binding: binding)
|
467
|
+
local_config_file = File.join(@basedir, 'layouts', 'config-local.tex.erb')
|
468
|
+
if File.exist?(local_config_file)
|
469
|
+
result << "%% BEGIN: config-local.tex.erb\n"
|
470
|
+
result << ReVIEW::Template.generate(path: 'layouts/config-local.tex.erb', mode: '-', binding: binding, template_dir: @basedir)
|
471
|
+
result << "%% END: config-local.tex.erb\n"
|
472
|
+
end
|
473
|
+
result
|
478
474
|
end
|
479
475
|
|
480
476
|
def template_content
|
481
|
-
|
477
|
+
template_dir = ReVIEW::Template::TEMPLATE_DIR
|
482
478
|
if @config.check_version('2', exception: false)
|
483
|
-
|
479
|
+
template_path = './latex-compat2/layout.tex.erb'
|
480
|
+
else
|
481
|
+
template_path = './latex/layout.tex.erb'
|
484
482
|
end
|
485
483
|
layout_file = File.join(@basedir, 'layouts', 'layout.tex.erb')
|
486
484
|
if File.exist?(layout_file)
|
487
|
-
|
485
|
+
template_dir = @basedir
|
486
|
+
template_path = 'layouts/layout.tex.erb'
|
488
487
|
end
|
489
|
-
|
488
|
+
ReVIEW::Template.generate(path: template_path, mode: '-', binding: binding, template_dir: template_dir)
|
490
489
|
end
|
491
490
|
|
492
491
|
def copy_sty(dirname, copybase, extname = 'sty')
|
@@ -498,26 +497,19 @@ module ReVIEW
|
|
498
497
|
Dir.open(dirname) do |dir|
|
499
498
|
dir.sort.each do |fname|
|
500
499
|
next unless File.extname(fname).downcase == '.' + extname
|
500
|
+
|
501
501
|
FileUtils.mkdir_p(copybase) unless Dir.exist?(copybase)
|
502
502
|
if extname == 'erb'
|
503
503
|
File.open(File.join(copybase, fname.sub(/\.erb\Z/, '')), 'w') do |f|
|
504
504
|
f.print erb_content(File.join(dirname, fname))
|
505
505
|
end
|
506
|
+
elsif @config['pdfmaker']['use_symlink']
|
507
|
+
FileUtils.ln_s(File.join(dirname, fname), copybase)
|
506
508
|
else
|
507
509
|
FileUtils.cp(File.join(dirname, fname), copybase)
|
508
510
|
end
|
509
511
|
end
|
510
512
|
end
|
511
513
|
end
|
512
|
-
|
513
|
-
def call_hook(hookname)
|
514
|
-
return if !@config['pdfmaker'].is_a?(Hash) || @config['pdfmaker'][hookname].nil?
|
515
|
-
hook = File.absolute_path(@config['pdfmaker'][hookname], @basedir)
|
516
|
-
if ENV['REVIEW_SAFE_MODE'].to_i & 1 > 0
|
517
|
-
warn 'hook configuration is prohibited in safe mode. ignored.'
|
518
|
-
else
|
519
|
-
system_or_raise(hook, Dir.pwd, @basedir)
|
520
|
-
end
|
521
|
-
end
|
522
514
|
end
|
523
515
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c) 2018-
|
1
|
+
# Copyright (c) 2018-2020 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,12 +42,12 @@ module ReVIEW
|
|
42
42
|
end
|
43
43
|
|
44
44
|
def builder_init_file
|
45
|
+
super
|
45
46
|
@section = 0
|
46
47
|
@subsection = 0
|
47
48
|
@subsubsection = 0
|
48
49
|
@subsubsubsection = 0
|
49
50
|
@blank_seen = true
|
50
|
-
@sec_counter = SecCounter.new(5, @chapter)
|
51
51
|
end
|
52
52
|
private :builder_init_file
|
53
53
|
|
@@ -74,7 +74,26 @@ module ReVIEW
|
|
74
74
|
private :blank
|
75
75
|
|
76
76
|
def result
|
77
|
-
@output.string
|
77
|
+
solve_nest(@output.string)
|
78
|
+
end
|
79
|
+
|
80
|
+
def solve_nest(s)
|
81
|
+
check_nest
|
82
|
+
lines = []
|
83
|
+
clevel = []
|
84
|
+
s.split("\n", -1).each do |l| # -1 means don't omit last "\n"
|
85
|
+
if l =~ /\A\x01→(dl|ul|ol)←\x01/
|
86
|
+
clevel.push($1)
|
87
|
+
lines.push("\x01→END←\x01")
|
88
|
+
elsif l =~ %r{\A\x01→/(dl|ul|ol)←\x01}
|
89
|
+
clevel.pop
|
90
|
+
lines.push("\x01→END←\x01")
|
91
|
+
else
|
92
|
+
lines.push("\t" * clevel.size + l)
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
lines.join("\n").gsub(/\n*\x01→END←\x01\n*/, "\n")
|
78
97
|
end
|
79
98
|
|
80
99
|
def headline(level, _label, caption)
|
@@ -118,7 +137,7 @@ module ReVIEW
|
|
118
137
|
|
119
138
|
def dd(lines)
|
120
139
|
split_paragraph(lines).each do |paragraph|
|
121
|
-
puts paragraph.
|
140
|
+
puts paragraph.delete("\n")
|
122
141
|
end
|
123
142
|
end
|
124
143
|
|
@@ -140,13 +159,19 @@ module ReVIEW
|
|
140
159
|
def list(lines, id, caption, lang = nil)
|
141
160
|
blank
|
142
161
|
begin
|
143
|
-
|
162
|
+
if caption_top?('list')
|
163
|
+
list_header(id, caption, lang)
|
164
|
+
blank
|
165
|
+
end
|
166
|
+
list_body(id, lines, lang)
|
167
|
+
unless caption_top?('list')
|
168
|
+
blank
|
169
|
+
list_header(id, caption, lang)
|
170
|
+
end
|
144
171
|
rescue KeyError
|
145
|
-
|
172
|
+
app_error "no such list: #{id}"
|
146
173
|
end
|
147
174
|
blank
|
148
|
-
list_body(id, lines, lang)
|
149
|
-
blank
|
150
175
|
end
|
151
176
|
|
152
177
|
def list_header(id, caption, _lang)
|
@@ -165,8 +190,13 @@ module ReVIEW
|
|
165
190
|
|
166
191
|
def base_block(_type, lines, caption = nil)
|
167
192
|
blank
|
168
|
-
|
193
|
+
if caption_top?('list') && caption.present?
|
194
|
+
puts compile_inline(caption)
|
195
|
+
end
|
169
196
|
puts lines.join("\n")
|
197
|
+
if !caption_top?('list') && caption.present?
|
198
|
+
puts compile_inline(caption)
|
199
|
+
end
|
170
200
|
blank
|
171
201
|
end
|
172
202
|
|
@@ -183,23 +213,34 @@ module ReVIEW
|
|
183
213
|
|
184
214
|
def emlistnum(lines, caption = nil, _lang = nil)
|
185
215
|
blank
|
186
|
-
|
216
|
+
if caption_top?('list')
|
217
|
+
puts compile_inline(caption) if caption.present?
|
218
|
+
end
|
187
219
|
lines.each_with_index do |line, i|
|
188
220
|
puts((i + 1).to_s.rjust(2) + ": #{line}")
|
189
221
|
end
|
222
|
+
unless caption_top?('list')
|
223
|
+
puts compile_inline(caption) if caption.present?
|
224
|
+
end
|
190
225
|
blank
|
191
226
|
end
|
192
227
|
|
193
228
|
def listnum(lines, id, caption, lang = nil)
|
194
229
|
blank
|
195
230
|
begin
|
196
|
-
|
231
|
+
if caption_top?('list')
|
232
|
+
list_header(id, caption, lang)
|
233
|
+
blank
|
234
|
+
end
|
235
|
+
listnum_body(lines, lang)
|
236
|
+
unless caption_top?('list')
|
237
|
+
blank
|
238
|
+
list_header(id, caption, lang)
|
239
|
+
end
|
197
240
|
rescue KeyError
|
198
|
-
|
241
|
+
app_error "no such list: #{id}"
|
199
242
|
end
|
200
243
|
blank
|
201
|
-
listnum_body(lines, lang)
|
202
|
-
blank
|
203
244
|
end
|
204
245
|
|
205
246
|
def listnum_body(lines, _lang)
|
@@ -228,8 +269,9 @@ module ReVIEW
|
|
228
269
|
|
229
270
|
def texequation(lines, id = nil, caption = '')
|
230
271
|
blank
|
231
|
-
texequation_header(id, caption)
|
272
|
+
texequation_header(id, caption) if caption_top?('equation')
|
232
273
|
puts lines.join("\n")
|
274
|
+
texequation_header(id, caption) unless caption_top?('equation')
|
233
275
|
blank
|
234
276
|
end
|
235
277
|
|
@@ -251,6 +293,10 @@ module ReVIEW
|
|
251
293
|
end
|
252
294
|
|
253
295
|
def table_header(id, caption)
|
296
|
+
unless caption_top?('table')
|
297
|
+
blank
|
298
|
+
end
|
299
|
+
|
254
300
|
if id.nil?
|
255
301
|
puts compile_inline(caption)
|
256
302
|
elsif get_chap
|
@@ -258,7 +304,10 @@ module ReVIEW
|
|
258
304
|
else
|
259
305
|
puts "#{I18n.t('table')}#{I18n.t('format_number_without_chapter', [@chapter.table(id).number])}#{I18n.t('caption_prefix_idgxml')}#{compile_inline(caption)}"
|
260
306
|
end
|
261
|
-
|
307
|
+
|
308
|
+
if caption_top?('table')
|
309
|
+
blank
|
310
|
+
end
|
262
311
|
end
|
263
312
|
|
264
313
|
def table_begin(_ncols)
|
@@ -288,7 +337,7 @@ module ReVIEW
|
|
288
337
|
def inline_fn(id)
|
289
338
|
" 注#{@chapter.footnote(id).number} "
|
290
339
|
rescue KeyError
|
291
|
-
|
340
|
+
app_error "unknown footnote: #{id}"
|
292
341
|
end
|
293
342
|
|
294
343
|
def compile_ruby(base, _ruby)
|
@@ -352,7 +401,7 @@ module ReVIEW
|
|
352
401
|
def inline_bib(id)
|
353
402
|
%Q(#{@chapter.bibpaper(id).number} )
|
354
403
|
rescue KeyError
|
355
|
-
|
404
|
+
app_error "unknown bib: #{id}"
|
356
405
|
end
|
357
406
|
|
358
407
|
def inline_hd_chap(chap, id)
|
@@ -363,7 +412,7 @@ module ReVIEW
|
|
363
412
|
I18n.t('hd_quote_without_number', compile_inline(chap.headline(id).caption))
|
364
413
|
end
|
365
414
|
rescue KeyError
|
366
|
-
|
415
|
+
app_error "unknown headline: #{id}"
|
367
416
|
end
|
368
417
|
|
369
418
|
def noindent
|
@@ -471,18 +520,22 @@ module ReVIEW
|
|
471
520
|
end
|
472
521
|
|
473
522
|
def note(lines, caption = nil)
|
523
|
+
check_nested_minicolumn
|
474
524
|
base_parablock('note', lines, caption)
|
475
525
|
end
|
476
526
|
|
477
527
|
def memo(lines, caption = nil)
|
528
|
+
check_nested_minicolumn
|
478
529
|
base_parablock('memo', lines, caption)
|
479
530
|
end
|
480
531
|
|
481
532
|
def tip(lines, caption = nil)
|
533
|
+
check_nested_minicolumn
|
482
534
|
base_parablock('tip', lines, caption)
|
483
535
|
end
|
484
536
|
|
485
537
|
def info(lines, caption = nil)
|
538
|
+
check_nested_minicolumn
|
486
539
|
base_parablock('info', lines, caption)
|
487
540
|
end
|
488
541
|
|
@@ -491,10 +544,12 @@ module ReVIEW
|
|
491
544
|
end
|
492
545
|
|
493
546
|
def best(lines, caption = nil)
|
547
|
+
check_nested_minicolumn
|
494
548
|
base_parablock('best', lines, caption)
|
495
549
|
end
|
496
550
|
|
497
551
|
def important(lines, caption = nil)
|
552
|
+
check_nested_minicolumn
|
498
553
|
base_parablock('important', lines, caption)
|
499
554
|
end
|
500
555
|
|
@@ -503,6 +558,7 @@ module ReVIEW
|
|
503
558
|
end
|
504
559
|
|
505
560
|
def caution(lines, caption = nil)
|
561
|
+
check_nested_minicolumn
|
506
562
|
base_parablock('caution', lines, caption)
|
507
563
|
end
|
508
564
|
|
@@ -515,6 +571,7 @@ module ReVIEW
|
|
515
571
|
end
|
516
572
|
|
517
573
|
def notice(lines, caption = nil)
|
574
|
+
check_nested_minicolumn
|
518
575
|
base_parablock('notice', lines, caption)
|
519
576
|
end
|
520
577
|
|
@@ -543,11 +600,30 @@ module ReVIEW
|
|
543
600
|
end
|
544
601
|
|
545
602
|
def warning(lines, caption = nil)
|
603
|
+
check_nested_minicolumn
|
546
604
|
base_parablock('warning', lines, caption)
|
547
605
|
end
|
548
606
|
|
549
607
|
alias_method :box, :insn
|
550
608
|
|
609
|
+
CAPTION_TITLES.each do |name|
|
610
|
+
class_eval %Q(
|
611
|
+
def #{name}_begin(caption = nil)
|
612
|
+
check_nested_minicolumn
|
613
|
+
@doc_status[:minicolumn] = '#{name}'
|
614
|
+
blank
|
615
|
+
if caption.present?
|
616
|
+
puts compile_inline(caption)
|
617
|
+
end
|
618
|
+
end
|
619
|
+
|
620
|
+
def #{name}_end
|
621
|
+
blank
|
622
|
+
@doc_status[:minicolumn] = nil
|
623
|
+
end
|
624
|
+
), __FILE__, __LINE__ - 14
|
625
|
+
end
|
626
|
+
|
551
627
|
def indepimage(_lines, _id, caption = nil, _metric = nil)
|
552
628
|
blank
|
553
629
|
puts "図 #{compile_inline(caption)}" if caption.present?
|
@@ -571,10 +647,18 @@ module ReVIEW
|
|
571
647
|
''
|
572
648
|
end
|
573
649
|
|
650
|
+
def inline_ins(str)
|
651
|
+
str
|
652
|
+
end
|
653
|
+
|
574
654
|
def inline_del(_str)
|
575
655
|
''
|
576
656
|
end
|
577
657
|
|
658
|
+
def inline_tcy(str)
|
659
|
+
str
|
660
|
+
end
|
661
|
+
|
578
662
|
def inline_br(_str)
|
579
663
|
"\n"
|
580
664
|
end
|
@@ -583,7 +667,7 @@ module ReVIEW
|
|
583
667
|
str
|
584
668
|
end
|
585
669
|
|
586
|
-
def inline_chap(id)
|
670
|
+
def inline_chap(id) # rubocop:disable Lint/UselessMethodDefinition
|
587
671
|
# "「第#{super}章 #{inline_title(id)}」"
|
588
672
|
# "第#{super}章"
|
589
673
|
super
|
@@ -596,7 +680,7 @@ module ReVIEW
|
|
596
680
|
if @book.config['chapref']
|
597
681
|
chs2 = @book.config['chapref'].split(',')
|
598
682
|
if chs2.size != 3
|
599
|
-
|
683
|
+
app_error '--chapsplitter must have exactly 3 parameters with comma.'
|
600
684
|
end
|
601
685
|
chs = chs2
|
602
686
|
end
|
@@ -610,7 +694,7 @@ module ReVIEW
|
|
610
694
|
end
|
611
695
|
end
|
612
696
|
rescue KeyError
|
613
|
-
|
697
|
+
app_error "unknown chapter: #{id}"
|
614
698
|
end
|
615
699
|
|
616
700
|
def source(lines, caption = nil, _lang = nil)
|