review 2.4.0 → 2.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.rubocop.yml +20 -5
- data/.travis.yml +2 -1
- data/NEWS.ja.md +93 -0
- data/NEWS.md +77 -0
- data/README.md +1 -1
- data/bin/review +38 -12
- data/bin/review-compile +106 -88
- data/bin/review-epubmaker +6 -1
- data/bin/review-init +21 -1
- data/bin/review-textmaker +16 -0
- data/doc/config.yml.sample +6 -1
- data/doc/format.ja.md +23 -0
- data/doc/format.md +20 -2
- data/doc/quickstart.ja.md +8 -4
- data/doc/quickstart.md +11 -8
- data/lib/review/book/base.rb +29 -18
- data/lib/review/book/index.rb +10 -5
- data/lib/review/builder.rb +58 -33
- data/lib/review/catalog.rb +30 -0
- data/lib/review/compiler.rb +53 -19
- data/lib/review/configure.rb +15 -14
- data/lib/review/epubmaker.rb +15 -4
- data/lib/review/htmlbuilder.rb +56 -24
- data/lib/review/idgxmlbuilder.rb +17 -7
- data/lib/review/latexbuilder.rb +113 -38
- data/lib/review/markdownbuilder.rb +12 -5
- data/lib/review/md2inaobuilder.rb +3 -1
- data/lib/review/pdfmaker.rb +23 -9
- data/lib/review/plaintextbuilder.rb +683 -0
- data/lib/review/rstbuilder.rb +30 -10
- data/lib/review/textmaker.rb +158 -0
- data/lib/review/textutils.rb +10 -1
- data/lib/review/topbuilder.rb +32 -417
- data/lib/review/version.rb +1 -1
- data/lib/review/webmaker.rb +29 -8
- data/review.gemspec +3 -4
- data/templates/html/layout-xhtml1.html.erb +0 -2
- data/templates/latex/layout.tex.erb +6 -4
- data/templates/web/html/layout-xhtml1.html.erb +0 -2
- data/test/book_test_helper.rb +1 -0
- data/test/run_test.rb +1 -1
- data/test/sample-book/src/Rakefile +19 -3
- data/test/syntax-book/Rakefile +19 -3
- data/test/test_catalog.rb +45 -0
- data/test/test_compiler.rb +8 -2
- data/test/test_htmlbuilder.rb +22 -0
- data/test/test_idgxmlbuilder.rb +22 -0
- data/test/test_index.rb +31 -0
- data/test/test_latexbuilder.rb +48 -16
- data/test/test_plaintextbuilder.rb +390 -0
- data/test/test_textutils.rb +2 -0
- data/test/test_topbuilder.rb +23 -1
- metadata +13 -7
@@ -28,7 +28,9 @@ module ReVIEW
|
|
28
28
|
end
|
29
29
|
|
30
30
|
def blank
|
31
|
-
|
31
|
+
unless @blank_seen
|
32
|
+
@output.puts
|
33
|
+
end
|
32
34
|
@blank_seen = true
|
33
35
|
end
|
34
36
|
|
@@ -132,7 +134,9 @@ module ReVIEW
|
|
132
134
|
end
|
133
135
|
|
134
136
|
def compile_href(url, label)
|
135
|
-
|
137
|
+
if label.blank?
|
138
|
+
label = url
|
139
|
+
end
|
136
140
|
"[#{label}](#{url})"
|
137
141
|
end
|
138
142
|
|
@@ -174,7 +178,6 @@ module ReVIEW
|
|
174
178
|
"#{I18n.t('image')}#{@chapter.image(id).number}"
|
175
179
|
rescue KeyError
|
176
180
|
error "unknown image: #{id}"
|
177
|
-
nofunc_text("[UnknownImage:#{id}]")
|
178
181
|
end
|
179
182
|
|
180
183
|
def indepimage(_lines, id, caption = '', _metric = nil)
|
@@ -193,7 +196,9 @@ module ReVIEW
|
|
193
196
|
|
194
197
|
def cmd(lines)
|
195
198
|
puts '```shell-session'
|
196
|
-
lines.each
|
199
|
+
lines.each do |line|
|
200
|
+
puts detab(line)
|
201
|
+
end
|
197
202
|
puts '```'
|
198
203
|
end
|
199
204
|
|
@@ -297,7 +302,9 @@ module ReVIEW
|
|
297
302
|
def comment(lines, comment = nil)
|
298
303
|
return unless @book.config['draft']
|
299
304
|
lines ||= []
|
300
|
-
|
305
|
+
unless comment.blank?
|
306
|
+
lines.unshift comment
|
307
|
+
end
|
301
308
|
str = lines.join('<br />')
|
302
309
|
puts %Q(<div class="red">#{escape_html(str)}</div>)
|
303
310
|
end
|
data/lib/review/pdfmaker.rb
CHANGED
@@ -107,10 +107,16 @@ module ReVIEW
|
|
107
107
|
@config = ReVIEW::Configure.values
|
108
108
|
@config.maker = 'pdfmaker'
|
109
109
|
cmd_config, yamlfile = parse_opts(args)
|
110
|
-
|
111
|
-
|
110
|
+
error "#{yamlfile} not found." unless File.exist?(yamlfile)
|
111
|
+
|
112
|
+
begin
|
113
|
+
loader = ReVIEW::YAMLLoader.new
|
114
|
+
@config.deep_merge!(loader.load_file(yamlfile))
|
115
|
+
rescue => e
|
116
|
+
error "yaml error #{e.message}"
|
117
|
+
end
|
112
118
|
# YAML configs will be overridden by command line options.
|
113
|
-
@config.
|
119
|
+
@config.deep_merge!(cmd_config)
|
114
120
|
I18n.setup(@config['language'])
|
115
121
|
@basedir = File.dirname(yamlfile)
|
116
122
|
@basehookdir = File.absolute_path(File.dirname(yamlfile))
|
@@ -120,7 +126,13 @@ module ReVIEW
|
|
120
126
|
rescue ReVIEW::ConfigError => e
|
121
127
|
warn e.message
|
122
128
|
end
|
123
|
-
|
129
|
+
|
130
|
+
begin
|
131
|
+
generate_pdf(yamlfile)
|
132
|
+
rescue ApplicationError => e
|
133
|
+
raise if @config['debug']
|
134
|
+
error(e.message)
|
135
|
+
end
|
124
136
|
end
|
125
137
|
|
126
138
|
def make_input_files(book, yamlfile)
|
@@ -218,9 +230,6 @@ module ReVIEW
|
|
218
230
|
|
219
231
|
check_compile_status(@config['ignore-errors'])
|
220
232
|
|
221
|
-
@config['usepackage'] = ''
|
222
|
-
@config['usepackage'] = "\\usepackage{#{@config['texstyle']}}" if @config['texstyle']
|
223
|
-
|
224
233
|
copy_images(@config['imagedir'], File.join(@path, @config['imagedir']))
|
225
234
|
copy_sty(File.join(Dir.pwd, 'sty'), @path)
|
226
235
|
copy_sty(File.join(Dir.pwd, 'sty'), @path, 'fd')
|
@@ -255,8 +264,13 @@ module ReVIEW
|
|
255
264
|
Dir.chdir(to) do
|
256
265
|
images = Dir.glob('**/*').find_all { |f| File.file?(f) and f =~ /\.(jpg|jpeg|png|pdf|ai|eps|tif)\z/ }
|
257
266
|
break if images.empty?
|
258
|
-
|
259
|
-
|
267
|
+
if @config['pdfmaker']['bbox']
|
268
|
+
system('extractbb', '-B', @config['pdfmaker']['bbox'], *images)
|
269
|
+
system_or_raise('ebb', '-B', @config['pdfmaker']['bbox'], *images) unless system('extractbb', '-B', @config['pdfmaker']['bbox'], '-m', *images)
|
270
|
+
else
|
271
|
+
system('extractbb', *images)
|
272
|
+
system_or_raise('ebb', *images) unless system('extractbb', '-m', *images)
|
273
|
+
end
|
260
274
|
end
|
261
275
|
end
|
262
276
|
|
@@ -0,0 +1,683 @@
|
|
1
|
+
# Copyright (c) 2018 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
|
+
#
|
7
|
+
|
8
|
+
require 'review/builder'
|
9
|
+
require 'review/textutils'
|
10
|
+
|
11
|
+
module ReVIEW
|
12
|
+
class PLAINTEXTBuilder < Builder
|
13
|
+
include TextUtils
|
14
|
+
|
15
|
+
%i[ttbold hint maru keytop labelref ref balloon strong].each do |e|
|
16
|
+
Compiler.definline(e)
|
17
|
+
end
|
18
|
+
Compiler.defsingle(:dtp, 1)
|
19
|
+
|
20
|
+
Compiler.defblock(:insn, 1)
|
21
|
+
Compiler.defblock(:planning, 0..1)
|
22
|
+
Compiler.defblock(:best, 0..1)
|
23
|
+
Compiler.defblock(:securty, 0..1)
|
24
|
+
Compiler.defblock(:point, 0..1)
|
25
|
+
Compiler.defblock(:reference, 0)
|
26
|
+
Compiler.defblock(:term, 0)
|
27
|
+
Compiler.defblock(:practice, 0)
|
28
|
+
Compiler.defblock(:expert, 0)
|
29
|
+
Compiler.defblock(:link, 0..1)
|
30
|
+
Compiler.defblock(:shoot, 0..1)
|
31
|
+
|
32
|
+
def pre_paragraph
|
33
|
+
''
|
34
|
+
end
|
35
|
+
|
36
|
+
def post_paragraph
|
37
|
+
''
|
38
|
+
end
|
39
|
+
|
40
|
+
def extname
|
41
|
+
'.txt'
|
42
|
+
end
|
43
|
+
|
44
|
+
def builder_init_file
|
45
|
+
@section = 0
|
46
|
+
@subsection = 0
|
47
|
+
@subsubsection = 0
|
48
|
+
@subsubsubsection = 0
|
49
|
+
@blank_seen = true
|
50
|
+
@sec_counter = SecCounter.new(5, @chapter)
|
51
|
+
end
|
52
|
+
private :builder_init_file
|
53
|
+
|
54
|
+
def olnum(num)
|
55
|
+
@ol_num = num.to_i
|
56
|
+
end
|
57
|
+
|
58
|
+
def print(s)
|
59
|
+
@blank_seen = false
|
60
|
+
super
|
61
|
+
end
|
62
|
+
private :print
|
63
|
+
|
64
|
+
def puts(s)
|
65
|
+
@blank_seen = false
|
66
|
+
super
|
67
|
+
end
|
68
|
+
private :puts
|
69
|
+
|
70
|
+
def blank
|
71
|
+
@output.puts unless @blank_seen
|
72
|
+
@blank_seen = true
|
73
|
+
end
|
74
|
+
private :blank
|
75
|
+
|
76
|
+
def result
|
77
|
+
@output.string
|
78
|
+
end
|
79
|
+
|
80
|
+
def headline(level, _label, caption)
|
81
|
+
prefix, _anchor = headline_prefix(level)
|
82
|
+
puts %Q(#{prefix}#{compile_inline(caption)})
|
83
|
+
end
|
84
|
+
|
85
|
+
def ul_begin
|
86
|
+
blank
|
87
|
+
end
|
88
|
+
|
89
|
+
def ul_item(lines)
|
90
|
+
puts lines.join
|
91
|
+
end
|
92
|
+
|
93
|
+
def ul_end
|
94
|
+
blank
|
95
|
+
end
|
96
|
+
|
97
|
+
def ol_begin
|
98
|
+
blank
|
99
|
+
@olitem = 0
|
100
|
+
end
|
101
|
+
|
102
|
+
def ol_item(lines, num)
|
103
|
+
puts "#{num} #{lines.join}"
|
104
|
+
end
|
105
|
+
|
106
|
+
def ol_end
|
107
|
+
blank
|
108
|
+
@olitem = nil
|
109
|
+
end
|
110
|
+
|
111
|
+
def dl_begin
|
112
|
+
blank
|
113
|
+
end
|
114
|
+
|
115
|
+
def dt(line)
|
116
|
+
puts line
|
117
|
+
end
|
118
|
+
|
119
|
+
def dd(lines)
|
120
|
+
split_paragraph(lines).each do |paragraph|
|
121
|
+
puts paragraph.gsub(/\n/, '')
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
def dl_end
|
126
|
+
blank
|
127
|
+
end
|
128
|
+
|
129
|
+
def paragraph(lines)
|
130
|
+
puts lines.join
|
131
|
+
end
|
132
|
+
|
133
|
+
def read(lines)
|
134
|
+
puts split_paragraph(lines).join("\n")
|
135
|
+
blank
|
136
|
+
end
|
137
|
+
|
138
|
+
alias_method :lead, :read
|
139
|
+
|
140
|
+
def inline_list(id)
|
141
|
+
chapter, id = extract_chapter_id(id)
|
142
|
+
if get_chap(chapter)
|
143
|
+
%Q(#{I18n.t('list')}#{I18n.t('format_number', [get_chap(chapter), chapter.list(id).number])})
|
144
|
+
else
|
145
|
+
%Q(#{I18n.t('list')}#{I18n.t('format_number_without_chapter', [chapter.list(id).number])})
|
146
|
+
end
|
147
|
+
rescue KeyError
|
148
|
+
error "unknown list: #{id}"
|
149
|
+
end
|
150
|
+
|
151
|
+
def list_header(id, caption, _lang)
|
152
|
+
blank
|
153
|
+
if get_chap
|
154
|
+
puts %Q(#{I18n.t('list')}#{I18n.t('format_number', [get_chap, @chapter.list(id).number])}#{I18n.t('caption_prefix_idgxml')}#{compile_inline(caption)})
|
155
|
+
else
|
156
|
+
puts %Q(#{I18n.t('list')}#{I18n.t('format_number_without_chapter', [@chapter.list(id).number])}#{I18n.t('caption_prefix_idgxml')}#{compile_inline(caption)})
|
157
|
+
end
|
158
|
+
blank
|
159
|
+
end
|
160
|
+
|
161
|
+
def list_body(_id, lines, _lang)
|
162
|
+
lines.each do |line|
|
163
|
+
puts detab(line)
|
164
|
+
end
|
165
|
+
blank
|
166
|
+
end
|
167
|
+
|
168
|
+
def base_block(_type, lines, caption = nil)
|
169
|
+
blank
|
170
|
+
puts compile_inline(caption) if caption.present?
|
171
|
+
puts lines.join("\n")
|
172
|
+
blank
|
173
|
+
end
|
174
|
+
|
175
|
+
def base_parablock(_type, lines, caption = nil)
|
176
|
+
blank
|
177
|
+
puts compile_inline(caption) if caption.present?
|
178
|
+
puts split_paragraph(lines).join("\n")
|
179
|
+
blank
|
180
|
+
end
|
181
|
+
|
182
|
+
def emlist(lines, caption = nil, _lang = nil)
|
183
|
+
base_block 'emlist', lines, caption
|
184
|
+
end
|
185
|
+
|
186
|
+
def emlistnum(lines, caption = nil, _lang = nil)
|
187
|
+
blank
|
188
|
+
puts compile_inline(caption) if caption.present?
|
189
|
+
lines.each_with_index do |line, i|
|
190
|
+
puts((i + 1).to_s.rjust(2) + ": #{line}")
|
191
|
+
end
|
192
|
+
blank
|
193
|
+
end
|
194
|
+
|
195
|
+
def listnum_body(lines, _lang)
|
196
|
+
lines.each_with_index do |line, i|
|
197
|
+
puts((i + 1).to_s.rjust(2) + ": #{line}")
|
198
|
+
end
|
199
|
+
blank
|
200
|
+
end
|
201
|
+
|
202
|
+
def cmd(lines, caption = nil)
|
203
|
+
base_block 'cmd', lines, caption
|
204
|
+
end
|
205
|
+
|
206
|
+
def quote(lines)
|
207
|
+
base_parablock 'quote', lines, nil
|
208
|
+
end
|
209
|
+
|
210
|
+
def inline_table(id)
|
211
|
+
chapter, id = extract_chapter_id(id)
|
212
|
+
if get_chap(chapter)
|
213
|
+
"#{I18n.t('table')}#{I18n.t('format_number', [get_chap(chapter), chapter.table(id).number])}"
|
214
|
+
else
|
215
|
+
"#{I18n.t('table')}#{I18n.t('format_number_without_chapter', [chapter.table(id).number])}"
|
216
|
+
end
|
217
|
+
rescue KeyError
|
218
|
+
error "unknown table: #{id}"
|
219
|
+
end
|
220
|
+
|
221
|
+
def inline_img(id)
|
222
|
+
chapter, id = extract_chapter_id(id)
|
223
|
+
if get_chap(chapter)
|
224
|
+
"#{I18n.t('image')}#{I18n.t('format_number', [get_chap(chapter), chapter.image(id).number])}"
|
225
|
+
else
|
226
|
+
"#{I18n.t('image')}#{I18n.t('format_number_without_chapter', [chapter.image(id).number])}"
|
227
|
+
end
|
228
|
+
rescue KeyError
|
229
|
+
error "unknown image: #{id}"
|
230
|
+
end
|
231
|
+
|
232
|
+
def image(_lines, id, caption, _metric = nil)
|
233
|
+
blank
|
234
|
+
if get_chap
|
235
|
+
puts "#{I18n.t('image')}#{I18n.t('format_number', [get_chap, @chapter.image(id).number])}#{I18n.t('caption_prefix_idgxml')}#{compile_inline(caption)}"
|
236
|
+
else
|
237
|
+
puts "#{I18n.t('image')}#{I18n.t('format_number_without_chapter', [@chapter.image(id).number])}#{I18n.t('caption_prefix_idgxml')}#{compile_inline(caption)}"
|
238
|
+
end
|
239
|
+
blank
|
240
|
+
end
|
241
|
+
|
242
|
+
def texequation(lines)
|
243
|
+
puts lines.join("\n")
|
244
|
+
blank
|
245
|
+
end
|
246
|
+
|
247
|
+
def table(lines, id = nil, caption = nil)
|
248
|
+
blank
|
249
|
+
rows = []
|
250
|
+
sepidx = nil
|
251
|
+
lines.each_with_index do |line, idx|
|
252
|
+
if /\A[\=\-]{12}/ =~ line
|
253
|
+
# just ignore
|
254
|
+
# error "too many table separator" if sepidx
|
255
|
+
sepidx ||= idx
|
256
|
+
next
|
257
|
+
end
|
258
|
+
rows.push(line.strip.split(/\t+/).map { |s| s.sub(/\A\./, '') })
|
259
|
+
end
|
260
|
+
rows = adjust_n_cols(rows)
|
261
|
+
|
262
|
+
begin
|
263
|
+
table_header id, caption if caption.present?
|
264
|
+
rescue KeyError
|
265
|
+
error "no such table: #{id}"
|
266
|
+
end
|
267
|
+
return if rows.empty?
|
268
|
+
table_begin rows.first.size
|
269
|
+
if sepidx
|
270
|
+
sepidx.times do
|
271
|
+
tr(rows.shift.map { |s| th(s) })
|
272
|
+
end
|
273
|
+
rows.each do |cols|
|
274
|
+
tr(cols.map { |s| td(s) })
|
275
|
+
end
|
276
|
+
else
|
277
|
+
rows.each do |cols|
|
278
|
+
h, *cs = *cols
|
279
|
+
tr([th(h)] + cs.map { |s| td(s) })
|
280
|
+
end
|
281
|
+
end
|
282
|
+
table_end
|
283
|
+
end
|
284
|
+
|
285
|
+
def table_header(id, caption)
|
286
|
+
if id.nil?
|
287
|
+
puts compile_inline(caption)
|
288
|
+
elsif get_chap
|
289
|
+
puts "#{I18n.t('table')}#{I18n.t('format_number', [get_chap, @chapter.table(id).number])}#{I18n.t('caption_prefix_idgxml')}#{compile_inline(caption)}"
|
290
|
+
else
|
291
|
+
puts "#{I18n.t('table')}#{I18n.t('format_number_without_chapter', [@chapter.table(id).number])}#{I18n.t('caption_prefix_idgxml')}#{compile_inline(caption)}"
|
292
|
+
end
|
293
|
+
blank
|
294
|
+
end
|
295
|
+
|
296
|
+
def table_begin(_ncols)
|
297
|
+
end
|
298
|
+
|
299
|
+
def imgtable(_lines, id, caption = nil, _metric = nil)
|
300
|
+
blank
|
301
|
+
table_header id, caption if caption.present?
|
302
|
+
blank
|
303
|
+
end
|
304
|
+
|
305
|
+
def tr(rows)
|
306
|
+
puts rows.join("\t")
|
307
|
+
end
|
308
|
+
|
309
|
+
def table_end
|
310
|
+
blank
|
311
|
+
end
|
312
|
+
|
313
|
+
def comment(lines, comment = nil)
|
314
|
+
end
|
315
|
+
|
316
|
+
def footnote(id, str)
|
317
|
+
puts "注#{@chapter.footnote(id).number} #{compile_inline(str)}"
|
318
|
+
end
|
319
|
+
|
320
|
+
def inline_fn(id)
|
321
|
+
" 注#{@chapter.footnote(id).number} "
|
322
|
+
rescue KeyError
|
323
|
+
error "unknown footnote: #{id}"
|
324
|
+
end
|
325
|
+
|
326
|
+
def compile_ruby(base, _ruby)
|
327
|
+
base
|
328
|
+
end
|
329
|
+
|
330
|
+
def compile_kw(word, alt)
|
331
|
+
if alt
|
332
|
+
"#{word}(#{alt.strip})"
|
333
|
+
else
|
334
|
+
word
|
335
|
+
end
|
336
|
+
end
|
337
|
+
|
338
|
+
def compile_href(url, label)
|
339
|
+
if label
|
340
|
+
"#{label}(#{url})"
|
341
|
+
else
|
342
|
+
url
|
343
|
+
end
|
344
|
+
end
|
345
|
+
|
346
|
+
def inline_raw(str)
|
347
|
+
super(str).gsub('\\n', "\n")
|
348
|
+
end
|
349
|
+
|
350
|
+
def inline_hidx(_str)
|
351
|
+
''
|
352
|
+
end
|
353
|
+
|
354
|
+
def inline_icon(_id)
|
355
|
+
''
|
356
|
+
end
|
357
|
+
|
358
|
+
def inline_balloon(str)
|
359
|
+
%Q(←#{str.gsub(/@maru\[(\d+)\]/, inline_maru('\1'))})
|
360
|
+
end
|
361
|
+
|
362
|
+
def inline_uchar(str)
|
363
|
+
[str.to_i(16)].pack('U')
|
364
|
+
end
|
365
|
+
|
366
|
+
def inline_comment(_str)
|
367
|
+
''
|
368
|
+
end
|
369
|
+
|
370
|
+
def bibpaper(lines, id, caption)
|
371
|
+
bibpaper_header id, caption
|
372
|
+
bibpaper_bibpaper id, caption, lines unless lines.empty?
|
373
|
+
end
|
374
|
+
|
375
|
+
def bibpaper_header(id, caption)
|
376
|
+
print @chapter.bibpaper(id).number
|
377
|
+
puts " #{compile_inline(caption)}"
|
378
|
+
end
|
379
|
+
|
380
|
+
def bibpaper_bibpaper(_id, _caption, lines)
|
381
|
+
print split_paragraph(lines).join
|
382
|
+
end
|
383
|
+
|
384
|
+
def inline_bib(id)
|
385
|
+
%Q(#{@chapter.bibpaper(id).number} )
|
386
|
+
rescue KeyError
|
387
|
+
error "unknown bib: #{id}"
|
388
|
+
end
|
389
|
+
|
390
|
+
def inline_hd_chap(chap, id)
|
391
|
+
if chap.number
|
392
|
+
n = chap.headline_index.number(id)
|
393
|
+
return I18n.t('chapter_quote', "#{n} #{compile_inline(chap.headline(id).caption)}") if @book.config['secnolevel'] >= n.split('.').size
|
394
|
+
end
|
395
|
+
I18n.t('chapter_quote', compile_inline(chap.headline(id).caption))
|
396
|
+
rescue KeyError
|
397
|
+
error "unknown headline: #{id}"
|
398
|
+
end
|
399
|
+
|
400
|
+
def noindent
|
401
|
+
end
|
402
|
+
|
403
|
+
def nonum_begin(_level, _label, caption)
|
404
|
+
puts compile_inline(caption)
|
405
|
+
end
|
406
|
+
|
407
|
+
def nonum_end(_level)
|
408
|
+
end
|
409
|
+
|
410
|
+
def notoc_begin(_level, _label, caption)
|
411
|
+
puts compile_inline(caption)
|
412
|
+
end
|
413
|
+
|
414
|
+
def notoc_end(level)
|
415
|
+
end
|
416
|
+
|
417
|
+
def nodisp_begin(level, label, caption)
|
418
|
+
end
|
419
|
+
|
420
|
+
def nodisp_end(level)
|
421
|
+
end
|
422
|
+
|
423
|
+
def common_column_begin(_type, caption)
|
424
|
+
blank
|
425
|
+
puts compile_inline(caption)
|
426
|
+
end
|
427
|
+
|
428
|
+
def common_column_end(_type)
|
429
|
+
blank
|
430
|
+
end
|
431
|
+
|
432
|
+
def column_begin(_level, _label, caption)
|
433
|
+
common_column_begin('column', caption)
|
434
|
+
end
|
435
|
+
|
436
|
+
def column_end(_level)
|
437
|
+
common_column_end('column')
|
438
|
+
end
|
439
|
+
|
440
|
+
def xcolumn_begin(_level, _label, caption)
|
441
|
+
common_column_begin('xcolumn', caption)
|
442
|
+
end
|
443
|
+
|
444
|
+
def xcolumn_end(_level)
|
445
|
+
common_column_end('xcolumn')
|
446
|
+
end
|
447
|
+
|
448
|
+
def world_begin(_level, _label, caption)
|
449
|
+
common_column_begin('world', caption)
|
450
|
+
end
|
451
|
+
|
452
|
+
def world_end(_level)
|
453
|
+
common_column_end('world')
|
454
|
+
end
|
455
|
+
|
456
|
+
def hood_begin(_level, _label, caption)
|
457
|
+
common_column_begin('hood', caption)
|
458
|
+
end
|
459
|
+
|
460
|
+
def hood_end(_level)
|
461
|
+
common_column_end('hood')
|
462
|
+
end
|
463
|
+
|
464
|
+
def edition_begin(_level, _label, caption)
|
465
|
+
common_column_begin('edition', caption)
|
466
|
+
end
|
467
|
+
|
468
|
+
def edition_end(_level)
|
469
|
+
common_column_end('edition')
|
470
|
+
end
|
471
|
+
|
472
|
+
def insideout_begin(_level, _label, caption)
|
473
|
+
common_column_begin('insideout', caption)
|
474
|
+
end
|
475
|
+
|
476
|
+
def insideout_end(_level)
|
477
|
+
common_column_end('insideout')
|
478
|
+
end
|
479
|
+
|
480
|
+
def ref_begin(_level, _label, caption)
|
481
|
+
common_column_begin('ref', caption)
|
482
|
+
end
|
483
|
+
|
484
|
+
def ref_end(_level)
|
485
|
+
common_column_end('ref')
|
486
|
+
end
|
487
|
+
|
488
|
+
def sup_begin(_level, _label, caption)
|
489
|
+
common_column_begin('sup', caption)
|
490
|
+
end
|
491
|
+
|
492
|
+
def sup_end(_level)
|
493
|
+
common_column_end('sup')
|
494
|
+
end
|
495
|
+
|
496
|
+
def flushright(lines)
|
497
|
+
base_parablock 'flushright', lines, nil
|
498
|
+
end
|
499
|
+
|
500
|
+
def centering(lines)
|
501
|
+
base_parablock 'centering', lines, nil
|
502
|
+
end
|
503
|
+
|
504
|
+
def note(lines, caption = nil)
|
505
|
+
base_parablock 'note', lines, caption
|
506
|
+
end
|
507
|
+
|
508
|
+
def memo(lines, caption = nil)
|
509
|
+
base_parablock 'memo', lines, caption
|
510
|
+
end
|
511
|
+
|
512
|
+
def tip(lines, caption = nil)
|
513
|
+
base_parablock 'tip', lines, caption
|
514
|
+
end
|
515
|
+
|
516
|
+
def info(lines, caption = nil)
|
517
|
+
base_parablock 'info', lines, caption
|
518
|
+
end
|
519
|
+
|
520
|
+
def planning(lines, caption = nil)
|
521
|
+
base_parablock 'planning', lines, caption
|
522
|
+
end
|
523
|
+
|
524
|
+
def best(lines, caption = nil)
|
525
|
+
base_parablock 'best', lines, caption
|
526
|
+
end
|
527
|
+
|
528
|
+
def important(lines, caption = nil)
|
529
|
+
base_parablock 'important', lines, caption
|
530
|
+
end
|
531
|
+
|
532
|
+
def security(lines, caption = nil)
|
533
|
+
base_parablock 'security', lines, caption
|
534
|
+
end
|
535
|
+
|
536
|
+
def caution(lines, caption = nil)
|
537
|
+
base_parablock 'caution', lines, caption
|
538
|
+
end
|
539
|
+
|
540
|
+
def term(lines)
|
541
|
+
base_parablock 'term', lines, nil
|
542
|
+
end
|
543
|
+
|
544
|
+
def link(lines, caption = nil)
|
545
|
+
base_parablock 'link', lines, caption
|
546
|
+
end
|
547
|
+
|
548
|
+
def notice(lines, caption = nil)
|
549
|
+
base_parablock 'notice', lines, caption
|
550
|
+
end
|
551
|
+
|
552
|
+
def point(lines, caption = nil)
|
553
|
+
base_parablock 'point', lines, caption
|
554
|
+
end
|
555
|
+
|
556
|
+
def shoot(lines, caption = nil)
|
557
|
+
base_parablock 'shoot', lines, caption
|
558
|
+
end
|
559
|
+
|
560
|
+
def reference(lines)
|
561
|
+
base_parablock 'reference', lines, nil
|
562
|
+
end
|
563
|
+
|
564
|
+
def practice(lines)
|
565
|
+
base_parablock 'practice', lines, nil
|
566
|
+
end
|
567
|
+
|
568
|
+
def expert(lines)
|
569
|
+
base_parablock 'expert', lines, nil
|
570
|
+
end
|
571
|
+
|
572
|
+
def insn(lines, caption = nil)
|
573
|
+
base_block 'insn', lines, caption
|
574
|
+
end
|
575
|
+
|
576
|
+
def warning(lines, caption = nil)
|
577
|
+
base_parablock 'warning', lines, caption
|
578
|
+
end
|
579
|
+
|
580
|
+
alias_method :box, :insn
|
581
|
+
|
582
|
+
def indepimage(_lines, _id, caption = nil, _metric = nil)
|
583
|
+
blank
|
584
|
+
puts "図 #{compile_inline(caption)}" if caption.present?
|
585
|
+
blank
|
586
|
+
end
|
587
|
+
|
588
|
+
alias_method :numberlessimage, :indepimage
|
589
|
+
|
590
|
+
def label(_id)
|
591
|
+
''
|
592
|
+
end
|
593
|
+
|
594
|
+
def dtp(str)
|
595
|
+
end
|
596
|
+
|
597
|
+
def bpo(lines)
|
598
|
+
base_block 'bpo', lines, nil
|
599
|
+
end
|
600
|
+
|
601
|
+
def inline_dtp(_str)
|
602
|
+
''
|
603
|
+
end
|
604
|
+
|
605
|
+
def inline_del(_str)
|
606
|
+
''
|
607
|
+
end
|
608
|
+
|
609
|
+
def inline_br(_str)
|
610
|
+
"\n"
|
611
|
+
end
|
612
|
+
|
613
|
+
def text(str)
|
614
|
+
str
|
615
|
+
end
|
616
|
+
|
617
|
+
def inline_chap(id)
|
618
|
+
# "「第#{super}章 #{inline_title(id)}」"
|
619
|
+
# "第#{super}章"
|
620
|
+
super
|
621
|
+
end
|
622
|
+
|
623
|
+
def inline_chapref(id)
|
624
|
+
chs = ['', '「', '」']
|
625
|
+
if @book.config['chapref']
|
626
|
+
chs2 = @book.config['chapref'].split(',')
|
627
|
+
error '--chapsplitter must have exactly 3 parameters with comma.' if chs2.size != 3
|
628
|
+
chs = chs2
|
629
|
+
end
|
630
|
+
"#{chs[0]}#{@book.chapter_index.number(id)}#{chs[1]}#{@book.chapter_index.title(id)}#{chs[2]}"
|
631
|
+
rescue KeyError
|
632
|
+
error "unknown chapter: #{id}"
|
633
|
+
end
|
634
|
+
|
635
|
+
def source(lines, caption = nil, _lang = nil)
|
636
|
+
base_block 'source', lines, caption
|
637
|
+
end
|
638
|
+
|
639
|
+
def inline_labelref(_idref)
|
640
|
+
'●'
|
641
|
+
end
|
642
|
+
|
643
|
+
alias_method :inline_ref, :inline_labelref
|
644
|
+
|
645
|
+
def inline_pageref(_idref)
|
646
|
+
'●ページ' # ページ番号を参照
|
647
|
+
end
|
648
|
+
|
649
|
+
def circle_begin(_level, _label, caption)
|
650
|
+
puts "・#{caption}"
|
651
|
+
end
|
652
|
+
|
653
|
+
def circle_end(level)
|
654
|
+
end
|
655
|
+
|
656
|
+
def nofunc_text(str)
|
657
|
+
str
|
658
|
+
end
|
659
|
+
|
660
|
+
alias_method :th, :nofunc_text
|
661
|
+
alias_method :td, :nofunc_text
|
662
|
+
alias_method :inline_sup, :nofunc_text
|
663
|
+
alias_method :inline_sub, :nofunc_text
|
664
|
+
alias_method :inline_hint, :nofunc_text
|
665
|
+
alias_method :inline_maru, :nofunc_text
|
666
|
+
alias_method :inline_idx, :nofunc_text
|
667
|
+
alias_method :inline_ami, :nofunc_text
|
668
|
+
alias_method :inline_i, :nofunc_text
|
669
|
+
alias_method :inline_em, :nofunc_text
|
670
|
+
alias_method :inline_b, :nofunc_text
|
671
|
+
alias_method :inline_strong, :nofunc_text
|
672
|
+
alias_method :inline_tt, :nofunc_text
|
673
|
+
alias_method :inline_code, :nofunc_text
|
674
|
+
alias_method :inline_ttb, :nofunc_text
|
675
|
+
alias_method :inline_ttbold, :nofunc_text
|
676
|
+
alias_method :inline_tti, :nofunc_text
|
677
|
+
alias_method :inline_ttibold, :nofunc_text
|
678
|
+
alias_method :inline_u, :nofunc_text
|
679
|
+
alias_method :inline_bou, :nofunc_text
|
680
|
+
alias_method :inline_keytop, :nofunc_text
|
681
|
+
alias_method :inline_m, :nofunc_text
|
682
|
+
end
|
683
|
+
end # module ReVIEW
|