review 3.2.0 → 5.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (282) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby-tex.yml +31 -0
  3. data/.github/workflows/ruby-win.yml +45 -0
  4. data/.github/workflows/ruby.yml +27 -0
  5. data/.rubocop.yml +167 -42
  6. data/.travis.yml +1 -1
  7. data/Dockerfile +21 -5
  8. data/NEWS.ja.md +428 -1
  9. data/NEWS.md +429 -2
  10. data/README.md +11 -7
  11. data/Rakefile +7 -2
  12. data/appveyor.yml +0 -20
  13. data/bin/review +2 -4
  14. data/bin/review-catalog-converter +5 -5
  15. data/bin/review-check +13 -17
  16. data/bin/review-checkdep +3 -6
  17. data/bin/review-compile +13 -22
  18. data/bin/review-epub2html +1 -4
  19. data/bin/review-epubmaker +3 -4
  20. data/bin/review-idgxmlmaker +14 -0
  21. data/bin/review-index +5 -86
  22. data/bin/review-init +1 -4
  23. data/bin/review-pdfmaker +1 -3
  24. data/bin/review-preproc +11 -13
  25. data/bin/review-textmaker +1 -3
  26. data/bin/review-update +1 -4
  27. data/bin/review-validate +7 -7
  28. data/bin/review-vol +5 -82
  29. data/bin/review-webmaker +1 -3
  30. data/doc/config.yml.sample +67 -16
  31. data/doc/config.yml.sample-simple +4 -3
  32. data/doc/format.ja.md +133 -21
  33. data/doc/format.md +135 -34
  34. data/doc/makeindex.ja.md +2 -2
  35. data/doc/pdfmaker.ja.md +43 -1
  36. data/doc/pdfmaker.md +42 -1
  37. data/doc/quickstart.ja.md +55 -25
  38. data/doc/quickstart.md +47 -17
  39. data/lib/review.rb +1 -1
  40. data/lib/review/book.rb +2 -2
  41. data/lib/review/book/base.rb +89 -90
  42. data/lib/review/book/bib.rb +21 -0
  43. data/lib/review/book/book_unit.rb +158 -0
  44. data/lib/review/book/chapter.rb +51 -29
  45. data/lib/review/book/index.rb +42 -248
  46. data/lib/review/book/index/item.rb +46 -0
  47. data/lib/review/book/page_metric.rb +7 -7
  48. data/lib/review/book/part.rb +45 -10
  49. data/lib/review/book/volume.rb +5 -5
  50. data/lib/review/builder.rb +171 -54
  51. data/lib/review/call_hook.rb +20 -0
  52. data/lib/review/catalog.rb +15 -17
  53. data/lib/review/compiler.rb +240 -102
  54. data/lib/review/configure.rb +101 -12
  55. data/lib/review/converter.rb +1 -1
  56. data/lib/review/epub2html.rb +6 -1
  57. data/lib/review/epubmaker.rb +120 -118
  58. data/lib/review/epubmaker/content.rb +113 -0
  59. data/lib/review/epubmaker/epubcommon.rb +372 -0
  60. data/lib/review/epubmaker/epubv2.rb +178 -0
  61. data/lib/review/epubmaker/epubv3.rb +231 -0
  62. data/lib/review/epubmaker/producer.rb +168 -0
  63. data/lib/review/epubmaker/reviewheaderlistener.rb +12 -2
  64. data/lib/review/epubmaker/zip_exporter.rb +84 -0
  65. data/lib/review/exception.rb +6 -0
  66. data/lib/review/extentions/string.rb +0 -4
  67. data/lib/review/htmlbuilder.rb +147 -149
  68. data/lib/review/htmlutils.rb +10 -14
  69. data/lib/review/i18n.rb +4 -3
  70. data/lib/review/idgxmlbuilder.rb +229 -103
  71. data/lib/review/idgxmlmaker.rb +188 -0
  72. data/lib/review/img_math.rb +245 -0
  73. data/lib/review/index_builder.rb +654 -0
  74. data/lib/review/init-web/finish.html +10 -0
  75. data/lib/review/init-web/index.html +190 -0
  76. data/lib/review/init-web/review-layout-design.js +691 -0
  77. data/lib/review/init.rb +124 -41
  78. data/lib/review/latexbox.rb +58 -0
  79. data/lib/review/latexbuilder.rb +249 -97
  80. data/lib/review/latexutils.rb +9 -1
  81. data/lib/review/lineinput.rb +113 -3
  82. data/lib/review/logger.rb +43 -8
  83. data/lib/review/makerhelper.rb +13 -186
  84. data/lib/review/markdownbuilder.rb +75 -39
  85. data/lib/review/md2inaobuilder.rb +3 -5
  86. data/lib/review/pdfmaker.rb +88 -83
  87. data/lib/review/plaintextbuilder.rb +158 -83
  88. data/lib/review/preprocessor.rb +30 -24
  89. data/lib/review/rstbuilder.rb +58 -39
  90. data/lib/review/sec_counter.rb +14 -0
  91. data/lib/review/template.rb +6 -0
  92. data/lib/review/textmaker.rb +29 -17
  93. data/lib/review/textutils.rb +68 -2
  94. data/lib/review/tocprinter.rb +242 -97
  95. data/lib/review/topbuilder.rb +147 -61
  96. data/lib/review/update.rb +27 -28
  97. data/lib/review/version.rb +1 -1
  98. data/lib/review/volumeprinter.rb +97 -0
  99. data/lib/review/webmaker.rb +36 -35
  100. data/lib/review/webtocprinter.rb +39 -35
  101. data/lib/review/yamlloader.rb +4 -0
  102. data/review.gemspec +8 -5
  103. data/samples/sample-book/README.md +7 -2
  104. data/samples/sample-book/src/.gitignore +154 -0
  105. data/samples/sample-book/src/config-ebook.yml +4 -0
  106. data/samples/sample-book/src/config-epub2.yml +1 -1
  107. data/samples/sample-book/src/config-jlreq-ebook.yml +4 -0
  108. data/samples/sample-book/src/config-jlreq.yml +6 -0
  109. data/samples/sample-book/src/config.yml +3 -3
  110. data/samples/sample-book/src/lib/tasks/review.rake +45 -14
  111. data/samples/sample-book/src/lib/tasks/z01_copy_sty.rake +14 -8
  112. data/samples/syntax-book/Gemfile +1 -1
  113. data/samples/syntax-book/ch01.re +3 -1
  114. data/samples/syntax-book/ch02.re +28 -21
  115. data/samples/syntax-book/ch03.re +4 -7
  116. data/samples/syntax-book/config-jlreq-lualatex.yml +4 -0
  117. data/samples/syntax-book/config-jlreq.yml +5 -0
  118. data/samples/syntax-book/config-print.yml +3 -0
  119. data/samples/syntax-book/config.yml +1 -1
  120. data/samples/syntax-book/images/img3-2.png +0 -0
  121. data/samples/syntax-book/lib/tasks/review.rake +30 -15
  122. data/samples/syntax-book/lib/tasks/z01_copy_sty.rake +14 -8
  123. data/templates/html/_colophon.html.erb +23 -0
  124. data/templates/html/_colophon_history.html.erb +9 -0
  125. data/templates/html/_cover.html.erb +10 -0
  126. data/templates/html/_part_body.html.erb +6 -0
  127. data/templates/html/_titlepage.html.erb +20 -0
  128. data/templates/html/layout-html5.html.erb +6 -0
  129. data/templates/html/layout-xhtml1.html.erb +6 -0
  130. data/templates/latex/config.erb +45 -27
  131. data/templates/latex/layout.tex.erb +1 -0
  132. data/templates/latex/review-jlreq/README.md +3 -1
  133. data/templates/latex/review-jlreq/review-base.sty +124 -37
  134. data/templates/latex/review-jlreq/review-jlreq.cls +29 -22
  135. data/templates/latex/review-jlreq/review-style.sty +9 -1
  136. data/templates/latex/review-jlreq/review-tcbox.sty +348 -0
  137. data/templates/latex/review-jlreq/reviewmacro.sty +5 -0
  138. data/templates/latex/review-jsbook/README.md +46 -5
  139. data/templates/latex/review-jsbook/review-base.sty +111 -30
  140. data/templates/latex/review-jsbook/review-jsbook.cls +16 -2
  141. data/templates/latex/review-jsbook/review-style.sty +10 -2
  142. data/templates/latex/review-jsbook/review-tcbox.sty +348 -0
  143. data/templates/latex/review-jsbook/reviewmacro.sty +5 -0
  144. data/templates/opf/epubv2.opf.erb +7 -7
  145. data/templates/opf/epubv3.opf.erb +7 -7
  146. data/templates/opf/opf_manifest_epubv2.opf.erb +10 -0
  147. data/templates/opf/opf_manifest_epubv3.opf.erb +10 -0
  148. data/templates/opf/opf_metainfo_epubv2.opf.erb +17 -0
  149. data/templates/opf/opf_metainfo_epubv3.opf.erb +49 -0
  150. data/templates/opf/opf_tocx_epubv2.opf.erb +9 -0
  151. data/templates/opf/opf_tocx_epubv3.opf.erb +17 -0
  152. data/templates/web/html/layout-html5.html.erb +9 -8
  153. data/templates/web/html/layout-xhtml1.html.erb +6 -0
  154. data/test/assets/header_listener.html +35 -0
  155. data/test/assets/img_math/img1.png +0 -0
  156. data/test/assets/img_math/img2.png +0 -0
  157. data/test/assets/img_math/img3.png +0 -0
  158. data/test/assets/syntax_book_index_detail.txt +58 -0
  159. data/test/assets/test_template.tex +20 -9
  160. data/test/assets/test_template_backmatter.tex +20 -9
  161. data/test/book_test_helper.rb +11 -5
  162. data/test/run_test.rb +1 -1
  163. data/test/test_book.rb +123 -78
  164. data/test/test_book_chapter.rb +99 -56
  165. data/test/test_book_part.rb +3 -3
  166. data/test/test_builder.rb +24 -15
  167. data/test/test_catalog.rb +19 -42
  168. data/test/test_catalog_converter_cmd.rb +1 -1
  169. data/test/test_converter.rb +1 -0
  170. data/test/test_epub3maker.rb +170 -126
  171. data/test/test_epubmaker.rb +249 -129
  172. data/test/test_epubmaker_cmd.rb +16 -9
  173. data/test/test_helper.rb +23 -11
  174. data/test/test_htmlbuilder.rb +1083 -114
  175. data/test/test_htmlutils.rb +0 -12
  176. data/test/test_i18n.rb +37 -37
  177. data/test/test_idgxmlbuilder.rb +627 -27
  178. data/test/test_idgxmlmaker_cmd.rb +50 -0
  179. data/test/test_image_finder.rb +52 -70
  180. data/test/test_img_math.rb +111 -0
  181. data/test/test_index.rb +62 -52
  182. data/test/test_indexbuilder.rb +52 -0
  183. data/test/test_latexbuilder.rb +1189 -59
  184. data/test/test_latexbuilder_v2.rb +74 -34
  185. data/test/test_lineinput.rb +20 -93
  186. data/test/test_logger.rb +17 -4
  187. data/test/test_makerhelper.rb +2 -14
  188. data/test/test_markdownbuilder.rb +77 -4
  189. data/test/test_md2inaobuilder.rb +12 -2
  190. data/test/test_pdfmaker.rb +101 -12
  191. data/test/test_pdfmaker_cmd.rb +102 -8
  192. data/test/test_plaintextbuilder.rb +562 -31
  193. data/test/test_review_ext.rb +2 -1
  194. data/test/test_reviewheaderlistener.rb +49 -0
  195. data/test/test_rstbuilder.rb +58 -5
  196. data/test/test_sec_counter.rb +156 -0
  197. data/test/test_template.rb +12 -2
  198. data/test/test_textmaker_cmd.rb +58 -0
  199. data/test/test_textutils.rb +109 -2
  200. data/test/test_tocprinter.rb +46 -0
  201. data/test/test_topbuilder.rb +400 -17
  202. data/test/test_update.rb +53 -44
  203. data/test/test_webtocprinter.rb +75 -43
  204. data/test/test_yamlloader.rb +13 -0
  205. data/test/test_zip_exporter.rb +5 -6
  206. data/vendor/gentombow/LICENSE +1 -1
  207. data/vendor/gentombow/Makefile +0 -1
  208. data/vendor/gentombow/bounddvi-en.pdf +0 -0
  209. data/vendor/gentombow/bounddvi-en.tex +1 -0
  210. data/vendor/gentombow/bounddvi.pdf +0 -0
  211. data/vendor/gentombow/bounddvi.sty +30 -7
  212. data/vendor/gentombow/bounddvi.tex +1 -0
  213. data/vendor/gentombow/create_archive.sh +1 -0
  214. data/vendor/gentombow/gentombow-ja.pdf +0 -0
  215. data/vendor/gentombow/gentombow-ja.tex +9 -0
  216. data/vendor/gentombow/gentombow.pdf +0 -0
  217. data/vendor/gentombow/gentombow.sty +32 -10
  218. data/vendor/gentombow/gentombow.tex +8 -0
  219. data/vendor/gentombow/tests/gentombow-01-pdfx.tex +8 -0
  220. data/vendor/gentombow/tests/gentombow-02-pdfx.tex +8 -0
  221. data/vendor/jsclasses/LICENSE +1 -1
  222. data/vendor/jsclasses/Makefile +3 -2
  223. data/vendor/jsclasses/create_archive.sh +5 -5
  224. data/vendor/jsclasses/jis/Makefile +3 -2
  225. data/vendor/jsclasses/jis/jsarticle.cls +74 -31
  226. data/vendor/jsclasses/jis/jsbook.cls +74 -31
  227. data/vendor/jsclasses/jis/jsclasses.dtx +176 -36
  228. data/vendor/jsclasses/jis/jsclasses.ins +15 -5
  229. data/vendor/jsclasses/jis/jslogo.dtx +4 -4
  230. data/vendor/jsclasses/jis/jslogo.ins +9 -0
  231. data/vendor/jsclasses/jis/jslogo.sty +4 -16
  232. data/vendor/jsclasses/jis/jspf.cls +73 -30
  233. data/vendor/jsclasses/jis/jsreport.cls +74 -31
  234. data/vendor/jsclasses/jis/jsverb.ins +9 -0
  235. data/vendor/jsclasses/jis/jsverb.sty +1 -13
  236. data/vendor/jsclasses/jis/kiyou.cls +74 -31
  237. data/vendor/jsclasses/jis/minijs.sty +65 -22
  238. data/vendor/jsclasses/jis/okumacro.dtx +4 -5
  239. data/vendor/jsclasses/jis/okumacro.ins +9 -0
  240. data/vendor/jsclasses/jis/okumacro.sty +4 -17
  241. data/vendor/jsclasses/jis/okuverb.ins +9 -0
  242. data/vendor/jsclasses/jis/okuverb.sty +1 -13
  243. data/vendor/jsclasses/jis/winjis.sty +23 -19
  244. data/vendor/jsclasses/jsarticle.cls +74 -31
  245. data/vendor/jsclasses/jsbook.cls +74 -31
  246. data/vendor/jsclasses/jsclasses.dtx +176 -36
  247. data/vendor/jsclasses/jsclasses.ins +15 -5
  248. data/vendor/jsclasses/jsclasses.pdf +0 -0
  249. data/vendor/jsclasses/jslogo.dtx +4 -4
  250. data/vendor/jsclasses/jslogo.ins +9 -0
  251. data/vendor/jsclasses/jslogo.pdf +0 -0
  252. data/vendor/jsclasses/jslogo.sty +4 -16
  253. data/vendor/jsclasses/jspf.cls +73 -30
  254. data/vendor/jsclasses/jsreport.cls +74 -31
  255. data/vendor/jsclasses/jsverb.ins +9 -0
  256. data/vendor/jsclasses/jsverb.pdf +0 -0
  257. data/vendor/jsclasses/jsverb.sty +1 -13
  258. data/vendor/jsclasses/kiyou.cls +74 -31
  259. data/vendor/jsclasses/minijs.sty +68 -22
  260. data/vendor/jsclasses/okumacro.dtx +4 -5
  261. data/vendor/jsclasses/okumacro.ins +9 -0
  262. data/vendor/jsclasses/okumacro.pdf +0 -0
  263. data/vendor/jsclasses/okumacro.sty +4 -17
  264. data/vendor/jsclasses/okuverb.ins +9 -0
  265. data/vendor/jsclasses/okuverb.pdf +0 -0
  266. data/vendor/jsclasses/okuverb.sty +1 -13
  267. data/vendor/jsclasses/tests/relfont.tex +10 -0
  268. data/vendor/jsclasses/winjis.sty +23 -19
  269. metadata +136 -23
  270. data/.rubocop_todo.yml +0 -7
  271. data/lib/epubmaker.rb +0 -23
  272. data/lib/epubmaker/content.rb +0 -110
  273. data/lib/epubmaker/epubcommon.rb +0 -441
  274. data/lib/epubmaker/epubv2.rb +0 -143
  275. data/lib/epubmaker/epubv3.rb +0 -233
  276. data/lib/epubmaker/producer.rb +0 -375
  277. data/lib/epubmaker/zip_exporter.rb +0 -81
  278. data/lib/lineinput.rb +0 -155
  279. data/lib/review/book/compilable.rb +0 -173
  280. data/lib/review/tocparser.rb +0 -271
  281. data/samples/syntax-book/review-ext.rb +0 -14
  282. data/test/test_tocparser.rb +0 -25
