review 4.0.0 → 5.1.1
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 +31 -0
- data/.github/workflows/ruby-win.yml +45 -0
- data/.github/workflows/ruby.yml +27 -0
- data/.rubocop.yml +141 -38
- data/Dockerfile +21 -5
- data/NEWS.ja.md +338 -1
- data/NEWS.md +339 -2
- data/README.md +11 -7
- data/Rakefile +7 -2
- data/appveyor.yml +0 -20
- 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 +11 -20
- 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 +3 -5
- data/bin/review-textmaker +1 -3
- data/bin/review-update +1 -4
- data/bin/review-validate +5 -5
- data/bin/review-vol +5 -82
- data/bin/review-webmaker +1 -3
- data/doc/config.yml.sample +55 -12
- data/doc/config.yml.sample-simple +4 -3
- data/doc/format.ja.md +119 -17
- data/doc/format.md +106 -17
- 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 +55 -25
- data/doc/quickstart.md +47 -17
- data/lib/review.rb +1 -1
- data/lib/review/book.rb +2 -2
- data/lib/review/book/base.rb +69 -30
- 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 +39 -206
- data/lib/review/book/index/item.rb +8 -2
- 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 +124 -27
- data/lib/review/call_hook.rb +20 -0
- data/lib/review/catalog.rb +3 -2
- data/lib/review/compiler.rb +197 -91
- data/lib/review/configure.rb +95 -9
- data/lib/review/converter.rb +1 -1
- data/lib/review/epub2html.rb +6 -1
- data/lib/review/epubmaker.rb +116 -117
- 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 +168 -0
- data/lib/review/epubmaker/reviewheaderlistener.rb +12 -2
- data/lib/review/epubmaker/zip_exporter.rb +84 -0
- data/lib/review/exception.rb +6 -0
- data/lib/review/extentions/string.rb +0 -4
- data/lib/review/htmlbuilder.rb +132 -87
- data/lib/review/htmlutils.rb +8 -11
- data/lib/review/i18n.rb +2 -1
- data/lib/review/idgxmlbuilder.rb +156 -76
- data/lib/review/idgxmlmaker.rb +22 -18
- data/lib/review/img_math.rb +245 -0
- data/lib/review/index_builder.rb +654 -0
- data/lib/review/init.rb +17 -18
- data/lib/review/latexbox.rb +58 -0
- data/lib/review/latexbuilder.rb +173 -43
- data/lib/review/latexutils.rb +9 -1
- data/lib/review/lineinput.rb +112 -2
- data/lib/review/logger.rb +42 -3
- data/lib/review/makerhelper.rb +12 -187
- data/lib/review/markdownbuilder.rb +51 -2
- data/lib/review/pdfmaker.rb +78 -73
- data/lib/review/plaintextbuilder.rb +98 -14
- data/lib/review/preprocessor.rb +18 -12
- data/lib/review/rstbuilder.rb +28 -9
- data/lib/review/sec_counter.rb +14 -0
- data/lib/review/template.rb +6 -0
- data/lib/review/textmaker.rb +21 -19
- data/lib/review/textutils.rb +3 -12
- data/lib/review/tocprinter.rb +242 -97
- data/lib/review/topbuilder.rb +91 -24
- 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 +34 -33
- data/lib/review/webtocprinter.rb +39 -35
- data/lib/review/yamlloader.rb +2 -1
- data/review.gemspec +5 -3
- data/samples/sample-book/src/.gitignore +1 -0
- data/samples/sample-book/src/config-ebook.yml +4 -0
- data/samples/sample-book/src/config-epub2.yml +1 -1
- data/samples/sample-book/src/config-jlreq-ebook.yml +4 -0
- data/samples/sample-book/src/config.yml +3 -3
- data/samples/sample-book/src/lib/tasks/review.rake +26 -6
- data/samples/syntax-book/Gemfile +1 -1
- data/samples/syntax-book/ch01.re +3 -1
- data/samples/syntax-book/ch02.re +28 -21
- data/samples/syntax-book/ch03.re +1 -1
- data/samples/syntax-book/config-jlreq-lualatex.yml +4 -0
- data/samples/syntax-book/config-print.yml +3 -0
- data/samples/syntax-book/config.yml +1 -1
- data/samples/syntax-book/images/img3-2.png +0 -0
- data/samples/syntax-book/lib/tasks/review.rake +23 -8
- 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 +41 -29
- data/templates/latex/review-jlreq/README.md +3 -1
- data/templates/latex/review-jlreq/review-base.sty +47 -22
- data/templates/latex/review-jlreq/review-jlreq.cls +25 -24
- 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 +47 -21
- data/templates/latex/review-jsbook/review-jsbook.cls +12 -2
- 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 +12 -9
- data/test/assets/test_template_backmatter.tex +12 -9
- data/test/book_test_helper.rb +11 -5
- data/test/run_test.rb +1 -1
- data/test/test_book.rb +62 -63
- data/test/test_book_chapter.rb +99 -56
- data/test/test_book_part.rb +3 -3
- data/test/test_builder.rb +24 -15
- data/test/test_catalog.rb +1 -0
- 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 +249 -129
- data/test/test_epubmaker_cmd.rb +14 -7
- data/test/test_helper.rb +23 -11
- data/test/test_htmlbuilder.rb +956 -76
- data/test/test_htmlutils.rb +0 -12
- data/test/test_i18n.rb +33 -33
- data/test/test_idgxmlbuilder.rb +568 -10
- data/test/test_idgxmlmaker_cmd.rb +50 -0
- data/test/test_image_finder.rb +52 -70
- 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 +1056 -30
- data/test/test_latexbuilder_v2.rb +52 -12
- 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 +101 -7
- data/test/test_plaintextbuilder.rb +531 -25
- 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 +58 -0
- data/test/test_tocprinter.rb +46 -0
- data/test/test_topbuilder.rb +365 -10
- 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/LICENSE +1 -1
- 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 +74 -31
- data/vendor/jsclasses/jis/jsbook.cls +74 -31
- data/vendor/jsclasses/jis/jsclasses.dtx +176 -36
- data/vendor/jsclasses/jis/jsclasses.ins +15 -5
- data/vendor/jsclasses/jis/jslogo.dtx +4 -4
- data/vendor/jsclasses/jis/jslogo.ins +9 -0
- data/vendor/jsclasses/jis/jslogo.sty +4 -16
- data/vendor/jsclasses/jis/jspf.cls +73 -30
- data/vendor/jsclasses/jis/jsreport.cls +74 -31
- data/vendor/jsclasses/jis/jsverb.ins +9 -0
- data/vendor/jsclasses/jis/jsverb.sty +1 -13
- data/vendor/jsclasses/jis/kiyou.cls +74 -31
- data/vendor/jsclasses/jis/minijs.sty +65 -22
- data/vendor/jsclasses/jis/okumacro.dtx +4 -5
- data/vendor/jsclasses/jis/okumacro.ins +9 -0
- data/vendor/jsclasses/jis/okumacro.sty +4 -17
- 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 +74 -31
- data/vendor/jsclasses/jsbook.cls +74 -31
- data/vendor/jsclasses/jsclasses.dtx +176 -36
- data/vendor/jsclasses/jsclasses.ins +15 -5
- data/vendor/jsclasses/jsclasses.pdf +0 -0
- data/vendor/jsclasses/jslogo.dtx +4 -4
- data/vendor/jsclasses/jslogo.ins +9 -0
- data/vendor/jsclasses/jslogo.pdf +0 -0
- data/vendor/jsclasses/jslogo.sty +4 -16
- data/vendor/jsclasses/jspf.cls +73 -30
- data/vendor/jsclasses/jsreport.cls +74 -31
- 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 +74 -31
- data/vendor/jsclasses/minijs.sty +68 -22
- data/vendor/jsclasses/okumacro.dtx +4 -5
- data/vendor/jsclasses/okumacro.ins +9 -0
- data/vendor/jsclasses/okumacro.pdf +0 -0
- data/vendor/jsclasses/okumacro.sty +4 -17
- 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 +109 -20
- 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 -271
- data/samples/syntax-book/review-ext.rb +0 -14
- data/test/test_tocparser.rb +0 -25
data/lib/review/idgxmlmaker.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c) 2019 Kenshi Muto
|
1
|
+
# Copyright (c) 2019-2021 Kenshi Muto
|
2
2
|
#
|
3
3
|
# This program is free software.
|
4
4
|
# You can distribute or modify this program under the terms of
|
@@ -15,9 +15,12 @@ require 'review/book'
|
|
15
15
|
require 'review/yamlloader'
|
16
16
|
require 'review/idgxmlbuilder'
|
17
17
|
require 'review/version'
|
18
|
+
require 'review/makerhelper'
|
18
19
|
|
19
20
|
module ReVIEW
|
20
21
|
class IDGXMLMaker
|
22
|
+
include MakerHelper
|
23
|
+
|
21
24
|
attr_accessor :config, :basedir
|
22
25
|
|
23
26
|
def initialize
|
@@ -44,11 +47,13 @@ module ReVIEW
|
|
44
47
|
opts = OptionParser.new
|
45
48
|
@table = nil
|
46
49
|
@filter = nil
|
50
|
+
@buildonly = nil
|
47
51
|
|
48
52
|
opts.banner = 'Usage: review-idgxmlmaker [options] configfile'
|
49
53
|
opts.version = ReVIEW::VERSION
|
50
54
|
opts.on('-w', '--width widthoftypepage', 'Specify the width of type page for layouting tables (mm).') { |v| @table = v }
|
51
55
|
opts.on('-f', '--filter filterprogrampath', 'Specify the filter path.') { |v| @filter = v }
|
56
|
+
opts.on('-y', '--only file1,file2,...', 'Build only specified files.') { |v| @buildonly = v.split(/\s*,\s*/).map { |m| m.strip.sub(/\.re\Z/, '') } }
|
52
57
|
opts.on('--help', 'Prints this message and quit.') do
|
53
58
|
puts opts.help
|
54
59
|
exit 0
|
@@ -72,24 +77,19 @@ module ReVIEW
|
|
72
77
|
end
|
73
78
|
|
74
79
|
def execute(*args)
|
75
|
-
@config = ReVIEW::Configure.values
|
76
|
-
@config.maker = 'idgxmlmaker'
|
77
80
|
cmd_config, yamlfile = parse_opts(args)
|
78
81
|
error "#{yamlfile} not found." unless File.exist?(yamlfile)
|
79
82
|
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
rescue => e
|
84
|
-
error "yaml error #{e.message}"
|
85
|
-
end
|
86
|
-
# YAML configs will be overridden by command line options.
|
87
|
-
@config.deep_merge!(cmd_config)
|
83
|
+
@config = ReVIEW::Configure.create(maker: 'idgxmlmaker',
|
84
|
+
yamlfile: yamlfile,
|
85
|
+
config: cmd_config)
|
88
86
|
I18n.setup(@config['language'])
|
89
87
|
begin
|
90
88
|
generate_idgxml_files(yamlfile)
|
89
|
+
@logger.success("built #{build_path}")
|
91
90
|
rescue ApplicationError => e
|
92
91
|
raise if @config['debug']
|
92
|
+
|
93
93
|
error(e.message)
|
94
94
|
end
|
95
95
|
end
|
@@ -100,8 +100,7 @@ module ReVIEW
|
|
100
100
|
remove_old_files(@path)
|
101
101
|
Dir.mkdir(@path)
|
102
102
|
|
103
|
-
@book = ReVIEW::Book.
|
104
|
-
@book.config = @config
|
103
|
+
@book = ReVIEW::Book::Base.new(@basedir, config: @config)
|
105
104
|
if @table
|
106
105
|
@book.config['tableopt'] = @table
|
107
106
|
end
|
@@ -116,13 +115,14 @@ module ReVIEW
|
|
116
115
|
ENV['REVIEW_FNAME'] = File.basename(xmlfile).sub(/.xml\Z/, '.re')
|
117
116
|
begin
|
118
117
|
o, e, s = Open3.capture3(@filter, stdin_data: File.read(xmlfile))
|
118
|
+
unless e.empty?
|
119
|
+
warn("filter error for #{xmlfile}: #{e}")
|
120
|
+
end
|
119
121
|
if s.success?
|
120
122
|
File.write(xmlfile, o) # override
|
121
|
-
else
|
122
|
-
warn("filter error for #{xmlfile}: #{e.message}")
|
123
123
|
end
|
124
124
|
rescue => e
|
125
|
-
warn("filter error for #{xmlfile}: #{e}")
|
125
|
+
warn("filter error for #{xmlfile}: #{e.message}")
|
126
126
|
end
|
127
127
|
end
|
128
128
|
|
@@ -152,9 +152,9 @@ module ReVIEW
|
|
152
152
|
end
|
153
153
|
f.puts '<?xml version="1.0" encoding="UTF-8"?>'
|
154
154
|
f.print '<doc xmlns:aid="http://ns.adobe.com/AdobeInDesign/4.0/"><title aid:pstyle="h1">'
|
155
|
-
f.print
|
155
|
+
f.print h(title)
|
156
156
|
f.print '</title><?dtp level="1" section="'
|
157
|
-
f.print
|
157
|
+
f.print h(title)
|
158
158
|
f.puts '"?></doc>'
|
159
159
|
end
|
160
160
|
apply_filter(File.join(basetmpdir, xmlfile))
|
@@ -169,6 +169,10 @@ module ReVIEW
|
|
169
169
|
filename = Pathname.new(chap.path).relative_path_from(base_path).to_s
|
170
170
|
end
|
171
171
|
id = File.basename(filename).sub(/\.re\Z/, '')
|
172
|
+
if @buildonly && !@buildonly.include?(id)
|
173
|
+
warn "skip #{id}.re"
|
174
|
+
return
|
175
|
+
end
|
172
176
|
|
173
177
|
xmlfile = "#{id}.xml"
|
174
178
|
|
@@ -0,0 +1,245 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
require 'shellwords'
|
3
|
+
|
4
|
+
module ReVIEW
|
5
|
+
class ImgMath
|
6
|
+
def initialize(config, path_name: '_review_math')
|
7
|
+
@config = config
|
8
|
+
@logger = ReVIEW.logger
|
9
|
+
@math_dir = File.join(@config['imagedir'], path_name)
|
10
|
+
@math_maps = {}
|
11
|
+
end
|
12
|
+
|
13
|
+
def cleanup_mathimg
|
14
|
+
if @config['math_format'] == 'imgmath' && Dir.exist?(@math_dir)
|
15
|
+
FileUtils.rm_rf(@math_dir)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def defer_math_image(str, key)
|
20
|
+
# for Re:VIEW >3
|
21
|
+
@math_maps[key] = str
|
22
|
+
File.join(@math_dir, "_gen_#{key}.#{@config['imgmath_options']['format']}")
|
23
|
+
end
|
24
|
+
|
25
|
+
def make_math_image(str, key, fontsize = 12)
|
26
|
+
# Re:VIEW 2 compatibility
|
27
|
+
|
28
|
+
img_path = File.join(@math_dir, "_gen_#{key}.#{@config['imgmath_options']['format']}")
|
29
|
+
Dir.mkdir(@math_dir) unless Dir.exist?(@math_dir)
|
30
|
+
fontsize2 = (fontsize * 1.2).round.to_i
|
31
|
+
texsrc = <<-EOB
|
32
|
+
\\documentclass[12pt]{article}
|
33
|
+
\\usepackage[utf8]{inputenc}
|
34
|
+
\\usepackage{amsmath}
|
35
|
+
\\usepackage{amsthm}
|
36
|
+
\\usepackage{amssymb}
|
37
|
+
\\usepackage{amsfonts}
|
38
|
+
\\usepackage{anyfontsize}
|
39
|
+
\\usepackage{bm}
|
40
|
+
\\pagestyle{empty}
|
41
|
+
|
42
|
+
\\begin{document}
|
43
|
+
\\fontsize{#{fontsize}}{#{fontsize2}}\\selectfont #{str}
|
44
|
+
\\end{document}
|
45
|
+
EOB
|
46
|
+
Dir.mktmpdir do |tmpdir|
|
47
|
+
tex_path = File.join(tmpdir, 'tmpmath.tex')
|
48
|
+
dvi_path = File.join(tmpdir, 'tmpmath.dvi')
|
49
|
+
File.write(tex_path, texsrc)
|
50
|
+
cmd = "latex --interaction=nonstopmode --output-directory=#{tmpdir} #{tex_path} && dvipng -T tight -z9 -o #{img_path} #{dvi_path}"
|
51
|
+
out, status = Open3.capture2e(cmd)
|
52
|
+
unless status.success?
|
53
|
+
raise ApplicationError, "latex compile error\n\nError log:\n" + out
|
54
|
+
end
|
55
|
+
|
56
|
+
img_path
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
def make_math_images
|
61
|
+
return if @math_maps.empty?
|
62
|
+
|
63
|
+
Dir.mkdir(@math_dir) unless Dir.exist?(@math_dir)
|
64
|
+
fontsize = @config['imgmath_options']['fontsize'].to_f
|
65
|
+
lineheight = @config['imgmath_options']['lineheight'].to_f
|
66
|
+
|
67
|
+
texsrc = default_imgmath_preamble
|
68
|
+
if @config['imgmath_options']['preamble_file'] && File.readable?(@config['imgmath_options']['preamble_file'])
|
69
|
+
texsrc = File.read(@config['imgmath_options']['preamble_file'])
|
70
|
+
end
|
71
|
+
|
72
|
+
texsrc << <<-EOB
|
73
|
+
\\begin{document}
|
74
|
+
\\fontsize{#{fontsize}}{#{lineheight}}\\selectfont
|
75
|
+
\\input{__IMGMATH_BODY__}
|
76
|
+
\\end{document}
|
77
|
+
EOB
|
78
|
+
|
79
|
+
math_real_dir = File.realpath(@math_dir)
|
80
|
+
Dir.mktmpdir do |tmpdir|
|
81
|
+
File.open(File.join(tmpdir, '__IMGMATH_BODY__.tex'), 'w') do |f|
|
82
|
+
@math_maps.keys.sort.each do |key|
|
83
|
+
f.puts "% #{key}"
|
84
|
+
f.puts @math_maps[key]
|
85
|
+
f.puts '\\clearpage'
|
86
|
+
f.puts
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
tex_path = File.join(tmpdir, '__IMGMATH__.tex')
|
91
|
+
File.write(tex_path, texsrc)
|
92
|
+
|
93
|
+
begin
|
94
|
+
case @config['imgmath_options']['converter']
|
95
|
+
when 'pdfcrop'
|
96
|
+
make_math_images_pdfcrop(tmpdir, tex_path, math_real_dir)
|
97
|
+
when 'dvipng'
|
98
|
+
make_math_images_dvipng(tmpdir, tex_path, math_real_dir)
|
99
|
+
else
|
100
|
+
error "unknown math converter error. imgmath_options/converter parameter should be 'pdfcrop' or 'dvipng'."
|
101
|
+
exit 1
|
102
|
+
end
|
103
|
+
rescue CompileError
|
104
|
+
FileUtils.cp([tex_path,
|
105
|
+
File.join(File.dirname(tex_path), '__IMGMATH__.log')],
|
106
|
+
math_real_dir)
|
107
|
+
error "LaTeX math compile error. See #{math_real_dir}/__IMGMATH__.log for details."
|
108
|
+
exit 1
|
109
|
+
end
|
110
|
+
end
|
111
|
+
@math_maps.clear
|
112
|
+
end
|
113
|
+
|
114
|
+
private
|
115
|
+
|
116
|
+
def error(msg)
|
117
|
+
@logger.error msg
|
118
|
+
end
|
119
|
+
|
120
|
+
def warn(msg)
|
121
|
+
@logger.warn msg
|
122
|
+
end
|
123
|
+
|
124
|
+
def default_imgmath_preamble
|
125
|
+
<<-EOB
|
126
|
+
\\documentclass[uplatex,a3paper,landscape]{jsarticle}
|
127
|
+
\\usepackage[deluxe,uplatex]{otf}
|
128
|
+
\\usepackage[T1]{fontenc}
|
129
|
+
\\usepackage{textcomp}
|
130
|
+
\\usepackage{lmodern}
|
131
|
+
\\usepackage[dvipdfmx]{graphicx}
|
132
|
+
\\usepackage[dvipdfmx,table]{xcolor}
|
133
|
+
\\usepackage[utf8]{inputenc}
|
134
|
+
\\usepackage{ascmac}
|
135
|
+
\\usepackage{float}
|
136
|
+
\\usepackage{alltt}
|
137
|
+
\\usepackage{amsmath}
|
138
|
+
\\usepackage{amssymb}
|
139
|
+
\\usepackage{amsfonts}
|
140
|
+
\\usepackage{anyfontsize}
|
141
|
+
\\usepackage{bm}
|
142
|
+
\\pagestyle{empty}
|
143
|
+
% \\setpaperwidth{1000mm}
|
144
|
+
EOB
|
145
|
+
end
|
146
|
+
|
147
|
+
def make_math_images_pdfcrop(dir, tex_path, math_real_dir)
|
148
|
+
Dir.chdir(dir) do
|
149
|
+
dvi_path = '__IMGMATH__.dvi'
|
150
|
+
pdf_path = '__IMGMATH__.pdf'
|
151
|
+
out, status = Open3.capture2e(*[@config['texcommand'], @config['texoptions'].shellsplit, tex_path].flatten.compact)
|
152
|
+
if !status.success? || (!File.exist?(dvi_path) && !File.exist?(pdf_path))
|
153
|
+
raise CompileError
|
154
|
+
end
|
155
|
+
|
156
|
+
if File.exist?(dvi_path)
|
157
|
+
out, status = Open3.capture2e(*[@config['dvicommand'], @config['dvioptions'].shellsplit, dvi_path].flatten.compact)
|
158
|
+
if !status.success? || !File.exist?(pdf_path)
|
159
|
+
warn "error in #{@config['dvicommand']}. Error log:\n#{out}"
|
160
|
+
raise CompileError
|
161
|
+
end
|
162
|
+
end
|
163
|
+
args = @config['imgmath_options']['pdfcrop_cmd'].shellsplit
|
164
|
+
args.map! do |m|
|
165
|
+
m.sub('%i', pdf_path).
|
166
|
+
sub('%o', '__IMGMATH__pdfcrop.pdf')
|
167
|
+
end
|
168
|
+
out, status = Open3.capture2e(*args)
|
169
|
+
unless status.success?
|
170
|
+
warn "error in pdfcrop. Error log:\n#{out}"
|
171
|
+
raise CompileError
|
172
|
+
end
|
173
|
+
pdf_path = '__IMGMATH__pdfcrop.pdf'
|
174
|
+
pdf_path2 = pdf_path
|
175
|
+
|
176
|
+
@math_maps.keys.sort.each_with_index do |key, idx|
|
177
|
+
page = idx + 1
|
178
|
+
if File.exist?(File.join(math_real_dir, "_gen_#{key}.#{@config['imgmath_options']['format']}"))
|
179
|
+
# made already
|
180
|
+
next
|
181
|
+
end
|
182
|
+
|
183
|
+
if @config['imgmath_options']['extract_singlepage']
|
184
|
+
# if extract_singlepage = true, split each page
|
185
|
+
args = @config['imgmath_options']['pdfextract_cmd'].shellsplit
|
186
|
+
|
187
|
+
args.map! do |m|
|
188
|
+
m.sub('%i', pdf_path).
|
189
|
+
sub('%o', "__IMGMATH__pdfcrop_p#{page}.pdf").
|
190
|
+
sub('%O', "__IMGMATH__pdfcrop_p#{page}").
|
191
|
+
sub('%p', page.to_s)
|
192
|
+
end
|
193
|
+
out, status = Open3.capture2e(*args)
|
194
|
+
unless status.success?
|
195
|
+
warn "error in pdf extracting. Error log:\n#{out}"
|
196
|
+
raise CompileError
|
197
|
+
end
|
198
|
+
|
199
|
+
pdf_path2 = "__IMGMATH__pdfcrop_p#{page}.pdf"
|
200
|
+
end
|
201
|
+
|
202
|
+
args = @config['imgmath_options']['pdfcrop_pixelize_cmd'].shellsplit
|
203
|
+
args.map! do |m|
|
204
|
+
m.sub('%i', pdf_path2).
|
205
|
+
sub('%t', @config['imgmath_options']['format']).
|
206
|
+
sub('%o', File.join(math_real_dir, "_gen_#{key}.#{@config['imgmath_options']['format']}")).
|
207
|
+
sub('%O', File.join(math_real_dir, "_gen_#{key}")).
|
208
|
+
sub('%p', page.to_s)
|
209
|
+
end
|
210
|
+
out, status = Open3.capture2e(*args)
|
211
|
+
unless status.success?
|
212
|
+
warn "error in pdf pixelizing. Error log:\n#{out}"
|
213
|
+
raise CompileError
|
214
|
+
end
|
215
|
+
end
|
216
|
+
end
|
217
|
+
end
|
218
|
+
|
219
|
+
def make_math_images_dvipng(dir, tex_path, math_real_dir)
|
220
|
+
Dir.chdir(dir) do
|
221
|
+
dvi_path = '__IMGMATH__.dvi'
|
222
|
+
out, status = Open3.capture2e(*[@config['texcommand'], @config['texoptions'].shellsplit, tex_path].flatten.compact)
|
223
|
+
if !status.success? || !File.exist?(dvi_path)
|
224
|
+
raise CompileError
|
225
|
+
end
|
226
|
+
|
227
|
+
@math_maps.keys.sort.each_with_index do |key, idx|
|
228
|
+
page = idx + 1
|
229
|
+
args = @config['imgmath_options']['dvipng_cmd'].shellsplit
|
230
|
+
args.map! do |m|
|
231
|
+
m.sub('%i', dvi_path).
|
232
|
+
sub('%o', File.join(math_real_dir, "_gen_#{key}.#{@config['imgmath_options']['format']}")).
|
233
|
+
sub('%O', File.join(math_real_dir, "_gen_#{key}")).
|
234
|
+
sub('%p', page.to_s)
|
235
|
+
end
|
236
|
+
out, status = Open3.capture2e(*args)
|
237
|
+
unless status.success?
|
238
|
+
warn "error in dvipng. Error log:\n#{out}"
|
239
|
+
raise CompileError
|
240
|
+
end
|
241
|
+
end
|
242
|
+
end
|
243
|
+
end
|
244
|
+
end
|
245
|
+
end
|
@@ -0,0 +1,654 @@
|
|
1
|
+
# Copyright (c) 2008-2020 Minero Aoki, Kenshi Muto, Masayoshi Takahashi,
|
2
|
+
# KADO Masanori
|
3
|
+
#
|
4
|
+
# This program is free software.
|
5
|
+
# You can distribute or modify this program under the terms of
|
6
|
+
# the GNU LGPL, Lesser General Public License version 2.1.
|
7
|
+
#
|
8
|
+
|
9
|
+
require 'review/book/index'
|
10
|
+
require 'review/exception'
|
11
|
+
require 'review/builder'
|
12
|
+
require 'review/sec_counter'
|
13
|
+
|
14
|
+
module ReVIEW
|
15
|
+
class IndexBuilder < Builder
|
16
|
+
attr_reader :list_index, :table_index, :equation_index, :footnote_index,
|
17
|
+
:numberless_image_index, :image_index, :icon_index, :indepimage_index,
|
18
|
+
:headline_index, :column_index, :bibpaper_index
|
19
|
+
|
20
|
+
def initialize(strict = false, *args)
|
21
|
+
super
|
22
|
+
end
|
23
|
+
|
24
|
+
def check_id(id)
|
25
|
+
if id
|
26
|
+
if id =~ %r![#%\\{}\[\]~/$'"|*?&<>`\s]!
|
27
|
+
warn "deprecated ID: `#{$&}` in `#{id}`"
|
28
|
+
elsif id.start_with?('.')
|
29
|
+
warn "deprecated ID: `#{id}` begins from `.`"
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def pre_paragraph
|
35
|
+
''
|
36
|
+
end
|
37
|
+
|
38
|
+
def post_paragraph
|
39
|
+
''
|
40
|
+
end
|
41
|
+
|
42
|
+
def bind(compiler, chapter, location)
|
43
|
+
@compiler = compiler
|
44
|
+
@chapter = chapter
|
45
|
+
@location = location
|
46
|
+
@output = StringIO.new
|
47
|
+
if @chapter.present?
|
48
|
+
@book = @chapter.book
|
49
|
+
end
|
50
|
+
builder_init_file
|
51
|
+
end
|
52
|
+
|
53
|
+
def builder_init_file
|
54
|
+
@sec_counter = SecCounter.new(5, @chapter)
|
55
|
+
|
56
|
+
@headline_stack = []
|
57
|
+
|
58
|
+
@list_index = ReVIEW::Book::ListIndex.new
|
59
|
+
@table_index = ReVIEW::Book::TableIndex.new
|
60
|
+
@equation_index = ReVIEW::Book::EquationIndex.new
|
61
|
+
@footnote_index = ReVIEW::Book::FootnoteIndex.new
|
62
|
+
@headline_index = ReVIEW::Book::HeadlineIndex.new(@chapter)
|
63
|
+
@column_index = ReVIEW::Book::ColumnIndex.new
|
64
|
+
@chapter_index = ReVIEW::Book::ChapterIndex.new
|
65
|
+
@bibpaper_index = ReVIEW::Book::BibpaperIndex.new
|
66
|
+
|
67
|
+
if @book
|
68
|
+
@image_index = ReVIEW::Book::ImageIndex.new(@chapter)
|
69
|
+
@icon_index = ReVIEW::Book::IconIndex.new(@chapter)
|
70
|
+
@numberless_image_index = ReVIEW::Book::NumberlessImageIndex.new(@chapter)
|
71
|
+
@indepimage_index = ReVIEW::Book::IndepImageIndex.new(@chapter)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
private :builder_init_file
|
75
|
+
|
76
|
+
def result
|
77
|
+
nil
|
78
|
+
end
|
79
|
+
|
80
|
+
def target_name
|
81
|
+
'index'
|
82
|
+
end
|
83
|
+
|
84
|
+
def headline(level, label, caption)
|
85
|
+
check_id(label)
|
86
|
+
@sec_counter.inc(level)
|
87
|
+
return if level < 2
|
88
|
+
|
89
|
+
cursor = level - 2
|
90
|
+
|
91
|
+
if label
|
92
|
+
@headline_stack[cursor] = label
|
93
|
+
else
|
94
|
+
@headline_stack[cursor] = caption
|
95
|
+
end
|
96
|
+
if @headline_stack.size > cursor + 1
|
97
|
+
@headline_stack = @headline_stack.take(cursor + 1)
|
98
|
+
end
|
99
|
+
|
100
|
+
item_id = @headline_stack.join('|')
|
101
|
+
|
102
|
+
item = ReVIEW::Book::Index::Item.new(item_id, @sec_counter.number_list, caption)
|
103
|
+
@headline_index.add_item(item)
|
104
|
+
end
|
105
|
+
|
106
|
+
def nonum_begin(level, label, caption)
|
107
|
+
check_id(label)
|
108
|
+
return if level < 2
|
109
|
+
|
110
|
+
cursor = level - 2
|
111
|
+
|
112
|
+
if label
|
113
|
+
@headline_stack[cursor] = label
|
114
|
+
else
|
115
|
+
@headline_stack[cursor] = caption
|
116
|
+
end
|
117
|
+
if @headline_stack.size > cursor + 1
|
118
|
+
@headline_stack = @headline_stack.take(cursor + 1)
|
119
|
+
end
|
120
|
+
|
121
|
+
item_id = @headline_stack.join('|')
|
122
|
+
|
123
|
+
item = ReVIEW::Book::Index::Item.new(item_id, nil, caption)
|
124
|
+
@headline_index.add_item(item)
|
125
|
+
end
|
126
|
+
|
127
|
+
def nonum_end(_level)
|
128
|
+
end
|
129
|
+
|
130
|
+
def notoc_begin(level, label, caption)
|
131
|
+
check_id(label)
|
132
|
+
return if level < 2
|
133
|
+
|
134
|
+
cursor = level - 2
|
135
|
+
|
136
|
+
if label
|
137
|
+
@headline_stack[cursor] = label
|
138
|
+
else
|
139
|
+
@headline_stack[cursor] = caption
|
140
|
+
end
|
141
|
+
if @headline_stack.size > cursor + 1
|
142
|
+
@headline_stack = @headline_stack.take(cursor + 1)
|
143
|
+
end
|
144
|
+
|
145
|
+
item_id = @headline_stack.join('|')
|
146
|
+
|
147
|
+
item = ReVIEW::Book::Index::Item.new(item_id, nil, caption)
|
148
|
+
@headline_index.add_item(item)
|
149
|
+
end
|
150
|
+
|
151
|
+
def notoc_end(_level)
|
152
|
+
end
|
153
|
+
|
154
|
+
def nodisp_begin(level, label, caption)
|
155
|
+
check_id(label)
|
156
|
+
return if level < 2
|
157
|
+
|
158
|
+
cursor = level - 2
|
159
|
+
|
160
|
+
if label
|
161
|
+
@headline_stack[cursor] = label
|
162
|
+
else
|
163
|
+
@headline_stack[cursor] = caption
|
164
|
+
end
|
165
|
+
if @headline_stack.size > cursor + 1
|
166
|
+
@headline_stack = @headline_stack.take(cursor + 1)
|
167
|
+
end
|
168
|
+
|
169
|
+
item_id = @headline_stack.join('|')
|
170
|
+
|
171
|
+
item = ReVIEW::Book::Index::Item.new(item_id, nil, caption)
|
172
|
+
@headline_index.add_item(item)
|
173
|
+
end
|
174
|
+
|
175
|
+
def nodisp_end(_level)
|
176
|
+
end
|
177
|
+
|
178
|
+
def column_begin(_level, label, caption)
|
179
|
+
check_id(label)
|
180
|
+
item_id = label || caption
|
181
|
+
item = ReVIEW::Book::Index::Item.new(item_id, @column_index.size + 1, caption)
|
182
|
+
@column_index.add_item(item)
|
183
|
+
end
|
184
|
+
|
185
|
+
def column_end(_level)
|
186
|
+
end
|
187
|
+
|
188
|
+
def xcolumn_begin(_level, label, _caption)
|
189
|
+
check_id(label)
|
190
|
+
end
|
191
|
+
|
192
|
+
def xcolumn_end(_level)
|
193
|
+
end
|
194
|
+
|
195
|
+
def sup_begin(_level, label, _caption)
|
196
|
+
check_id(label)
|
197
|
+
end
|
198
|
+
|
199
|
+
def sup_end(_level)
|
200
|
+
end
|
201
|
+
|
202
|
+
def ul_begin
|
203
|
+
end
|
204
|
+
|
205
|
+
def ul_item_begin(lines)
|
206
|
+
end
|
207
|
+
|
208
|
+
def ul_item_end
|
209
|
+
end
|
210
|
+
|
211
|
+
def ul_end
|
212
|
+
end
|
213
|
+
|
214
|
+
def ol_begin
|
215
|
+
end
|
216
|
+
|
217
|
+
def ol_item(lines, _num)
|
218
|
+
end
|
219
|
+
|
220
|
+
def ol_end
|
221
|
+
end
|
222
|
+
|
223
|
+
def dl_begin
|
224
|
+
end
|
225
|
+
|
226
|
+
def dt(line)
|
227
|
+
end
|
228
|
+
|
229
|
+
def dd(lines)
|
230
|
+
end
|
231
|
+
|
232
|
+
def dl_end
|
233
|
+
end
|
234
|
+
|
235
|
+
def paragraph(lines)
|
236
|
+
end
|
237
|
+
|
238
|
+
def parasep
|
239
|
+
''
|
240
|
+
end
|
241
|
+
|
242
|
+
def nofunc_text(_str)
|
243
|
+
''
|
244
|
+
end
|
245
|
+
|
246
|
+
def read(_lines)
|
247
|
+
end
|
248
|
+
|
249
|
+
alias_method :lead, :read
|
250
|
+
|
251
|
+
def list(_lines, id, _caption, _lang = nil)
|
252
|
+
check_id(id)
|
253
|
+
item = ReVIEW::Book::Index::Item.new(id, @list_index.size + 1)
|
254
|
+
@list_index.add_item(item)
|
255
|
+
end
|
256
|
+
|
257
|
+
def source(_lines, _caption = nil, _lang = nil)
|
258
|
+
end
|
259
|
+
|
260
|
+
def listnum(_lines, id, _caption, _lang = nil)
|
261
|
+
check_id(id)
|
262
|
+
item = ReVIEW::Book::Index::Item.new(id, @list_index.size + 1)
|
263
|
+
@list_index.add_item(item)
|
264
|
+
end
|
265
|
+
|
266
|
+
def emlist(lines, caption = nil, lang = nil)
|
267
|
+
end
|
268
|
+
|
269
|
+
def emlistnum(lines, caption = nil, lang = nil)
|
270
|
+
end
|
271
|
+
|
272
|
+
def cmd(lines, caption = nil)
|
273
|
+
end
|
274
|
+
|
275
|
+
def quote(lines)
|
276
|
+
end
|
277
|
+
|
278
|
+
def image(_lines, id, caption, _metric = nil)
|
279
|
+
check_id(id)
|
280
|
+
item = ReVIEW::Book::Index::Item.new(id, @image_index.size + 1, caption)
|
281
|
+
@image_index.add_item(item)
|
282
|
+
end
|
283
|
+
|
284
|
+
def table(_lines, id = nil, caption = nil)
|
285
|
+
check_id(id)
|
286
|
+
if id
|
287
|
+
item = ReVIEW::Book::Index::Item.new(id, @table_index.size + 1, caption)
|
288
|
+
@table_index.add_item(item)
|
289
|
+
end
|
290
|
+
end
|
291
|
+
|
292
|
+
def emtable(_lines, _caption = nil)
|
293
|
+
# item = ReVIEW::Book::TableIndex::Item.new(id, @table_index.size + 1)
|
294
|
+
# @table_index << item
|
295
|
+
end
|
296
|
+
|
297
|
+
def comment(lines, comment = nil)
|
298
|
+
end
|
299
|
+
|
300
|
+
def imgtable(_lines, id, _caption = nil, _metric = nil)
|
301
|
+
check_id(id)
|
302
|
+
item = ReVIEW::Book::Index::Item.new(id, @table_index.size + 1)
|
303
|
+
@table_index.add_item(item)
|
304
|
+
|
305
|
+
## to find image path
|
306
|
+
item = ReVIEW::Book::Index::Item.new(id, @indepimage_index.size + 1)
|
307
|
+
@indepimage_index.add_item(item)
|
308
|
+
end
|
309
|
+
|
310
|
+
def footnote(id, str)
|
311
|
+
check_id(id)
|
312
|
+
item = ReVIEW::Book::Index::Item.new(id, @footnote_index.size + 1, str)
|
313
|
+
@footnote_index.add_item(item)
|
314
|
+
end
|
315
|
+
|
316
|
+
def indepimage(_lines, id, _caption = '', _metric = nil)
|
317
|
+
check_id(id)
|
318
|
+
item = ReVIEW::Book::Index::Item.new(id, @indepimage_index.size + 1)
|
319
|
+
@indepimage_index.add_item(item)
|
320
|
+
end
|
321
|
+
|
322
|
+
def numberlessimage(_lines, id, _caption = '', _metric = nil)
|
323
|
+
check_id(id)
|
324
|
+
item = ReVIEW::Book::Index::Item.new(id, @indepimage_index.size + 1)
|
325
|
+
@indepimage_index.add_item(item)
|
326
|
+
end
|
327
|
+
|
328
|
+
def hr
|
329
|
+
end
|
330
|
+
|
331
|
+
def label(id)
|
332
|
+
check_id(id)
|
333
|
+
end
|
334
|
+
|
335
|
+
def blankline
|
336
|
+
end
|
337
|
+
|
338
|
+
def flushright(_lines)
|
339
|
+
end
|
340
|
+
|
341
|
+
def centering(lines)
|
342
|
+
end
|
343
|
+
|
344
|
+
def olnum(_num)
|
345
|
+
end
|
346
|
+
|
347
|
+
def pagebreak
|
348
|
+
end
|
349
|
+
|
350
|
+
def bpo(_lines)
|
351
|
+
end
|
352
|
+
|
353
|
+
def noindent
|
354
|
+
end
|
355
|
+
|
356
|
+
def compile_inline(s)
|
357
|
+
@compiler.text(s)
|
358
|
+
end
|
359
|
+
|
360
|
+
def inline_chapref(_id)
|
361
|
+
''
|
362
|
+
end
|
363
|
+
|
364
|
+
def inline_chap(_id)
|
365
|
+
''
|
366
|
+
end
|
367
|
+
|
368
|
+
def inline_title(_id)
|
369
|
+
''
|
370
|
+
end
|
371
|
+
|
372
|
+
def inline_list(_id)
|
373
|
+
''
|
374
|
+
end
|
375
|
+
|
376
|
+
def inline_img(_id)
|
377
|
+
''
|
378
|
+
end
|
379
|
+
|
380
|
+
def inline_imgref(_id)
|
381
|
+
''
|
382
|
+
end
|
383
|
+
|
384
|
+
def inline_table(_id)
|
385
|
+
''
|
386
|
+
end
|
387
|
+
|
388
|
+
def inline_eq(_id)
|
389
|
+
''
|
390
|
+
end
|
391
|
+
|
392
|
+
def inline_fn(_id)
|
393
|
+
''
|
394
|
+
end
|
395
|
+
|
396
|
+
def inline_i(_str)
|
397
|
+
''
|
398
|
+
end
|
399
|
+
|
400
|
+
def inline_b(_str)
|
401
|
+
''
|
402
|
+
end
|
403
|
+
|
404
|
+
def inline_ami(_str)
|
405
|
+
''
|
406
|
+
end
|
407
|
+
|
408
|
+
def inline_bou(str)
|
409
|
+
str
|
410
|
+
end
|
411
|
+
|
412
|
+
def inline_tti(_str)
|
413
|
+
''
|
414
|
+
end
|
415
|
+
|
416
|
+
def inline_ttb(_str)
|
417
|
+
''
|
418
|
+
end
|
419
|
+
|
420
|
+
def inline_dtp(_str)
|
421
|
+
''
|
422
|
+
end
|
423
|
+
|
424
|
+
def inline_code(_str)
|
425
|
+
''
|
426
|
+
end
|
427
|
+
|
428
|
+
def inline_idx(_str)
|
429
|
+
''
|
430
|
+
end
|
431
|
+
|
432
|
+
def inline_hidx(_str)
|
433
|
+
''
|
434
|
+
end
|
435
|
+
|
436
|
+
def inline_br(_str)
|
437
|
+
''
|
438
|
+
end
|
439
|
+
|
440
|
+
def inline_m(_str)
|
441
|
+
''
|
442
|
+
end
|
443
|
+
|
444
|
+
def firstlinenum(_num)
|
445
|
+
''
|
446
|
+
end
|
447
|
+
|
448
|
+
def inline_ruby(_arg)
|
449
|
+
''
|
450
|
+
end
|
451
|
+
|
452
|
+
def inline_kw(_arg)
|
453
|
+
''
|
454
|
+
end
|
455
|
+
|
456
|
+
def inline_href(_arg)
|
457
|
+
''
|
458
|
+
end
|
459
|
+
|
460
|
+
def inline_hr(_arg)
|
461
|
+
''
|
462
|
+
end
|
463
|
+
|
464
|
+
def text(_str)
|
465
|
+
''
|
466
|
+
end
|
467
|
+
|
468
|
+
def bibpaper(_lines, id, caption)
|
469
|
+
check_id(id)
|
470
|
+
item = ReVIEW::Book::Index::Item.new(id, @bibpaper_index.size + 1, caption)
|
471
|
+
@bibpaper_index.add_item(item)
|
472
|
+
end
|
473
|
+
|
474
|
+
def inline_hd(_id)
|
475
|
+
''
|
476
|
+
end
|
477
|
+
|
478
|
+
def inline_bib(_id)
|
479
|
+
''
|
480
|
+
end
|
481
|
+
|
482
|
+
def inline_column(_id)
|
483
|
+
''
|
484
|
+
end
|
485
|
+
|
486
|
+
def inline_column_chap(_chapter, _id)
|
487
|
+
''
|
488
|
+
end
|
489
|
+
|
490
|
+
def inline_pageref(_id)
|
491
|
+
''
|
492
|
+
end
|
493
|
+
|
494
|
+
def inline_tcy(_arg)
|
495
|
+
''
|
496
|
+
end
|
497
|
+
|
498
|
+
def inline_balloon(_arg)
|
499
|
+
''
|
500
|
+
end
|
501
|
+
|
502
|
+
def inline_w(_s)
|
503
|
+
''
|
504
|
+
end
|
505
|
+
|
506
|
+
def inline_wb(_s)
|
507
|
+
''
|
508
|
+
end
|
509
|
+
|
510
|
+
def inline_abbr(_str)
|
511
|
+
''
|
512
|
+
end
|
513
|
+
|
514
|
+
def inline_acronym(_str)
|
515
|
+
''
|
516
|
+
end
|
517
|
+
|
518
|
+
def inline_cite(_str)
|
519
|
+
''
|
520
|
+
end
|
521
|
+
|
522
|
+
def inline_dfn(_str)
|
523
|
+
''
|
524
|
+
end
|
525
|
+
|
526
|
+
def inline_em(_str)
|
527
|
+
''
|
528
|
+
end
|
529
|
+
|
530
|
+
def inline_kbd(_str)
|
531
|
+
''
|
532
|
+
end
|
533
|
+
|
534
|
+
def inline_samp(_str)
|
535
|
+
''
|
536
|
+
end
|
537
|
+
|
538
|
+
def inline_strong(_str)
|
539
|
+
''
|
540
|
+
end
|
541
|
+
|
542
|
+
def inline_var(_str)
|
543
|
+
''
|
544
|
+
end
|
545
|
+
|
546
|
+
def inline_big(_str)
|
547
|
+
''
|
548
|
+
end
|
549
|
+
|
550
|
+
def inline_small(_str)
|
551
|
+
''
|
552
|
+
end
|
553
|
+
|
554
|
+
def inline_sub(_str)
|
555
|
+
''
|
556
|
+
end
|
557
|
+
|
558
|
+
def inline_sup(_str)
|
559
|
+
''
|
560
|
+
end
|
561
|
+
|
562
|
+
def inline_tt(_str)
|
563
|
+
''
|
564
|
+
end
|
565
|
+
|
566
|
+
def inline_del(_str)
|
567
|
+
''
|
568
|
+
end
|
569
|
+
|
570
|
+
def inline_ins(_str)
|
571
|
+
''
|
572
|
+
end
|
573
|
+
|
574
|
+
def inline_u(_str)
|
575
|
+
''
|
576
|
+
end
|
577
|
+
|
578
|
+
def inline_recipe(_str)
|
579
|
+
''
|
580
|
+
end
|
581
|
+
|
582
|
+
def inline_icon(id)
|
583
|
+
check_id(id)
|
584
|
+
item = ReVIEW::Book::Index::Item.new(id, @icon_index.size + 1)
|
585
|
+
@icon_index.add_item(item)
|
586
|
+
''
|
587
|
+
end
|
588
|
+
|
589
|
+
def inline_uchar(_str)
|
590
|
+
''
|
591
|
+
end
|
592
|
+
|
593
|
+
def raw(_str)
|
594
|
+
''
|
595
|
+
end
|
596
|
+
|
597
|
+
def embed(_lines, _arg = nil)
|
598
|
+
''
|
599
|
+
end
|
600
|
+
|
601
|
+
def warn(msg)
|
602
|
+
@logger.warn "#{@location}: #{msg}"
|
603
|
+
end
|
604
|
+
|
605
|
+
def error(msg = '(no message)')
|
606
|
+
if msg =~ /builder does not support command/
|
607
|
+
# ignore
|
608
|
+
return
|
609
|
+
end
|
610
|
+
|
611
|
+
super
|
612
|
+
end
|
613
|
+
|
614
|
+
def texequation(_lines, id = nil, _caption = '')
|
615
|
+
check_id(id)
|
616
|
+
if id
|
617
|
+
item = ReVIEW::Book::Index::Item.new(id, @equation_index.size + 1)
|
618
|
+
@equation_index.add_item(item)
|
619
|
+
end
|
620
|
+
end
|
621
|
+
|
622
|
+
def get_chap(_chapter = nil)
|
623
|
+
''
|
624
|
+
end
|
625
|
+
|
626
|
+
def extract_chapter_id(_chap_ref)
|
627
|
+
''
|
628
|
+
end
|
629
|
+
|
630
|
+
def captionblock(_type, _lines, _caption, _specialstyle = nil)
|
631
|
+
''
|
632
|
+
end
|
633
|
+
|
634
|
+
def tsize(_str)
|
635
|
+
''
|
636
|
+
end
|
637
|
+
|
638
|
+
def inline_raw(_args)
|
639
|
+
''
|
640
|
+
end
|
641
|
+
|
642
|
+
def inline_embed(_args)
|
643
|
+
''
|
644
|
+
end
|
645
|
+
|
646
|
+
def highlight?
|
647
|
+
false
|
648
|
+
end
|
649
|
+
|
650
|
+
def unknown_command(*_args)
|
651
|
+
# ignore
|
652
|
+
end
|
653
|
+
end
|
654
|
+
end # module ReVIEW
|