review 2.1.0 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +5 -0
- data/.rubocop.yml +293 -6
- data/.rubocop_todo.yml +3 -608
- data/.travis.yml +6 -13
- data/README.md +5 -3
- data/Rakefile +6 -6
- data/bin/review-catalog-converter +2 -2
- data/bin/review-check +1 -1
- data/bin/review-compile +1 -2
- data/bin/review-init +6 -3
- data/bin/review-validate +3 -3
- data/bin/review-vol +2 -1
- data/doc/NEWS.ja.md +138 -25
- data/doc/NEWS.md +137 -25
- data/doc/config.yml.sample +2 -2
- data/doc/config.yml.sample-simple +1 -1
- data/doc/format.ja.md +86 -5
- data/doc/format.md +67 -2
- data/doc/makeindex.ja.md +95 -0
- data/doc/makeindex.md +97 -0
- data/doc/sample.css +214 -0
- data/lib/epubmaker.rb +6 -6
- data/lib/epubmaker/epubcommon.rb +19 -47
- data/lib/epubmaker/epubv2.rb +3 -1
- data/lib/epubmaker/epubv3.rb +4 -26
- data/lib/epubmaker/producer.rb +46 -46
- data/lib/epubmaker/zip_exporter.rb +86 -0
- data/lib/review/book/base.rb +13 -15
- data/lib/review/book/chapter.rb +2 -1
- data/lib/review/book/compilable.rb +9 -9
- data/lib/review/book/image_finder.rb +13 -13
- data/lib/review/book/index.rb +2 -2
- data/lib/review/book/volume.rb +2 -2
- data/lib/review/builder.rb +57 -1
- data/lib/review/catalog.rb +2 -2
- data/lib/review/compiler.rb +15 -7
- data/lib/review/configure.rb +11 -0
- data/lib/review/epubmaker.rb +403 -401
- data/lib/review/ewbbuilder.rb +16 -16
- data/lib/review/htmlbuilder.rb +42 -58
- data/lib/review/htmltoc.rb +1 -1
- data/lib/review/htmlutils.rb +50 -4
- data/lib/review/i18n.rb +2 -2
- data/lib/review/idgxmlbuilder.rb +30 -47
- data/lib/review/latexbuilder.rb +86 -41
- data/lib/review/latexutils.rb +19 -19
- data/lib/review/markdownbuilder.rb +16 -4
- data/lib/review/md2inaobuilder.rb +0 -9
- data/lib/review/pdfmaker.rb +91 -48
- data/lib/review/preprocessor.rb +1 -1
- data/lib/review/rstbuilder.rb +763 -0
- data/lib/review/sec_counter.rb +7 -9
- data/lib/review/tocparser.rb +3 -3
- data/lib/review/tocprinter.rb +5 -5
- data/lib/review/topbuilder.rb +48 -56
- data/lib/review/version.rb +1 -1
- data/lib/review/webmaker.rb +6 -7
- data/review.gemspec +1 -0
- data/templates/latex/layout.tex.erb +27 -2
- data/test/assets/test_template.tex +10 -1
- data/test/book_test_helper.rb +1 -2
- data/test/run_test.rb +10 -0
- data/test/sample-book/src/style.css +215 -0
- data/test/sample-book/src/vendor/jumoline/lppl.txt +416 -0
- data/test/test_book.rb +0 -1
- data/test/test_catalog.rb +1 -0
- data/test/test_converter.rb +1 -1
- data/test/test_epub3maker.rb +44 -51
- data/test/test_epubmaker.rb +82 -38
- data/test/test_epubmaker_cmd.rb +1 -1
- data/test/test_extentions_hash.rb +8 -1
- data/test/test_htmlbuilder.rb +411 -18
- data/test/test_i18n.rb +17 -0
- data/test/test_idgxmlbuilder.rb +88 -3
- data/test/test_image_finder.rb +18 -0
- data/test/test_index.rb +2 -0
- data/test/test_latexbuilder.rb +96 -8
- data/test/test_makerhelper.rb +2 -2
- data/test/test_markdownbuilder.rb +22 -1
- data/test/test_md2inaobuilder.rb +0 -5
- data/test/test_pdfmaker.rb +54 -36
- data/test/test_pdfmaker_cmd.rb +1 -1
- data/test/test_rstbuilder.rb +356 -0
- data/test/test_textutils.rb +14 -4
- data/test/test_topbuilder.rb +23 -4
- data/test/test_zip_exporter.rb +113 -0
- metadata +28 -2
data/lib/review/preprocessor.rb
CHANGED
@@ -0,0 +1,763 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
#
|
3
|
+
# Copyright (c) 2002-2006 Minero Aoki
|
4
|
+
# 2008-2016 Minero Aoki, Kenshi Muto
|
5
|
+
#
|
6
|
+
# This program is free software.
|
7
|
+
# You can distribute or modify this program under the terms of
|
8
|
+
# the GNU LGPL, Lesser General Public License version 2.1.
|
9
|
+
#
|
10
|
+
|
11
|
+
require 'review/builder'
|
12
|
+
require 'review/textutils'
|
13
|
+
|
14
|
+
module ReVIEW
|
15
|
+
|
16
|
+
#
|
17
|
+
# RSTBuilder is a builder for reStructuredText (http://docutils.sourceforge.net/rst.html).
|
18
|
+
# reStructuredText is used in Sphinx (http://www.sphinx-doc.org/).
|
19
|
+
#
|
20
|
+
# If you want to use `ruby`, `del` and `column`, you sould use sphinxcontrib-textstyle
|
21
|
+
# package (https://pypi.python.org/pypi/sphinxcontrib-textstyle).
|
22
|
+
#
|
23
|
+
class RSTBuilder < Builder
|
24
|
+
|
25
|
+
include TextUtils
|
26
|
+
|
27
|
+
[:ttbold, :hint, :maru, :keytop, :labelref, :ref, :pageref, :balloon, :strong].each {|e|
|
28
|
+
Compiler.definline(e)
|
29
|
+
}
|
30
|
+
Compiler.defsingle(:dtp, 1)
|
31
|
+
|
32
|
+
Compiler.defblock(:insn, 1)
|
33
|
+
Compiler.defblock(:planning, 0..1)
|
34
|
+
Compiler.defblock(:best, 0..1)
|
35
|
+
Compiler.defblock(:securty, 0..1)
|
36
|
+
Compiler.defblock(:point, 0..1)
|
37
|
+
Compiler.defblock(:reference, 0)
|
38
|
+
Compiler.defblock(:term, 0)
|
39
|
+
Compiler.defblock(:practice, 0)
|
40
|
+
Compiler.defblock(:expert, 0)
|
41
|
+
Compiler.defblock(:link, 0..1)
|
42
|
+
Compiler.defblock(:shoot, 0..1)
|
43
|
+
|
44
|
+
def pre_paragraph
|
45
|
+
''
|
46
|
+
end
|
47
|
+
|
48
|
+
def post_paragraph
|
49
|
+
''
|
50
|
+
end
|
51
|
+
|
52
|
+
def image_ext
|
53
|
+
"png"
|
54
|
+
end
|
55
|
+
|
56
|
+
def extname
|
57
|
+
'.rst'
|
58
|
+
end
|
59
|
+
|
60
|
+
def builder_init_file
|
61
|
+
@section = 0
|
62
|
+
@subsection = 0
|
63
|
+
@subsubsection = 0
|
64
|
+
@subsubsubsection = 0
|
65
|
+
@blank_seen = true
|
66
|
+
@sec_counter = SecCounter.new(5, @chapter)
|
67
|
+
@ul_indent = 0
|
68
|
+
@ol_indent = 0
|
69
|
+
@in_role = false
|
70
|
+
@in_table = false
|
71
|
+
end
|
72
|
+
private :builder_init_file
|
73
|
+
|
74
|
+
def print(s)
|
75
|
+
@blank_seen = false
|
76
|
+
super
|
77
|
+
end
|
78
|
+
private :print
|
79
|
+
|
80
|
+
def puts(s)
|
81
|
+
@blank_seen = false
|
82
|
+
super
|
83
|
+
end
|
84
|
+
private :puts
|
85
|
+
|
86
|
+
def blank
|
87
|
+
@output.puts unless @blank_seen
|
88
|
+
@blank_seen = true
|
89
|
+
end
|
90
|
+
private :blank
|
91
|
+
|
92
|
+
def result
|
93
|
+
@output.string
|
94
|
+
end
|
95
|
+
|
96
|
+
def warn(msg)
|
97
|
+
$stderr.puts "#{@location.filename}:#{@location.lineno}: warning: #{msg}"
|
98
|
+
end
|
99
|
+
|
100
|
+
def error(msg)
|
101
|
+
$stderr.puts "#{@location.filename}:#{@location.lineno}: error: #{msg}"
|
102
|
+
end
|
103
|
+
|
104
|
+
def headline(level, label, caption)
|
105
|
+
blank
|
106
|
+
if label
|
107
|
+
puts ".. _#{label}:"
|
108
|
+
blank
|
109
|
+
end
|
110
|
+
p = "="
|
111
|
+
case level
|
112
|
+
when 1 then
|
113
|
+
unless label
|
114
|
+
puts ".. _#{@chapter.name}:"
|
115
|
+
blank
|
116
|
+
end
|
117
|
+
puts "=" * caption.size * 2
|
118
|
+
when 2 then
|
119
|
+
p = "="
|
120
|
+
when 3 then
|
121
|
+
p = "-"
|
122
|
+
when 4 then
|
123
|
+
p = "`"
|
124
|
+
when 5 then
|
125
|
+
p = "~"
|
126
|
+
end
|
127
|
+
|
128
|
+
puts "#{caption}"
|
129
|
+
puts p * caption.size * 2
|
130
|
+
blank
|
131
|
+
end
|
132
|
+
|
133
|
+
def ul_begin
|
134
|
+
blank
|
135
|
+
@ul_indent += 1
|
136
|
+
end
|
137
|
+
|
138
|
+
def ul_item(lines)
|
139
|
+
puts " " * (@ul_indent - 1) + "* #{lines.join}"
|
140
|
+
end
|
141
|
+
|
142
|
+
def ul_end
|
143
|
+
@ul_indent -= 1
|
144
|
+
blank
|
145
|
+
end
|
146
|
+
|
147
|
+
def ol_begin
|
148
|
+
blank
|
149
|
+
@ol_indent += 1
|
150
|
+
end
|
151
|
+
|
152
|
+
def ol_item(lines, num)
|
153
|
+
puts " " * (@ol_indent - 1) + "#. #{lines.join}"
|
154
|
+
end
|
155
|
+
|
156
|
+
def ol_end
|
157
|
+
@ol_indent -= 1
|
158
|
+
blank
|
159
|
+
end
|
160
|
+
|
161
|
+
def dl_begin
|
162
|
+
end
|
163
|
+
|
164
|
+
def dt(line)
|
165
|
+
puts "#{line}"
|
166
|
+
end
|
167
|
+
|
168
|
+
def dd(lines)
|
169
|
+
split_paragraph(lines).each do |paragraph|
|
170
|
+
puts " #{paragraph.gsub(/\n/, '')}"
|
171
|
+
end
|
172
|
+
end
|
173
|
+
|
174
|
+
def dl_end
|
175
|
+
end
|
176
|
+
|
177
|
+
def paragraph(lines)
|
178
|
+
pre = ""
|
179
|
+
if @in_role == true
|
180
|
+
pre = " "
|
181
|
+
end
|
182
|
+
puts pre + lines.join
|
183
|
+
puts "\n"
|
184
|
+
end
|
185
|
+
|
186
|
+
def read(lines)
|
187
|
+
puts split_paragraph(lines).map{|line| " #{line}"}.join("")
|
188
|
+
blank
|
189
|
+
end
|
190
|
+
|
191
|
+
alias_method :lead, :read
|
192
|
+
|
193
|
+
def hr
|
194
|
+
puts "----"
|
195
|
+
end
|
196
|
+
|
197
|
+
def inline_list(id)
|
198
|
+
" :numref:`#{id}` "
|
199
|
+
end
|
200
|
+
|
201
|
+
def list_header(id, caption, lang)
|
202
|
+
puts ".. _#{id}:"
|
203
|
+
blank
|
204
|
+
end
|
205
|
+
|
206
|
+
def list_body(id, lines, lang)
|
207
|
+
lines.each do |line|
|
208
|
+
puts '-' + detab(line)
|
209
|
+
end
|
210
|
+
end
|
211
|
+
|
212
|
+
def base_block(type, lines, caption = nil)
|
213
|
+
blank
|
214
|
+
puts "#{compile_inline(caption)}" unless caption.nil?
|
215
|
+
puts lines.join("\n")
|
216
|
+
blank
|
217
|
+
end
|
218
|
+
|
219
|
+
def base_parablock(type, lines, caption = nil)
|
220
|
+
puts ".. #{type}::"
|
221
|
+
blank
|
222
|
+
puts " #{compile_inline(caption)}" unless caption.nil?
|
223
|
+
puts " " + split_paragraph(lines).join("\n")
|
224
|
+
blank
|
225
|
+
end
|
226
|
+
|
227
|
+
def emlist(lines, caption = nil, lang = nil)
|
228
|
+
blank
|
229
|
+
if caption
|
230
|
+
puts caption
|
231
|
+
print "\n"
|
232
|
+
end
|
233
|
+
lang ||= "none"
|
234
|
+
puts ".. code-block:: #{lang}"
|
235
|
+
blank
|
236
|
+
lines.each do |line|
|
237
|
+
puts " " + detab(line)
|
238
|
+
end
|
239
|
+
blank
|
240
|
+
end
|
241
|
+
|
242
|
+
def emlistnum(lines, caption = nil, lang = nil)
|
243
|
+
blank
|
244
|
+
if caption
|
245
|
+
puts caption
|
246
|
+
print "\n"
|
247
|
+
end
|
248
|
+
lang ||= "none"
|
249
|
+
puts ".. code-block:: #{lang}"
|
250
|
+
puts " :linenos:"
|
251
|
+
blank
|
252
|
+
lines.each do |line|
|
253
|
+
puts " " + detab(line)
|
254
|
+
end
|
255
|
+
blank
|
256
|
+
end
|
257
|
+
|
258
|
+
def listnum_body(lines, lang)
|
259
|
+
lines.each_with_index do |line, i|
|
260
|
+
puts(i + 1).to_s.rjust(2) + ": #{line}"
|
261
|
+
end
|
262
|
+
blank
|
263
|
+
end
|
264
|
+
|
265
|
+
def cmd(lines, caption = nil)
|
266
|
+
puts ".. code-block:: bash"
|
267
|
+
lines.each do |line|
|
268
|
+
puts " " + detab(line)
|
269
|
+
end
|
270
|
+
end
|
271
|
+
|
272
|
+
def quote(lines)
|
273
|
+
blank
|
274
|
+
puts lines.map{|line| " #{line}"}.join("")
|
275
|
+
blank
|
276
|
+
end
|
277
|
+
|
278
|
+
def inline_table(id)
|
279
|
+
"表 :numref:`#{id}` "
|
280
|
+
end
|
281
|
+
|
282
|
+
def inline_img(id)
|
283
|
+
" :numref:`#{id}` "
|
284
|
+
end
|
285
|
+
|
286
|
+
def image_image(id, caption, metric)
|
287
|
+
chapter, id = extract_chapter_id(id)
|
288
|
+
if metric
|
289
|
+
scale = metric.split("=")[1].to_f * 100
|
290
|
+
end
|
291
|
+
|
292
|
+
puts ".. _#{id}:"
|
293
|
+
blank
|
294
|
+
puts ".. figure:: images/#{chapter.name}/#{id}.#{image_ext}"
|
295
|
+
puts " :scale:#{scale}%" if scale
|
296
|
+
blank
|
297
|
+
puts " #{caption}"
|
298
|
+
blank
|
299
|
+
end
|
300
|
+
|
301
|
+
def image_dummy(id, caption, lines)
|
302
|
+
chapter, id = extract_chapter_id(id)
|
303
|
+
puts ".. _#{id}:"
|
304
|
+
blank
|
305
|
+
puts ".. figure:: images/#{chapter.name}/#{id}.#{image_ext}"
|
306
|
+
blank
|
307
|
+
puts " #{caption}"
|
308
|
+
puts " #{lines.join}"
|
309
|
+
blank
|
310
|
+
end
|
311
|
+
|
312
|
+
def texequation(lines)
|
313
|
+
puts ".. math::"
|
314
|
+
blank
|
315
|
+
puts lines.map{|line| " #{line}"}.join("")
|
316
|
+
blank
|
317
|
+
end
|
318
|
+
|
319
|
+
def table_header(id, caption)
|
320
|
+
blank
|
321
|
+
puts ".. _#{id}:"
|
322
|
+
blank
|
323
|
+
puts ".. list-table:: #{compile_inline(caption)}"
|
324
|
+
puts " :header-rows: 1"
|
325
|
+
blank
|
326
|
+
end
|
327
|
+
|
328
|
+
def table_begin(ncols)
|
329
|
+
end
|
330
|
+
|
331
|
+
def tr(rows)
|
332
|
+
first = true
|
333
|
+
rows.each{|row|
|
334
|
+
if first
|
335
|
+
puts " * - #{row}"
|
336
|
+
first = false
|
337
|
+
else
|
338
|
+
puts " - #{row}"
|
339
|
+
end
|
340
|
+
}
|
341
|
+
end
|
342
|
+
|
343
|
+
def th(str)
|
344
|
+
str
|
345
|
+
end
|
346
|
+
|
347
|
+
def td(str)
|
348
|
+
str
|
349
|
+
end
|
350
|
+
|
351
|
+
def table_end
|
352
|
+
blank
|
353
|
+
end
|
354
|
+
|
355
|
+
def comment(lines, comment = nil)
|
356
|
+
puts lines.map{|line| " .. #{line}"}.join("")
|
357
|
+
end
|
358
|
+
|
359
|
+
def footnote(id, str)
|
360
|
+
puts ".. [##{id.sub(" ", "_")}] #{compile_inline(str)}"
|
361
|
+
blank
|
362
|
+
end
|
363
|
+
|
364
|
+
def inline_fn(id)
|
365
|
+
" [##{id.sub(" ", "_")}]_ "
|
366
|
+
end
|
367
|
+
|
368
|
+
def compile_ruby(base, ruby)
|
369
|
+
" :ruby:`#{base}`<#{ruby}>`_ "
|
370
|
+
end
|
371
|
+
|
372
|
+
def compile_kw(word, alt)
|
373
|
+
if alt
|
374
|
+
then " **#{word}(#{alt.strip})** "
|
375
|
+
else " **#{word}** "
|
376
|
+
end
|
377
|
+
end
|
378
|
+
|
379
|
+
def compile_href(url, label)
|
380
|
+
label = url if label.blank?
|
381
|
+
" `#{label} <#{url}>`_ "
|
382
|
+
end
|
383
|
+
|
384
|
+
def inline_sup(str)
|
385
|
+
" :superscript:`str` "
|
386
|
+
end
|
387
|
+
|
388
|
+
def inline_sub(str)
|
389
|
+
" :subscript:`str` "
|
390
|
+
end
|
391
|
+
|
392
|
+
def inline_raw(str)
|
393
|
+
matched = str.match(/\|(.*?)\|(.*)/)
|
394
|
+
if matched
|
395
|
+
matched[2].gsub("\\n", "\n")
|
396
|
+
else
|
397
|
+
str.gsub("\\n", "\n")
|
398
|
+
end
|
399
|
+
end
|
400
|
+
|
401
|
+
def inline_hint(str)
|
402
|
+
# TODO: hint is not default role
|
403
|
+
" :hint:`#{str}` "
|
404
|
+
end
|
405
|
+
|
406
|
+
def inline_maru(str)
|
407
|
+
# TODO: maru is not default role
|
408
|
+
" :maru:`#{str}` "
|
409
|
+
end
|
410
|
+
|
411
|
+
def inline_idx(str)
|
412
|
+
" :index:`#{str}` "
|
413
|
+
end
|
414
|
+
|
415
|
+
def inline_hidx(str)
|
416
|
+
" :index:`#{str}` "
|
417
|
+
end
|
418
|
+
|
419
|
+
def inline_ami(str)
|
420
|
+
# TODO: ami is not default role
|
421
|
+
" :ami:`#{str}` "
|
422
|
+
end
|
423
|
+
|
424
|
+
def inline_i(str)
|
425
|
+
" *#{str.gsub(/\*/, '\*')}* "
|
426
|
+
end
|
427
|
+
|
428
|
+
def inline_b(str)
|
429
|
+
" **#{str.gsub(/\*/, '\*')}** "
|
430
|
+
end
|
431
|
+
|
432
|
+
alias_method :inline_strong, :inline_b
|
433
|
+
|
434
|
+
def inline_tt(str)
|
435
|
+
" ``#{str}`` "
|
436
|
+
end
|
437
|
+
|
438
|
+
alias_method :inline_ttb, :inline_tt # TODO
|
439
|
+
alias_method :inline_tti, :inline_tt # TODO
|
440
|
+
|
441
|
+
alias_method :inline_ttbold, :inline_ttb
|
442
|
+
|
443
|
+
def inline_u(str)
|
444
|
+
" :subscript:`str` "
|
445
|
+
end
|
446
|
+
|
447
|
+
def inline_icon(id)
|
448
|
+
" :ref:`#{id}` "
|
449
|
+
end
|
450
|
+
|
451
|
+
def inline_bou(str)
|
452
|
+
# TODO: bou is not default role
|
453
|
+
" :bou:`#{str}` "
|
454
|
+
end
|
455
|
+
|
456
|
+
def inline_keytop(str)
|
457
|
+
# TODO: keytop is not default role
|
458
|
+
" :keytop:`#{str}` "
|
459
|
+
end
|
460
|
+
|
461
|
+
def inline_balloon(str)
|
462
|
+
%Q(\t←#{str.gsub(/@maru\[(\d+)\]/, inline_maru('\1'))})
|
463
|
+
end
|
464
|
+
|
465
|
+
def inline_uchar(str)
|
466
|
+
[str.to_i(16)].pack("U")
|
467
|
+
end
|
468
|
+
|
469
|
+
def inline_comment(str)
|
470
|
+
if @book.config["draft"]
|
471
|
+
"#{str}"
|
472
|
+
else
|
473
|
+
""
|
474
|
+
end
|
475
|
+
end
|
476
|
+
|
477
|
+
def inline_m(str)
|
478
|
+
" :math:`#{str}` "
|
479
|
+
end
|
480
|
+
|
481
|
+
def inline_hd_chap(chap, id)
|
482
|
+
" :ref:`#{id}` "
|
483
|
+
end
|
484
|
+
|
485
|
+
def noindent
|
486
|
+
# TODO
|
487
|
+
end
|
488
|
+
|
489
|
+
def nonum_begin(level, label, caption)
|
490
|
+
puts ".. rubric: #{compile_inline(caption)}"
|
491
|
+
blank
|
492
|
+
end
|
493
|
+
|
494
|
+
def nonum_end(level)
|
495
|
+
end
|
496
|
+
|
497
|
+
def common_column_begin(type, caption)
|
498
|
+
blank
|
499
|
+
puts ".. column:: #{compile_inline(caption)}"
|
500
|
+
blank
|
501
|
+
@in_role = true
|
502
|
+
end
|
503
|
+
|
504
|
+
def common_column_end(type)
|
505
|
+
@in_role = false
|
506
|
+
blank
|
507
|
+
end
|
508
|
+
|
509
|
+
def column_begin(level, label, caption)
|
510
|
+
common_column_begin("column", caption)
|
511
|
+
end
|
512
|
+
|
513
|
+
def column_end(level)
|
514
|
+
common_column_end("column")
|
515
|
+
end
|
516
|
+
|
517
|
+
def xcolumn_begin(level, label, caption)
|
518
|
+
common_column_begin("xcolumn", caption)
|
519
|
+
end
|
520
|
+
|
521
|
+
def xcolumn_end(level)
|
522
|
+
common_column_end("xcolumn")
|
523
|
+
end
|
524
|
+
|
525
|
+
def world_begin(level, label, caption)
|
526
|
+
common_column_begin("world", caption)
|
527
|
+
end
|
528
|
+
|
529
|
+
def world_end(level)
|
530
|
+
common_column_end("world")
|
531
|
+
end
|
532
|
+
|
533
|
+
def hood_begin(level, label, caption)
|
534
|
+
common_column_begin("hood", caption)
|
535
|
+
end
|
536
|
+
|
537
|
+
def hood_end(level)
|
538
|
+
common_column_end("hood")
|
539
|
+
end
|
540
|
+
|
541
|
+
def edition_begin(level, label, caption)
|
542
|
+
common_column_begin("edition", caption)
|
543
|
+
end
|
544
|
+
|
545
|
+
def edition_end(level)
|
546
|
+
common_column_end("edition")
|
547
|
+
end
|
548
|
+
|
549
|
+
def insideout_begin(level, label, caption)
|
550
|
+
common_column_begin("insideout", caption)
|
551
|
+
end
|
552
|
+
|
553
|
+
def insideout_end(level)
|
554
|
+
common_column_end("insideout")
|
555
|
+
end
|
556
|
+
|
557
|
+
def ref_begin(level, label, caption)
|
558
|
+
common_column_begin("ref", caption)
|
559
|
+
end
|
560
|
+
|
561
|
+
def ref_end(level)
|
562
|
+
common_column_end("ref")
|
563
|
+
end
|
564
|
+
|
565
|
+
def sup_begin(level, label, caption)
|
566
|
+
common_column_begin("sup", caption)
|
567
|
+
end
|
568
|
+
|
569
|
+
def sup_end(level)
|
570
|
+
common_column_end("sup")
|
571
|
+
end
|
572
|
+
|
573
|
+
def flushright(lines)
|
574
|
+
base_parablock "flushright", lines, nil
|
575
|
+
end
|
576
|
+
|
577
|
+
def centering(lines)
|
578
|
+
base_parablock "centering", lines, nil
|
579
|
+
end
|
580
|
+
|
581
|
+
def note(lines, caption = nil)
|
582
|
+
base_parablock "note", lines, caption
|
583
|
+
end
|
584
|
+
|
585
|
+
def memo(lines, caption = nil)
|
586
|
+
base_parablock "memo", lines, caption
|
587
|
+
end
|
588
|
+
|
589
|
+
def tip(lines, caption = nil)
|
590
|
+
base_parablock "tip", lines, caption
|
591
|
+
end
|
592
|
+
|
593
|
+
def info(lines, caption = nil)
|
594
|
+
base_parablock "info", lines, caption
|
595
|
+
end
|
596
|
+
|
597
|
+
def planning(lines, caption = nil)
|
598
|
+
base_parablock "planning", lines, caption
|
599
|
+
end
|
600
|
+
|
601
|
+
def best(lines, caption = nil)
|
602
|
+
base_parablock "best", lines, caption
|
603
|
+
end
|
604
|
+
|
605
|
+
def important(lines, caption = nil)
|
606
|
+
base_parablock "important", lines, caption
|
607
|
+
end
|
608
|
+
|
609
|
+
def security(lines, caption = nil)
|
610
|
+
base_parablock "security", lines, caption
|
611
|
+
end
|
612
|
+
|
613
|
+
def caution(lines, caption = nil)
|
614
|
+
base_parablock "caution", lines, caption
|
615
|
+
end
|
616
|
+
|
617
|
+
def term(lines)
|
618
|
+
base_parablock "term", lines, nil
|
619
|
+
end
|
620
|
+
|
621
|
+
def link(lines, caption = nil)
|
622
|
+
base_parablock "link", lines, caption
|
623
|
+
end
|
624
|
+
|
625
|
+
def notice(lines, caption = nil)
|
626
|
+
base_parablock "notice", lines, caption
|
627
|
+
end
|
628
|
+
|
629
|
+
def point(lines, caption = nil)
|
630
|
+
base_parablock "point", lines, caption
|
631
|
+
end
|
632
|
+
|
633
|
+
def shoot(lines, caption = nil)
|
634
|
+
base_parablock "shoot", lines, caption
|
635
|
+
end
|
636
|
+
|
637
|
+
def reference(lines)
|
638
|
+
base_parablock "reference", lines, nil
|
639
|
+
end
|
640
|
+
|
641
|
+
def practice(lines)
|
642
|
+
base_parablock "practice", lines, nil
|
643
|
+
end
|
644
|
+
|
645
|
+
def expert(lines)
|
646
|
+
base_parablock "expert", lines, nil
|
647
|
+
end
|
648
|
+
|
649
|
+
def insn(lines, caption = nil)
|
650
|
+
base_block "insn", lines, caption
|
651
|
+
end
|
652
|
+
|
653
|
+
def warning(lines, caption = nil)
|
654
|
+
base_parablock "warning", lines, caption
|
655
|
+
end
|
656
|
+
|
657
|
+
alias_method :box, :insn
|
658
|
+
|
659
|
+
def indepimage(id, caption = "", metric = nil)
|
660
|
+
chapter, id = extract_chapter_id(id)
|
661
|
+
puts ".. _#{id}:"
|
662
|
+
blank
|
663
|
+
puts ".. figure:: images/#{chapter.name}/#{id}.#{image_ext}"
|
664
|
+
blank
|
665
|
+
puts " #{compile_inline(caption)}"
|
666
|
+
blank
|
667
|
+
end
|
668
|
+
|
669
|
+
alias_method :numberlessimage, :indepimage
|
670
|
+
|
671
|
+
def label(id)
|
672
|
+
puts ".. _#{id}:"
|
673
|
+
blank
|
674
|
+
end
|
675
|
+
|
676
|
+
def dtp(str)
|
677
|
+
# FIXME
|
678
|
+
end
|
679
|
+
|
680
|
+
def bpo(lines)
|
681
|
+
base_block "bpo", lines, nil
|
682
|
+
end
|
683
|
+
|
684
|
+
def inline_dtp(str)
|
685
|
+
""
|
686
|
+
end
|
687
|
+
|
688
|
+
def inline_del(str)
|
689
|
+
" :del:`str` "
|
690
|
+
end
|
691
|
+
|
692
|
+
def inline_code(str)
|
693
|
+
" :code:`#{str}` "
|
694
|
+
end
|
695
|
+
|
696
|
+
def inline_br(str)
|
697
|
+
%Q(\n)
|
698
|
+
end
|
699
|
+
|
700
|
+
def text(str)
|
701
|
+
str
|
702
|
+
end
|
703
|
+
|
704
|
+
def inline_chap(id)
|
705
|
+
super
|
706
|
+
end
|
707
|
+
|
708
|
+
def inline_chapref(id)
|
709
|
+
" :numref:`#{id}` "
|
710
|
+
end
|
711
|
+
|
712
|
+
def source(lines, caption = nil, lang = nil)
|
713
|
+
base_block "source", lines, caption
|
714
|
+
end
|
715
|
+
|
716
|
+
def inline_ttibold(str)
|
717
|
+
# TODO
|
718
|
+
" **#{str}** "
|
719
|
+
end
|
720
|
+
|
721
|
+
def inline_labelref(idref)
|
722
|
+
end
|
723
|
+
|
724
|
+
alias_method :inline_ref, :inline_labelref
|
725
|
+
|
726
|
+
def inline_pageref(idref)
|
727
|
+
" :ref:`#{idref}` "
|
728
|
+
end
|
729
|
+
|
730
|
+
def circle_begin(level, label, caption)
|
731
|
+
puts "・\t#{caption}"
|
732
|
+
end
|
733
|
+
|
734
|
+
def circle_end(level)
|
735
|
+
end
|
736
|
+
|
737
|
+
def nofunc_text(str)
|
738
|
+
str
|
739
|
+
end
|
740
|
+
|
741
|
+
def bib_label(id)
|
742
|
+
" [#{id}]_ "
|
743
|
+
end
|
744
|
+
private :bib_label
|
745
|
+
|
746
|
+
def bibpaper_header(id, caption)
|
747
|
+
end
|
748
|
+
|
749
|
+
def bibpaper_bibpaper(id, caption, lines)
|
750
|
+
puts ".. [#{id}] #{compile_inline(caption)} #{split_paragraph(lines).join("")}"
|
751
|
+
end
|
752
|
+
|
753
|
+
def inline_warn(str)
|
754
|
+
" :warn:`#{str}` "
|
755
|
+
end
|
756
|
+
|
757
|
+
def inline_bib(id)
|
758
|
+
" [#{id}]_ "
|
759
|
+
end
|
760
|
+
|
761
|
+
end
|
762
|
+
|
763
|
+
end # module ReVIEW
|