@@ -0,0 +1,188 @@
1
+ # Copyright (c) 2019-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 'optparse'
9
+ require 'yaml'
10
+ require 'fileutils'
11
+
12
+ require 'review/converter'
13
+ require 'review/configure'
14
+ require 'review/book'
15
+ require 'review/yamlloader'
16
+ require 'review/idgxmlbuilder'
17
+ require 'review/version'
18
+ require 'review/makerhelper'
19
+
20
+ module ReVIEW
21
+ class IDGXMLMaker
22
+ include MakerHelper
23
+
24
+ attr_accessor :config, :basedir
25
+
26
+ def initialize
27
+ @basedir = nil
28
+ @logger = ReVIEW.logger
29
+ @plaintext = nil
30
+ end
31
+
32
+ def error(msg)
33
+ @logger.error "#{File.basename($PROGRAM_NAME, '.*')}: #{msg}"
34
+ exit 1
35
+ end
36
+
37
+ def warn(msg)
38
+ @logger.warn "#{File.basename($PROGRAM_NAME, '.*')}: #{msg}"
39
+ end
40
+
41
+ def self.execute(*args)
42
+ self.new.execute(*args)
43
+ end
44
+
45
+ def parse_opts(args)
46
+ cmd_config = {}
47
+ opts = OptionParser.new
48
+ @table = nil
49
+ @filter = nil
50
+ @buildonly = nil
51
+
52
+ opts.banner = 'Usage: review-idgxmlmaker [options] configfile'
53
+ opts.version = ReVIEW::VERSION
54
+ opts.on('-w', '--width widthoftypepage', 'Specify the width of type page for layouting tables (mm).') { |v| @table = v }
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/, '') } }
57
+ opts.on('--help', 'Prints this message and quit.') do
58
+ puts opts.help
59
+ exit 0
60
+ end
61
+
62
+ opts.parse!(args)
63
+ if args.size != 1
64
+ puts opts.help
65
+ exit 0
66
+ end
67
+
68
+ [cmd_config, args[0]]
69
+ end
70
+
71
+ def build_path
72
+ "#{@config['bookname']}-idgxml"
73
+ end
74
+
75
+ def remove_old_files(path)
76
+ FileUtils.rm_rf(path)
77
+ end
78
+
79
+ def execute(*args)
80
+ cmd_config, yamlfile = parse_opts(args)
81
+ error "#{yamlfile} not found." unless File.exist?(yamlfile)
82
+
83
+ @config = ReVIEW::Configure.create(maker: 'idgxmlmaker',
84
+ yamlfile: yamlfile,
85
+ config: cmd_config)
86
+ I18n.setup(@config['language'])
87
+ begin
88
+ generate_idgxml_files(yamlfile)
89
+ @logger.success("built #{build_path}")
90
+ rescue ApplicationError => e
91
+ raise if @config['debug']
92
+
93
+ error(e.message)
94
+ end
95
+ end
96
+
97
+ def generate_idgxml_files(yamlfile)
98
+ @basedir = File.dirname(yamlfile)
99
+ @path = build_path
100
+ remove_old_files(@path)
101
+ Dir.mkdir(@path)
102
+
103
+ @book = ReVIEW::Book::Base.new(@basedir, config: @config)
104
+ if @table
105
+ @book.config['tableopt'] = @table
106
+ end
107
+
108
+ build_body(@path, yamlfile)
109
+ end
110
+
111
+ def apply_filter(xmlfile)
112
+ return unless @filter
113
+
114
+ # pass filename information to filter by environment variable
115
+ ENV['REVIEW_FNAME'] = File.basename(xmlfile).sub(/.xml\Z/, '.re')
116
+ begin
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
121
+ if s.success?
122
+ File.write(xmlfile, o) # override
123
+ end
124
+ rescue => e
125
+ warn("filter error for #{xmlfile}: #{e.message}")
126
+ end
127
+ end
128
+
129
+ def build_body(basetmpdir, _yamlfile)
130
+ base_path = Pathname.new(@basedir)
131
+ @converter = ReVIEW::Converter.new(@book, ReVIEW::IDGXMLBuilder.new)
132
+ @book.parts.each do |part|
133
+ if part.name.present?
134
+ if part.file?
135
+ build_chap(part, base_path, basetmpdir, true)
136
+ else
137
+ xmlfile = "part_#{part.number}.xml"
138
+ build_part(part, basetmpdir, xmlfile)
139
+ end
140
+ end
141
+
142
+ part.chapters.each { |chap| build_chap(chap, base_path, basetmpdir, false) }
143
+ end
144
+ end
145
+
146
+ def build_part(part, basetmpdir, xmlfile)
147
+ File.open(File.join(basetmpdir, xmlfile), 'w') do |f|
148
+ title = ReVIEW::I18n.t('part', part.number)
149
+ if part.name.strip.present?
150
+ title << ReVIEW::I18n.t('chapter_postfix')
151
+ title << part.name.strip
152
+ end
153
+ f.puts '<?xml version="1.0" encoding="UTF-8"?>'
154
+ f.print '<doc xmlns:aid="http://ns.adobe.com/AdobeInDesign/4.0/"><title aid:pstyle="h1">'
155
+ f.print h(title)
156
+ f.print '</title><?dtp level="1" section="'
157
+ f.print h(title)
158
+ f.puts '"?></doc>'
159
+ end
160
+ apply_filter(File.join(basetmpdir, xmlfile))
161
+ end
162
+
163
+ def build_chap(chap, base_path, basetmpdir, ispart)
164
+ filename = ''
165
+
166
+ if ispart.present?
167
+ filename = chap.path
168
+ else
169
+ filename = Pathname.new(chap.path).relative_path_from(base_path).to_s
170
+ end
171
+ id = File.basename(filename).sub(/\.re\Z/, '')
172
+ if @buildonly && !@buildonly.include?(id)
173
+ warn "skip #{id}.re"
174
+ return
175
+ end
176
+
177
+ xmlfile = "#{id}.xml"
178
+
179
+ begin
180
+ @converter.convert(filename, File.join(basetmpdir, xmlfile))
181
+ apply_filter(File.join(basetmpdir, xmlfile))
182
+ rescue => e
183
+ warn "compile error in #{filename} (#{e.class})"
184
+ warn e.message
185
+ end
186
+ end
187
+ end
188
+ end
@@ -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