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
data/lib/review/init.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#
|
2
|
-
# Copyright (c) 2018-
|
2
|
+
# Copyright (c) 2018-2021 Masanori Kado, Masayoshi Takahashi, Kenshi Muto
|
3
3
|
#
|
4
4
|
# This program is free software.
|
5
5
|
# You can distribute or modify this program under the terms of
|
@@ -114,9 +114,7 @@ module ReVIEW
|
|
114
114
|
exit 1
|
115
115
|
end
|
116
116
|
|
117
|
-
|
118
|
-
|
119
|
-
initdir
|
117
|
+
File.expand_path(args[0])
|
120
118
|
end
|
121
119
|
|
122
120
|
def generate_dir(dir)
|
@@ -135,8 +133,7 @@ module ReVIEW
|
|
135
133
|
end
|
136
134
|
|
137
135
|
def generate_catalog_file(dir)
|
138
|
-
File.
|
139
|
-
file.write <<-EOS
|
136
|
+
File.write(File.join(dir, 'catalog.yml'), <<-EOS)
|
140
137
|
PREDEF:
|
141
138
|
|
142
139
|
CHAPS:
|
@@ -147,7 +144,6 @@ APPENDIX:
|
|
147
144
|
POSTDEF:
|
148
145
|
|
149
146
|
EOS
|
150
|
-
end
|
151
147
|
end
|
152
148
|
|
153
149
|
def generate_images_dir(dir)
|
@@ -213,9 +209,9 @@ EOT
|
|
213
209
|
FileUtils.cp(Dir.glob(File.join(tdir, '*.*')), texmacrodir)
|
214
210
|
|
215
211
|
if @template == 'review-jsbook'
|
216
|
-
# provide jsbook from vendor/. current version is
|
212
|
+
# provide jsbook from vendor/. current version is 2020/10/09
|
217
213
|
FileUtils.cp(File.join(@review_dir, 'vendor/jsclasses/jsbook.cls'), File.join(texmacrodir, 'jsbook.cls'))
|
218
|
-
# provide gentombow from vendor/. current version is
|
214
|
+
# provide gentombow from vendor/. current version is 2019/07/21 v0.9k
|
219
215
|
FileUtils.cp(File.join(@review_dir, 'vendor/gentombow/gentombow.sty'), File.join(texmacrodir, 'gentombow.sty'))
|
220
216
|
end
|
221
217
|
end
|
@@ -223,13 +219,11 @@ EOT
|
|
223
219
|
def generate_rakefile(dir)
|
224
220
|
FileUtils.mkdir_p(File.join(dir, 'lib/tasks'))
|
225
221
|
|
226
|
-
File.
|
227
|
-
file.write <<-EOS
|
222
|
+
File.write(File.join(dir, 'Rakefile'), <<-EOS)
|
228
223
|
Dir.glob('lib/tasks/*.rake').sort.each do |file|
|
229
224
|
load(file)
|
230
225
|
end
|
231
226
|
EOS
|
232
|
-
end
|
233
227
|
|
234
228
|
FileUtils.cp(File.join(@review_dir, 'samples/sample-book/src/lib/tasks/review.rake'),
|
235
229
|
File.join(dir, 'lib/tasks/review.rake'))
|
@@ -240,14 +234,12 @@ EOS
|
|
240
234
|
end
|
241
235
|
|
242
236
|
def generate_gemfile(dir)
|
243
|
-
File.
|
244
|
-
file.write <<-EOS
|
237
|
+
File.write(File.join(dir, 'Gemfile'), <<-EOS)
|
245
238
|
source 'https://rubygems.org'
|
246
239
|
|
247
240
|
gem 'rake'
|
248
241
|
gem 'review', '#{ReVIEW::VERSION}'
|
249
242
|
EOS
|
250
|
-
end
|
251
243
|
end
|
252
244
|
|
253
245
|
def generate_doc(dir)
|
@@ -294,7 +286,7 @@ EOS
|
|
294
286
|
begin
|
295
287
|
Zip::File.open(filename) do |zip|
|
296
288
|
zip.each do |entry|
|
297
|
-
fname = entry.name.
|
289
|
+
fname = entry.name.tr('\\', '/')
|
298
290
|
if fname =~ /__MACOSX/ || fname =~ /\.DS_Store/
|
299
291
|
next
|
300
292
|
end
|
@@ -342,7 +334,7 @@ EOS
|
|
342
334
|
# validation
|
343
335
|
if @web_result
|
344
336
|
@web_result.each do |s|
|
345
|
-
if s !~ /\A[a-z0-9=_
|
337
|
+
if s !~ /\A[a-z0-9=_,.-]*\Z/i
|
346
338
|
@web_result = nil
|
347
339
|
break
|
348
340
|
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
# Copyright (c) 2021 Kenshi Muto
|
2
|
+
#
|
3
|
+
# This program is free software.
|
4
|
+
# You can distribute or modify this program under the terms of
|
5
|
+
# the GNU LGPL, Lesser General Public License version 2.1.
|
6
|
+
# For details of the GNU LGPL, see the file "COPYING".
|
7
|
+
#
|
8
|
+
require 'review/logger'
|
9
|
+
module ReVIEW
|
10
|
+
class LaTeXBox
|
11
|
+
def initialize
|
12
|
+
@logger = ReVIEW.logger
|
13
|
+
end
|
14
|
+
|
15
|
+
def tcbox(config)
|
16
|
+
ret = ''
|
17
|
+
|
18
|
+
%w[column note memo tip info warning important caution notice].each do |name|
|
19
|
+
if config['pdfmaker'].nil? || config['pdfmaker']['boxsetting'].nil? ||
|
20
|
+
config['pdfmaker']['boxsetting'][name].nil? ||
|
21
|
+
config['pdfmaker']['boxsetting'][name]['style'].nil?
|
22
|
+
next
|
23
|
+
end
|
24
|
+
|
25
|
+
options = '[]'
|
26
|
+
options_with_caption = '[]'
|
27
|
+
if config['pdfmaker']['boxsetting'][name]['options']
|
28
|
+
options = "[#{config['pdfmaker']['boxsetting'][name]['options']}]"
|
29
|
+
options_with_caption = options
|
30
|
+
end
|
31
|
+
|
32
|
+
if config['pdfmaker']['boxsetting'][name]['options_with_caption']
|
33
|
+
options_with_caption = "[#{config['pdfmaker']['boxsetting'][name]['options_with_caption']}]"
|
34
|
+
end
|
35
|
+
|
36
|
+
ret << <<EOT
|
37
|
+
\\renewenvironment{review#{name}}[1][]{%
|
38
|
+
\\csdef{rv@tmp@withcaption}{true}
|
39
|
+
\\notblank{##1}{
|
40
|
+
\\begin{rv@#{config['pdfmaker']['boxsetting'][name]['style']}@caption}{##1}#{options_with_caption}
|
41
|
+
}{
|
42
|
+
\\csundef{rv@tmp@withcaption}
|
43
|
+
\\begin{rv@#{config['pdfmaker']['boxsetting'][name]['style']}@nocaption}#{options}
|
44
|
+
}
|
45
|
+
}{
|
46
|
+
\\ifcsdef{rv@tmp@withcaption}{
|
47
|
+
\\end{rv@#{config['pdfmaker']['boxsetting'][name]['style']}@caption}
|
48
|
+
}{
|
49
|
+
\\end{rv@#{config['pdfmaker']['boxsetting'][name]['style']}@nocaption}
|
50
|
+
}
|
51
|
+
}
|
52
|
+
EOT
|
53
|
+
end
|
54
|
+
|
55
|
+
ret
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
data/lib/review/latexbuilder.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Copyright (c) 2002-2007 Minero Aoki
|
2
2
|
# 2008-2009 Minero Aoki, Kenshi Muto
|
3
|
-
# 2010-
|
3
|
+
# 2010-2021 Minero Aoki, Kenshi Muto, TAKAHASHI Masayoshi
|
4
4
|
#
|
5
5
|
# This program is free software.
|
6
6
|
# You can distribute or modify this program under the terms of
|
@@ -28,6 +28,7 @@ module ReVIEW
|
|
28
28
|
end
|
29
29
|
|
30
30
|
def builder_init_file
|
31
|
+
super
|
31
32
|
@chapter.book.image_types = %w[.ai .eps .pdf .tif .tiff .png .bmp .jpg .jpeg .gif]
|
32
33
|
@blank_needed = false
|
33
34
|
@latex_tsize = nil
|
@@ -35,7 +36,6 @@ module ReVIEW
|
|
35
36
|
@cellwidth = nil
|
36
37
|
@ol_num = nil
|
37
38
|
@first_line_num = nil
|
38
|
-
@sec_counter = SecCounter.new(5, @chapter)
|
39
39
|
@foottext = {}
|
40
40
|
setup_index
|
41
41
|
initialize_metachars(@book.config['texcommand'])
|
@@ -51,6 +51,7 @@ module ReVIEW
|
|
51
51
|
@index_db = load_idxdb(@book.config['pdfmaker']['makeindex_dic'])
|
52
52
|
end
|
53
53
|
return true unless @book.config['pdfmaker']['makeindex_mecab']
|
54
|
+
|
54
55
|
begin
|
55
56
|
begin
|
56
57
|
require 'MeCab'
|
@@ -60,7 +61,7 @@ module ReVIEW
|
|
60
61
|
require 'nkf'
|
61
62
|
@index_mecab = MeCab::Tagger.new(@book.config['pdfmaker']['makeindex_mecab_opts'])
|
62
63
|
rescue LoadError
|
63
|
-
warn 'not found MeCab'
|
64
|
+
warn 'not found MeCab', location: location
|
64
65
|
end
|
65
66
|
end
|
66
67
|
|
@@ -100,7 +101,21 @@ module ReVIEW
|
|
100
101
|
if @chapter.is_a?(ReVIEW::Book::Part) && !@book.config.check_version('2', exception: false)
|
101
102
|
puts '\end{reviewpart}'
|
102
103
|
end
|
103
|
-
@output.string
|
104
|
+
solve_nest(@output.string)
|
105
|
+
end
|
106
|
+
|
107
|
+
def solve_nest(s)
|
108
|
+
check_nest
|
109
|
+
s.gsub("\\end{description}\n\n\x01→dl←\x01\n", "\n").
|
110
|
+
gsub("\x01→/dl←\x01", "\\end{description}←END\x01").
|
111
|
+
gsub("\\end{itemize}\n\n\x01→ul←\x01\n", "\n").
|
112
|
+
gsub("\x01→/ul←\x01", "\\end{itemize}←END\x01").
|
113
|
+
gsub("\\end{enumerate}\n\n\x01→ol←\x01\n", "\n").
|
114
|
+
gsub("\x01→/ol←\x01", "\\end{enumerate}←END\x01").
|
115
|
+
gsub("\\end{description}←END\x01\n\n\\begin{description}", '').
|
116
|
+
gsub("\\end{itemize}←END\x01\n\n\\begin{itemize}", '').
|
117
|
+
gsub("\\end{enumerate}←END\x01\n\n\\begin{enumerate}", '').
|
118
|
+
gsub("←END\x01", '')
|
104
119
|
end
|
105
120
|
|
106
121
|
HEADLINE = {
|
@@ -141,7 +156,7 @@ module ReVIEW
|
|
141
156
|
puts macro('label', label) if label
|
142
157
|
end
|
143
158
|
rescue
|
144
|
-
|
159
|
+
app_error "unknown level: #{level}"
|
145
160
|
end
|
146
161
|
|
147
162
|
def nonum_begin(level, _label, caption)
|
@@ -166,10 +181,10 @@ module ReVIEW
|
|
166
181
|
end
|
167
182
|
|
168
183
|
def nodisp_begin(level, _label, caption)
|
169
|
-
if @output.pos
|
170
|
-
blank
|
171
|
-
else
|
184
|
+
if @output.pos == 0
|
172
185
|
puts macro('clearpage')
|
186
|
+
else
|
187
|
+
blank
|
173
188
|
end
|
174
189
|
puts macro('addcontentsline', 'toc', HEADLINE[level], compile_inline(caption))
|
175
190
|
# FIXME: headings
|
@@ -212,7 +227,53 @@ module ReVIEW
|
|
212
227
|
@doc_status[:column] = nil
|
213
228
|
end
|
214
229
|
|
230
|
+
def common_block_begin(type, caption = nil)
|
231
|
+
check_nested_minicolumn
|
232
|
+
if @book.config.check_version('2', exception: false)
|
233
|
+
type = 'minicolumn'
|
234
|
+
end
|
235
|
+
|
236
|
+
@doc_status[:minicolumn] = type
|
237
|
+
print "\\begin{review#{type}}"
|
238
|
+
|
239
|
+
@doc_status[:caption] = true
|
240
|
+
if @book.config.check_version('2', exception: false)
|
241
|
+
puts
|
242
|
+
if caption.present?
|
243
|
+
puts "\\reviewminicolumntitle{#{compile_inline(caption)}}"
|
244
|
+
end
|
245
|
+
else
|
246
|
+
if caption.present?
|
247
|
+
print "[#{compile_inline(caption)}]"
|
248
|
+
end
|
249
|
+
puts
|
250
|
+
end
|
251
|
+
@doc_status[:caption] = nil
|
252
|
+
end
|
253
|
+
|
254
|
+
def common_block_end(type)
|
255
|
+
if @book.config.check_version('2', exception: false)
|
256
|
+
type = 'minicolumn'
|
257
|
+
end
|
258
|
+
|
259
|
+
puts "\\end{review#{type}}"
|
260
|
+
@doc_status[:minicolumn] = nil
|
261
|
+
end
|
262
|
+
|
263
|
+
CAPTION_TITLES.each do |name|
|
264
|
+
class_eval %Q(
|
265
|
+
def #{name}_begin(caption = nil)
|
266
|
+
common_block_begin('#{name}', caption)
|
267
|
+
end
|
268
|
+
|
269
|
+
def #{name}_end
|
270
|
+
common_block_end('#{name}')
|
271
|
+
end
|
272
|
+
), __FILE__, __LINE__ - 8
|
273
|
+
end
|
274
|
+
|
215
275
|
def captionblock(type, lines, caption)
|
276
|
+
check_nested_minicolumn
|
216
277
|
if @book.config.check_version('2', exception: false)
|
217
278
|
type = 'minicolumn'
|
218
279
|
end
|
@@ -274,6 +335,7 @@ module ReVIEW
|
|
274
335
|
blank
|
275
336
|
puts '\begin{enumerate}'
|
276
337
|
return true unless @ol_num
|
338
|
+
|
277
339
|
puts "\\setcounter{enumi}{#{@ol_num - 1}}"
|
278
340
|
@ol_num = nil
|
279
341
|
end
|
@@ -403,25 +465,31 @@ module ReVIEW
|
|
403
465
|
|
404
466
|
def common_code_block(id, lines, command, caption, _lang)
|
405
467
|
@doc_status[:caption] = true
|
468
|
+
captionstr = nil
|
406
469
|
unless @book.config.check_version('2', exception: false)
|
407
470
|
puts '\\begin{reviewlistblock}'
|
408
471
|
end
|
409
472
|
if caption.present?
|
410
473
|
if command =~ /emlist/ || command =~ /cmd/ || command =~ /source/
|
411
|
-
|
474
|
+
captionstr = macro(command + 'caption', compile_inline(caption))
|
412
475
|
else
|
413
476
|
begin
|
414
477
|
if get_chap.nil?
|
415
|
-
|
478
|
+
captionstr = macro('reviewlistcaption', "#{I18n.t('list')}#{I18n.t('format_number_header_without_chapter', [@chapter.list(id).number])}#{I18n.t('caption_prefix')}#{compile_inline(caption)}")
|
416
479
|
else
|
417
|
-
|
480
|
+
captionstr = macro('reviewlistcaption', "#{I18n.t('list')}#{I18n.t('format_number_header', [get_chap, @chapter.list(id).number])}#{I18n.t('caption_prefix')}#{compile_inline(caption)}")
|
418
481
|
end
|
419
482
|
rescue KeyError
|
420
|
-
|
483
|
+
app_error "no such list: #{id}"
|
421
484
|
end
|
422
485
|
end
|
423
486
|
end
|
424
487
|
@doc_status[:caption] = nil
|
488
|
+
|
489
|
+
if caption_top?('list') && captionstr
|
490
|
+
puts captionstr
|
491
|
+
end
|
492
|
+
|
425
493
|
body = ''
|
426
494
|
lines.each_with_index do |line, idx|
|
427
495
|
body.concat(yield(line, idx))
|
@@ -429,6 +497,11 @@ module ReVIEW
|
|
429
497
|
puts macro('begin', command)
|
430
498
|
print body
|
431
499
|
puts macro('end', command)
|
500
|
+
|
501
|
+
if !caption_top?('list') && captionstr
|
502
|
+
puts captionstr
|
503
|
+
end
|
504
|
+
|
432
505
|
unless @book.config.check_version('2', exception: false)
|
433
506
|
puts '\\end{reviewlistblock}'
|
434
507
|
end
|
@@ -486,6 +559,7 @@ module ReVIEW
|
|
486
559
|
if @book.config['pdfmaker']['use_original_image_size'] && s.empty? && !metric.present?
|
487
560
|
return ' ' # pass empty to \reviewincludegraphics
|
488
561
|
end
|
562
|
+
|
489
563
|
s
|
490
564
|
end
|
491
565
|
|
@@ -493,6 +567,7 @@ module ReVIEW
|
|
493
567
|
if @book.config['pdfmaker']['image_scale2width'] && str =~ /\Ascale=([\d.]+)\Z/
|
494
568
|
return "width=#{$1}\\maxwidth"
|
495
569
|
end
|
570
|
+
|
496
571
|
str
|
497
572
|
end
|
498
573
|
|
@@ -500,11 +575,25 @@ module ReVIEW
|
|
500
575
|
array.join(',')
|
501
576
|
end
|
502
577
|
|
503
|
-
def image_image(id, caption, metric)
|
578
|
+
def image_image(id, caption = '', metric = nil)
|
579
|
+
captionstr = nil
|
580
|
+
@doc_status[:caption] = true
|
581
|
+
if @book.config.check_version('2', exception: false)
|
582
|
+
captionstr = macro('caption', compile_inline(caption)) + "\n"
|
583
|
+
else
|
584
|
+
captionstr = macro('reviewimagecaption', compile_inline(caption)) + "\n"
|
585
|
+
end
|
586
|
+
captionstr << macro('label', image_label(id))
|
587
|
+
@doc_status[:caption] = nil
|
588
|
+
|
504
589
|
metrics = parse_metric('latex', metric)
|
505
590
|
# image is always bound here
|
506
591
|
puts "\\begin{reviewimage}%%#{id}"
|
507
592
|
|
593
|
+
if caption_top?('image')
|
594
|
+
puts captionstr
|
595
|
+
end
|
596
|
+
|
508
597
|
command = 'reviewincludegraphics'
|
509
598
|
if @book.config.check_version('2', exception: false)
|
510
599
|
command = 'includegraphics'
|
@@ -515,32 +604,28 @@ module ReVIEW
|
|
515
604
|
else
|
516
605
|
puts "\\#{command}[width=\\maxwidth]{#{@chapter.image(id).path}}"
|
517
606
|
end
|
518
|
-
@doc_status[:caption] = true
|
519
607
|
|
520
|
-
|
521
|
-
puts
|
522
|
-
else
|
523
|
-
puts macro('reviewimagecaption', compile_inline(caption)) if caption.present?
|
608
|
+
unless caption_top?('image')
|
609
|
+
puts captionstr
|
524
610
|
end
|
525
|
-
|
526
|
-
puts macro('label', image_label(id))
|
611
|
+
|
527
612
|
puts '\end{reviewimage}'
|
528
613
|
end
|
529
614
|
|
530
615
|
def image_dummy(id, caption, lines)
|
531
|
-
warn "image not bound: #{id}"
|
616
|
+
warn "image not bound: #{id}", location: location
|
532
617
|
puts '\begin{reviewdummyimage}'
|
533
|
-
|
534
|
-
puts "--[[path = #{id} (#{existence(id)})]]--"
|
618
|
+
puts escape("--[[path = #{id} (#{existence(id)})]]--")
|
535
619
|
lines.each do |line|
|
620
|
+
puts "\n"
|
536
621
|
puts detab(line.rstrip)
|
537
622
|
end
|
538
623
|
puts macro('label', image_label(id))
|
539
624
|
@doc_status[:caption] = true
|
540
625
|
if @book.config.check_version('2', exception: false)
|
541
626
|
puts macro('caption', compile_inline(caption)) if caption.present?
|
542
|
-
|
543
|
-
puts macro('reviewimagecaption', compile_inline(caption))
|
627
|
+
elsif caption.present?
|
628
|
+
puts macro('reviewimagecaption', compile_inline(caption))
|
544
629
|
end
|
545
630
|
@doc_status[:caption] = nil
|
546
631
|
puts '\end{reviewdummyimage}'
|
@@ -578,7 +663,8 @@ module ReVIEW
|
|
578
663
|
end
|
579
664
|
private :bib_label
|
580
665
|
|
581
|
-
def column_label(id, chapter =
|
666
|
+
def column_label(id, chapter = nil)
|
667
|
+
chapter ||= @chapter
|
582
668
|
filename = chapter.id
|
583
669
|
num = chapter.column(id).number
|
584
670
|
"column:#{filename}:#{num}"
|
@@ -588,9 +674,21 @@ module ReVIEW
|
|
588
674
|
def indepimage(lines, id, caption = nil, metric = nil)
|
589
675
|
metrics = parse_metric('latex', metric)
|
590
676
|
|
677
|
+
captionstr = nil
|
678
|
+
if caption.present?
|
679
|
+
@doc_status[:caption] = true
|
680
|
+
captionstr = macro('reviewindepimagecaption',
|
681
|
+
%Q(#{I18n.t('numberless_image')}#{I18n.t('caption_prefix')}#{compile_inline(caption)}))
|
682
|
+
@doc_status[:caption] = nil
|
683
|
+
end
|
684
|
+
|
591
685
|
if @chapter.image(id).path
|
592
686
|
puts "\\begin{reviewimage}%%#{id}"
|
593
687
|
|
688
|
+
if caption_top?('image') && captionstr
|
689
|
+
puts captionstr
|
690
|
+
end
|
691
|
+
|
594
692
|
command = 'reviewincludegraphics'
|
595
693
|
if @book.config.check_version('2', exception: false)
|
596
694
|
command = 'includegraphics'
|
@@ -602,20 +700,18 @@ module ReVIEW
|
|
602
700
|
puts "\\#{command}[width=\\maxwidth]{#{@chapter.image(id).path}}"
|
603
701
|
end
|
604
702
|
else
|
605
|
-
warn "image not bound: #{id}"
|
703
|
+
warn "image not bound: #{id}", location: location
|
606
704
|
puts '\begin{reviewdummyimage}'
|
607
|
-
puts "--[[path = #{id} (#{existence(id)})]]--"
|
705
|
+
puts escape("--[[path = #{escape(id)} (#{existence(id)})]]--")
|
608
706
|
lines.each do |line|
|
707
|
+
puts "\n"
|
609
708
|
puts detab(line.rstrip)
|
610
709
|
end
|
611
710
|
end
|
612
711
|
|
613
|
-
|
614
|
-
|
615
|
-
puts macro('reviewindepimagecaption',
|
616
|
-
%Q(#{I18n.t('numberless_image')}#{I18n.t('caption_prefix')}#{compile_inline(caption)}))
|
712
|
+
if !caption_top?('image') && captionstr
|
713
|
+
puts captionstr
|
617
714
|
end
|
618
|
-
@doc_status[:caption] = nil
|
619
715
|
|
620
716
|
if @chapter.image(id).path
|
621
717
|
puts '\end{reviewimage}'
|
@@ -637,14 +733,19 @@ module ReVIEW
|
|
637
733
|
|
638
734
|
sepidx, rows = parse_table_rows(lines)
|
639
735
|
begin
|
640
|
-
|
736
|
+
if caption_top?('table') && caption.present?
|
737
|
+
table_header(id, caption)
|
738
|
+
end
|
641
739
|
rescue KeyError
|
642
|
-
|
740
|
+
app_error "no such table: #{id}"
|
643
741
|
end
|
644
742
|
table_begin(rows.first.size)
|
645
743
|
table_rows(sepidx, rows)
|
646
744
|
table_end
|
647
745
|
if caption.present?
|
746
|
+
unless caption_top?('table')
|
747
|
+
table_header(id, caption)
|
748
|
+
end
|
648
749
|
puts '\end{table}'
|
649
750
|
end
|
650
751
|
blank
|
@@ -721,7 +822,7 @@ module ReVIEW
|
|
721
822
|
ret = []
|
722
823
|
s = ''
|
723
824
|
brace = nil
|
724
|
-
size.
|
825
|
+
size.chars.each do |ch|
|
725
826
|
case ch
|
726
827
|
when '|'
|
727
828
|
next
|
@@ -734,15 +835,11 @@ module ReVIEW
|
|
734
835
|
ret << s
|
735
836
|
s = ''
|
736
837
|
else
|
737
|
-
if brace
|
838
|
+
if brace || s.empty?
|
738
839
|
s << ch
|
739
840
|
else
|
740
|
-
|
741
|
-
|
742
|
-
else
|
743
|
-
ret << s
|
744
|
-
s = ch
|
745
|
-
end
|
841
|
+
ret << s
|
842
|
+
s = ch
|
746
843
|
end
|
747
844
|
end
|
748
845
|
end
|
@@ -802,25 +899,32 @@ module ReVIEW
|
|
802
899
|
|
803
900
|
def imgtable(lines, id, caption = nil, metric = nil)
|
804
901
|
unless @chapter.image_bound?(id)
|
805
|
-
warn "image not bound: #{id}"
|
902
|
+
warn "image not bound: #{id}", location: location
|
806
903
|
image_dummy(id, caption, lines)
|
807
904
|
return
|
808
905
|
end
|
809
906
|
|
907
|
+
captionstr = nil
|
810
908
|
begin
|
811
909
|
if caption.present?
|
812
910
|
puts "\\begin{table}[h]%%#{id}"
|
813
911
|
@doc_status[:caption] = true
|
814
|
-
|
912
|
+
captionstr = macro('reviewimgtablecaption', compile_inline(caption))
|
815
913
|
@doc_status[:caption] = nil
|
914
|
+
if caption_top?('table')
|
915
|
+
puts captionstr
|
916
|
+
end
|
816
917
|
end
|
817
918
|
puts macro('label', table_label(id))
|
818
919
|
rescue ReVIEW::KeyError
|
819
|
-
|
920
|
+
app_error "no such table: #{id}"
|
820
921
|
end
|
821
922
|
imgtable_image(id, caption, metric)
|
822
923
|
|
823
924
|
if caption.present?
|
925
|
+
unless caption_top?('table')
|
926
|
+
puts captionstr
|
927
|
+
end
|
824
928
|
puts '\end{table}'
|
825
929
|
end
|
826
930
|
blank
|
@@ -860,22 +964,31 @@ module ReVIEW
|
|
860
964
|
|
861
965
|
def texequation(lines, id = nil, caption = '')
|
862
966
|
blank
|
967
|
+
captionstr = nil
|
863
968
|
|
864
969
|
if id
|
865
970
|
puts macro('begin', 'reviewequationblock')
|
866
971
|
if get_chap.nil?
|
867
|
-
|
972
|
+
captionstr = macro('reviewequationcaption', "#{I18n.t('equation')}#{I18n.t('format_number_header_without_chapter', [@chapter.equation(id).number])}#{I18n.t('caption_prefix')}#{compile_inline(caption)}")
|
868
973
|
else
|
869
|
-
|
974
|
+
captionstr = macro('reviewequationcaption', "#{I18n.t('equation')}#{I18n.t('format_number_header', [get_chap, @chapter.equation(id).number])}#{I18n.t('caption_prefix')}#{compile_inline(caption)}")
|
870
975
|
end
|
871
976
|
end
|
872
977
|
|
978
|
+
if caption_top?('equation') && captionstr
|
979
|
+
puts captionstr
|
980
|
+
end
|
981
|
+
|
873
982
|
puts macro('begin', 'equation*')
|
874
983
|
lines.each do |line|
|
875
984
|
puts line
|
876
985
|
end
|
877
986
|
puts macro('end', 'equation*')
|
878
987
|
|
988
|
+
if !caption_top?('equation') && captionstr
|
989
|
+
puts captionstr
|
990
|
+
end
|
991
|
+
|
879
992
|
if id
|
880
993
|
puts macro('end', 'reviewequationblock')
|
881
994
|
end
|
@@ -895,6 +1008,7 @@ module ReVIEW
|
|
895
1008
|
|
896
1009
|
def direct(lines, fmt)
|
897
1010
|
return unless fmt == 'latex'
|
1011
|
+
|
898
1012
|
lines.each do |line|
|
899
1013
|
puts line
|
900
1014
|
end
|
@@ -902,6 +1016,7 @@ module ReVIEW
|
|
902
1016
|
|
903
1017
|
def comment(lines, comment = nil)
|
904
1018
|
return true unless @book.config['draft']
|
1019
|
+
|
905
1020
|
lines ||= []
|
906
1021
|
unless comment.blank?
|
907
1022
|
lines.unshift(escape(comment))
|
@@ -933,35 +1048,35 @@ module ReVIEW
|
|
933
1048
|
def inline_chapref(id)
|
934
1049
|
title = super
|
935
1050
|
if @book.config['chapterlink']
|
936
|
-
"\\
|
1051
|
+
"\\reviewchapref{#{title}}{chap:#{id}}"
|
937
1052
|
else
|
938
1053
|
title
|
939
1054
|
end
|
940
1055
|
rescue KeyError
|
941
|
-
|
1056
|
+
app_error "unknown chapter: #{id}"
|
942
1057
|
nofunc_text("[UnknownChapter:#{id}]")
|
943
1058
|
end
|
944
1059
|
|
945
1060
|
def inline_chap(id)
|
946
1061
|
if @book.config['chapterlink']
|
947
|
-
"\\
|
1062
|
+
"\\reviewchapref{#{@book.chapter_index.number(id)}}{chap:#{id}}"
|
948
1063
|
else
|
949
1064
|
@book.chapter_index.number(id)
|
950
1065
|
end
|
951
1066
|
rescue KeyError
|
952
|
-
|
1067
|
+
app_error "unknown chapter: #{id}"
|
953
1068
|
nofunc_text("[UnknownChapter:#{id}]")
|
954
1069
|
end
|
955
1070
|
|
956
1071
|
def inline_title(id)
|
957
1072
|
title = super
|
958
1073
|
if @book.config['chapterlink']
|
959
|
-
"\\
|
1074
|
+
"\\reviewchapref{#{title}}{chap:#{id}}"
|
960
1075
|
else
|
961
1076
|
title
|
962
1077
|
end
|
963
1078
|
rescue KeyError
|
964
|
-
|
1079
|
+
app_error "unknown chapter: #{id}"
|
965
1080
|
nofunc_text("[UnknownChapter:#{id}]")
|
966
1081
|
end
|
967
1082
|
|
@@ -978,7 +1093,7 @@ module ReVIEW
|
|
978
1093
|
macro('reviewlistref', I18n.t('format_number', [get_chap(chapter), chapter.list(id).number]))
|
979
1094
|
end
|
980
1095
|
rescue KeyError
|
981
|
-
|
1096
|
+
app_error "unknown list: #{id}"
|
982
1097
|
end
|
983
1098
|
|
984
1099
|
def inline_table(id)
|
@@ -989,7 +1104,7 @@ module ReVIEW
|
|
989
1104
|
macro('reviewtableref', I18n.t('format_number', [get_chap(chapter), chapter.table(id).number]), table_label(id, chapter))
|
990
1105
|
end
|
991
1106
|
rescue KeyError
|
992
|
-
|
1107
|
+
app_error "unknown table: #{id}"
|
993
1108
|
end
|
994
1109
|
|
995
1110
|
def inline_img(id)
|
@@ -1000,7 +1115,7 @@ module ReVIEW
|
|
1000
1115
|
macro('reviewimageref', I18n.t('format_number', [get_chap(chapter), chapter.image(id).number]), image_label(id, chapter))
|
1001
1116
|
end
|
1002
1117
|
rescue KeyError
|
1003
|
-
|
1118
|
+
app_error "unknown image: #{id}"
|
1004
1119
|
end
|
1005
1120
|
|
1006
1121
|
def inline_eq(id)
|
@@ -1011,13 +1126,13 @@ module ReVIEW
|
|
1011
1126
|
macro('reviewequationref', I18n.t('format_number', [get_chap(chapter), chapter.equation(id).number]))
|
1012
1127
|
end
|
1013
1128
|
rescue KeyError
|
1014
|
-
|
1129
|
+
app_error "unknown equation: #{id}"
|
1015
1130
|
end
|
1016
1131
|
|
1017
1132
|
def footnote(id, content)
|
1018
1133
|
if @book.config['footnotetext'] || @foottext[id]
|
1019
1134
|
if @doc_status[:column]
|
1020
|
-
warn "//footnote[#{id}] is in the column block. It is recommended to move out of the column block."
|
1135
|
+
warn "//footnote[#{id}] is in the column block. It is recommended to move out of the column block.", location: location
|
1021
1136
|
end
|
1022
1137
|
puts macro("footnotetext[#{@chapter.footnote(id).number}]", compile_inline(content.strip))
|
1023
1138
|
end
|
@@ -1033,7 +1148,7 @@ module ReVIEW
|
|
1033
1148
|
macro('footnote', compile_inline(@chapter.footnote(id).content.strip))
|
1034
1149
|
end
|
1035
1150
|
rescue KeyError
|
1036
|
-
|
1151
|
+
app_error "unknown footnote: #{id}"
|
1037
1152
|
end
|
1038
1153
|
|
1039
1154
|
BOUTEN = '・'.freeze
|
@@ -1119,6 +1234,10 @@ module ReVIEW
|
|
1119
1234
|
end
|
1120
1235
|
end
|
1121
1236
|
|
1237
|
+
def inline_ins(str)
|
1238
|
+
macro('reviewinsert', escape(str))
|
1239
|
+
end
|
1240
|
+
|
1122
1241
|
def inline_del(str)
|
1123
1242
|
macro('reviewstrike', escape(str))
|
1124
1243
|
end
|
@@ -1151,7 +1270,7 @@ module ReVIEW
|
|
1151
1270
|
str = I18n.t('hd_quote_without_number', compile_inline(chap.headline(id).caption))
|
1152
1271
|
end
|
1153
1272
|
if @book.config['chapterlink']
|
1154
|
-
anchor = n.
|
1273
|
+
anchor = n.tr('.', '-')
|
1155
1274
|
macro('reviewsecref', str, sec_label(anchor))
|
1156
1275
|
else
|
1157
1276
|
str
|
@@ -1163,10 +1282,10 @@ module ReVIEW
|
|
1163
1282
|
I18n.t('column', compile_inline(chapter.column(id).caption)),
|
1164
1283
|
column_label(id, chapter))
|
1165
1284
|
rescue KeyError
|
1166
|
-
|
1285
|
+
app_error "unknown column: #{id}"
|
1167
1286
|
end
|
1168
1287
|
|
1169
|
-
def inline_raw(str)
|
1288
|
+
def inline_raw(str) # rubocop:disable Lint/UselessMethodDefinition
|
1170
1289
|
super(str)
|
1171
1290
|
end
|
1172
1291
|
|
@@ -1202,7 +1321,7 @@ module ReVIEW
|
|
1202
1321
|
end
|
1203
1322
|
macro(command, @chapter.image(id).path)
|
1204
1323
|
else
|
1205
|
-
warn "image not bound: #{id}"
|
1324
|
+
warn "image not bound: #{id}", location: location
|
1206
1325
|
"\\verb|--[[path = #{id} (#{existence(id)})]]--|"
|
1207
1326
|
end
|
1208
1327
|
end
|
@@ -1249,23 +1368,22 @@ module ReVIEW
|
|
1249
1368
|
end
|
1250
1369
|
|
1251
1370
|
def index(str)
|
1371
|
+
# XXX: mendex/upmendex specific
|
1252
1372
|
sa = str.split('<<>>')
|
1253
1373
|
|
1254
1374
|
sa.map! do |item|
|
1255
1375
|
if @index_db[item]
|
1256
|
-
escape_index(
|
1257
|
-
|
1258
|
-
|
1259
|
-
|
1260
|
-
|
1261
|
-
"#{escape_index(item)}@#{esc_item}"
|
1262
|
-
else
|
1263
|
-
esc_item
|
1264
|
-
end
|
1376
|
+
escape_mendex_key(escape_index(@index_db[item])) + '@' + escape_mendex_display(escape_index(escape(item)))
|
1377
|
+
elsif item =~ /\A[[:ascii:]]+\Z/ || @index_mecab.nil?
|
1378
|
+
esc_item = escape_mendex_display(escape_index(escape(item)))
|
1379
|
+
if esc_item == item
|
1380
|
+
esc_item
|
1265
1381
|
else
|
1266
|
-
|
1267
|
-
escape_index(escape(yomi)) + '@' + escape_index(escape(item))
|
1382
|
+
"#{escape_mendex_key(escape_index(item))}@#{esc_item}"
|
1268
1383
|
end
|
1384
|
+
else
|
1385
|
+
yomi = NKF.nkf('-w --hiragana', @index_mecab.parse(item).force_encoding('UTF-8').chomp)
|
1386
|
+
escape_mendex_key(escape_index(yomi)) + '@' + escape_mendex_display(escape_index(escape(item)))
|
1269
1387
|
end
|
1270
1388
|
end
|
1271
1389
|
|