Class: ReVIEW::RSTBuilder
Overview
Constant Summary
Constants inherited
from Builder
Builder::CAPTION_TITLES
Instance Method Summary
collapse
-
#base_block(_type, lines, caption = nil) ⇒ Object
-
#base_parablock(type, lines, caption = nil) ⇒ Object
-
#best(lines, caption = nil) ⇒ Object
-
#bibpaper_bibpaper(id, caption, lines) ⇒ Object
-
#bibpaper_header(id, caption) ⇒ Object
-
#bpo(lines) ⇒ Object
-
#caution(lines, caption = nil) ⇒ Object
-
#centering(lines) ⇒ Object
-
#circle_begin(_level, _label, caption) ⇒ Object
-
#circle_end(level) ⇒ Object
-
#cmd(lines, _caption = nil) ⇒ Object
-
#column_begin(_level, _label, caption) ⇒ Object
-
#column_end(_level) ⇒ Object
-
#comment(lines, _comment = nil) ⇒ Object
-
#common_column_begin(_type, caption) ⇒ Object
-
#common_column_end(_type) ⇒ Object
-
#compile_href(url, label) ⇒ Object
-
#compile_kw(word, alt) ⇒ Object
-
#compile_ruby(base, ruby) ⇒ Object
-
#dd(lines) ⇒ Object
-
#dl_begin ⇒ Object
-
#dl_end ⇒ Object
-
#dt(line) ⇒ Object
-
#dtp(str) ⇒ Object
-
#edition_begin(_level, _label, caption) ⇒ Object
-
#edition_end(_level) ⇒ Object
-
#emlist(lines, caption = nil, lang = nil) ⇒ Object
-
#emlistnum(lines, caption = nil, lang = nil) ⇒ Object
-
#emtable(lines, caption = nil) ⇒ Object
-
#expert(lines) ⇒ Object
-
#extname ⇒ Object
-
#flushright(lines) ⇒ Object
-
#footnote(id, str) ⇒ Object
-
#headline(level, label, caption) ⇒ Object
-
#hood_begin(_level, _label, caption) ⇒ Object
-
#hood_end(_level) ⇒ Object
-
#hr ⇒ Object
-
#image_dummy(id, caption, lines) ⇒ Object
-
#image_ext ⇒ Object
-
#image_image(id, caption, metric) ⇒ Object
-
#important(lines, caption = nil) ⇒ Object
-
#indepimage(_lines, id, caption = '', _metric = nil) ⇒ Object
(also: #numberlessimage)
-
#info(lines, caption = nil) ⇒ Object
-
#inline_ami(str) ⇒ Object
-
#inline_b(str) ⇒ Object
(also: #inline_strong)
-
#inline_balloon(str) ⇒ Object
-
#inline_bib(id) ⇒ Object
-
#inline_bou(str) ⇒ Object
-
#inline_br(_str) ⇒ Object
-
#inline_chap(id) ⇒ Object
-
#inline_chapref(id) ⇒ Object
-
#inline_code(str) ⇒ Object
-
#inline_comment(str) ⇒ Object
-
#inline_del(str) ⇒ Object
-
#inline_dtp(_str) ⇒ Object
-
#inline_fn(id) ⇒ Object
-
#inline_hd_chap(_chap, id) ⇒ Object
-
#inline_hidx(str) ⇒ Object
-
#inline_hint(str) ⇒ Object
-
#inline_i(str) ⇒ Object
-
#inline_icon(id) ⇒ Object
-
#inline_idx(str) ⇒ Object
-
#inline_img(id) ⇒ Object
-
#inline_keytop(str) ⇒ Object
-
#inline_labelref(idref) ⇒ Object
(also: #inline_ref)
-
#inline_list(id) ⇒ Object
-
#inline_m(str) ⇒ Object
-
#inline_maru(str) ⇒ Object
-
#inline_pageref(idref) ⇒ Object
-
#inline_raw(str) ⇒ Object
-
#inline_sub(str) ⇒ Object
-
#inline_sup(str) ⇒ Object
-
#inline_table(id) ⇒ Object
-
#inline_tt(str) ⇒ Object
(also: #inline_ttb, #inline_tti)
-
#inline_ttibold(str) ⇒ Object
-
#inline_u(str) ⇒ Object
-
#inline_uchar(str) ⇒ Object
-
#inline_warn(str) ⇒ Object
-
#insideout_begin(_level, _label, caption) ⇒ Object
-
#insideout_end(_level) ⇒ Object
-
#insn(lines, caption = nil) ⇒ Object
(also: #box)
-
#label(id) ⇒ Object
-
#link(lines, caption = nil) ⇒ Object
-
#list_body(_id, lines, _lang) ⇒ Object
-
#list_header(id, _caption, _lang) ⇒ Object
-
#listnum_body(lines, _lang) ⇒ Object
-
#memo(lines, caption = nil) ⇒ Object
-
#nofunc_text(str) ⇒ Object
-
#noindent ⇒ Object
-
#nonum_begin(_level, _label, caption) ⇒ Object
-
#nonum_end(level) ⇒ Object
-
#note(lines, caption = nil) ⇒ Object
-
#notice(lines, caption = nil) ⇒ Object
-
#ol_begin ⇒ Object
-
#ol_end ⇒ Object
-
#ol_item(lines, _num) ⇒ Object
-
#paragraph(lines) ⇒ Object
-
#planning(lines, caption = nil) ⇒ Object
-
#point(lines, caption = nil) ⇒ Object
-
#post_paragraph ⇒ Object
-
#practice(lines) ⇒ Object
-
#pre_paragraph ⇒ Object
-
#quote(lines) ⇒ Object
-
#read(lines) ⇒ Object
(also: #lead)
-
#ref_begin(_level, _label, caption) ⇒ Object
-
#ref_end(_level) ⇒ Object
-
#reference(lines) ⇒ Object
-
#result ⇒ Object
-
#security(lines, caption = nil) ⇒ Object
-
#shoot(lines, caption = nil) ⇒ Object
-
#source(lines, caption = nil, _lang = nil) ⇒ Object
-
#sup_begin(_level, _label, caption) ⇒ Object
-
#sup_end(_level) ⇒ Object
-
#table_begin(ncols) ⇒ Object
-
#table_end ⇒ Object
-
#table_header(id, caption) ⇒ Object
-
#td(str) ⇒ Object
-
#term(lines) ⇒ Object
-
#texequation(lines) ⇒ Object
-
#text(str) ⇒ Object
-
#th(str) ⇒ Object
-
#tip(lines, caption = nil) ⇒ Object
-
#tr(rows) ⇒ Object
-
#ul_begin ⇒ Object
-
#ul_end ⇒ Object
-
#ul_item(lines) ⇒ Object
-
#warning(lines, caption = nil) ⇒ Object
-
#world_begin(_level, _label, caption) ⇒ Object
-
#world_end(_level) ⇒ Object
-
#xcolumn_begin(_level, _label, caption) ⇒ Object
-
#xcolumn_end(_level) ⇒ Object
Methods included from TextUtils
#detab, #split_paragraph
Methods inherited from Builder
#bibpaper, #bind, #captionblock, #compile_inline, #detab, #embed, #error, #extract_chapter_id, #firstlinenum, #get_chap, #graph, #handle_metric, #image, #include, #initialize, #inline_column, #inline_column_chap, #inline_embed, #inline_hd, #inline_href, #inline_imgref, #inline_include, #inline_kw, #inline_ruby, #inline_tcy, #inline_title, #line_num, #list, #listnum, #parse_metric, #raw, #result_metric, #table, #target_name, #tsize, #ul_item_begin, #ul_item_end, #warn
Instance Method Details
#base_block(_type, lines, caption = nil) ⇒ Object
192
193
194
195
196
197
|
# File 'lib/review/rstbuilder.rb', line 192
def base_block(_type, lines, caption = nil)
blank
puts compile_inline(caption) unless caption.nil?
puts lines.join("\n")
blank
end
|
#base_parablock(type, lines, caption = nil) ⇒ Object
199
200
201
202
203
204
205
|
# File 'lib/review/rstbuilder.rb', line 199
def base_parablock(type, lines, caption = nil)
puts ".. #{type}::"
blank
puts " #{compile_inline(caption)}" unless caption.nil?
puts ' ' + split_paragraph(lines).join("\n")
blank
end
|
#best(lines, caption = nil) ⇒ Object
577
578
579
|
# File 'lib/review/rstbuilder.rb', line 577
def best(lines, caption = nil)
base_parablock 'best', lines, caption
end
|
#bibpaper_bibpaper(id, caption, lines) ⇒ Object
725
726
727
|
# File 'lib/review/rstbuilder.rb', line 725
def bibpaper_bibpaper(id, caption, lines)
puts ".. [#{id}] #{compile_inline(caption)} #{split_paragraph(lines).join}"
end
|
722
723
|
# File 'lib/review/rstbuilder.rb', line 722
def (id, caption)
end
|
#bpo(lines) ⇒ Object
656
657
658
|
# File 'lib/review/rstbuilder.rb', line 656
def bpo(lines)
base_block 'bpo', lines, nil
end
|
#caution(lines, caption = nil) ⇒ Object
589
590
591
|
# File 'lib/review/rstbuilder.rb', line 589
def caution(lines, caption = nil)
base_parablock 'caution', lines, caption
end
|
#centering(lines) ⇒ Object
553
554
555
|
# File 'lib/review/rstbuilder.rb', line 553
def centering(lines)
base_parablock 'centering', lines, nil
end
|
#circle_begin(_level, _label, caption) ⇒ Object
706
707
708
|
# File 'lib/review/rstbuilder.rb', line 706
def circle_begin(_level, _label, caption)
puts "・\t#{caption}"
end
|
#circle_end(level) ⇒ Object
710
711
|
# File 'lib/review/rstbuilder.rb', line 710
def circle_end(level)
end
|
#cmd(lines, _caption = nil) ⇒ Object
239
240
241
242
|
# File 'lib/review/rstbuilder.rb', line 239
def cmd(lines, _caption = nil)
puts '.. code-block:: bash'
lines.each { |line| puts ' ' + detab(line) }
end
|
#column_begin(_level, _label, caption) ⇒ Object
485
486
487
|
# File 'lib/review/rstbuilder.rb', line 485
def column_begin(_level, _label, caption)
common_column_begin('column', caption)
end
|
#column_end(_level) ⇒ Object
489
490
491
|
# File 'lib/review/rstbuilder.rb', line 489
def column_end(_level)
common_column_end('column')
end
|
331
332
333
|
# File 'lib/review/rstbuilder.rb', line 331
def (lines, = nil)
puts lines.map { |line| " .. #{line}" }.join
end
|
#common_column_begin(_type, caption) ⇒ Object
473
474
475
476
477
478
|
# File 'lib/review/rstbuilder.rb', line 473
def common_column_begin(_type, caption)
blank
puts ".. column:: #{compile_inline(caption)}"
blank
@in_role = true
end
|
#common_column_end(_type) ⇒ Object
480
481
482
483
|
# File 'lib/review/rstbuilder.rb', line 480
def common_column_end(_type)
@in_role = false
blank
end
|
#compile_href(url, label) ⇒ Object
355
356
357
358
|
# File 'lib/review/rstbuilder.rb', line 355
def compile_href(url, label)
label = url if label.blank?
" `#{label} <#{url}>`_ "
end
|
#compile_kw(word, alt) ⇒ Object
348
349
350
351
352
353
|
# File 'lib/review/rstbuilder.rb', line 348
def compile_kw(word, alt)
if alt
then " **#{word}(#{alt.strip})** "
else " **#{word}** "
end
end
|
#compile_ruby(base, ruby) ⇒ Object
344
345
346
|
# File 'lib/review/rstbuilder.rb', line 344
def compile_ruby(base, ruby)
" :ruby:`#{base}`<#{ruby}>`_ "
end
|
#dd(lines) ⇒ Object
154
155
156
|
# File 'lib/review/rstbuilder.rb', line 154
def dd(lines)
split_paragraph(lines).each { |paragraph| puts " #{paragraph.gsub(/\n/, '')}" }
end
|
147
148
|
# File 'lib/review/rstbuilder.rb', line 147
def dl_begin
end
|
158
159
|
# File 'lib/review/rstbuilder.rb', line 158
def dl_end
end
|
150
151
152
|
# File 'lib/review/rstbuilder.rb', line 150
def dt(line)
puts line
end
|
652
653
654
|
# File 'lib/review/rstbuilder.rb', line 652
def dtp(str)
end
|
#edition_begin(_level, _label, caption) ⇒ Object
517
518
519
|
# File 'lib/review/rstbuilder.rb', line 517
def edition_begin(_level, _label, caption)
common_column_begin('edition', caption)
end
|
#edition_end(_level) ⇒ Object
521
522
523
|
# File 'lib/review/rstbuilder.rb', line 521
def edition_end(_level)
common_column_end('edition')
end
|
#emlist(lines, caption = nil, lang = nil) ⇒ Object
207
208
209
210
211
212
213
214
215
216
217
218
|
# File 'lib/review/rstbuilder.rb', line 207
def emlist(lines, caption = nil, lang = nil)
blank
if caption
puts caption
print "\n"
end
lang ||= 'none'
puts ".. code-block:: #{lang}"
blank
lines.each { |line| puts ' ' + detab(line) }
blank
end
|
#emlistnum(lines, caption = nil, lang = nil) ⇒ Object
220
221
222
223
224
225
226
227
228
229
230
231
232
|
# File 'lib/review/rstbuilder.rb', line 220
def emlistnum(lines, caption = nil, lang = nil)
blank
if caption
puts caption
print "\n"
end
lang ||= 'none'
puts ".. code-block:: #{lang}"
puts ' :linenos:'
blank
lines.each { |line| puts ' ' + detab(line) }
blank
end
|
#emtable(lines, caption = nil) ⇒ Object
327
328
329
|
# File 'lib/review/rstbuilder.rb', line 327
def emtable(lines, caption = nil)
table(lines, nil, caption)
end
|
#expert(lines) ⇒ Object
621
622
623
|
# File 'lib/review/rstbuilder.rb', line 621
def expert(lines)
base_parablock 'expert', lines, nil
end
|
50
51
52
|
# File 'lib/review/rstbuilder.rb', line 50
def extname
'.rst'
end
|
#flushright(lines) ⇒ Object
549
550
551
|
# File 'lib/review/rstbuilder.rb', line 549
def flushright(lines)
base_parablock 'flushright', lines, nil
end
|
335
336
337
338
|
# File 'lib/review/rstbuilder.rb', line 335
def (id, str)
puts ".. [##{id.sub(' ', '_')}] #{compile_inline(str)}"
blank
end
|
#headline(level, label, caption) ⇒ Object
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
|
# File 'lib/review/rstbuilder.rb', line 90
def headline(level, label, caption)
blank
if label
puts ".. _#{label}:"
blank
end
p = '='
case level
when 1 then
unless label
puts ".. _#{@chapter.name}:"
blank
end
puts '=' * caption.size * 2
when 2 then
p = '='
when 3 then
p = '-'
when 4 then
p = '`'
when 5 then
p = '~'
end
puts caption
puts p * caption.size * 2
blank
end
|
#hood_begin(_level, _label, caption) ⇒ Object
509
510
511
|
# File 'lib/review/rstbuilder.rb', line 509
def hood_begin(_level, _label, caption)
common_column_begin('hood', caption)
end
|
#hood_end(_level) ⇒ Object
513
514
515
|
# File 'lib/review/rstbuilder.rb', line 513
def hood_end(_level)
common_column_end('hood')
end
|
175
176
177
|
# File 'lib/review/rstbuilder.rb', line 175
def hr
puts '----'
end
|
#image_dummy(id, caption, lines) ⇒ Object
271
272
273
274
275
276
277
278
279
280
|
# File 'lib/review/rstbuilder.rb', line 271
def image_dummy(id, caption, lines)
chapter, id = (id)
puts ".. _#{id}:"
blank
puts ".. figure:: images/#{chapter.name}/#{id}.#{image_ext}"
blank
puts " #{caption}"
puts " #{lines.join}"
blank
end
|
#image_ext ⇒ Object
46
47
48
|
# File 'lib/review/rstbuilder.rb', line 46
def image_ext
'png'
end
|
#image_image(id, caption, metric) ⇒ Object
258
259
260
261
262
263
264
265
266
267
268
269
|
# File 'lib/review/rstbuilder.rb', line 258
def image_image(id, caption, metric)
chapter, id = (id)
scale = metric.split('=')[1].to_f * 100 if metric
puts ".. _#{id}:"
blank
puts ".. figure:: images/#{chapter.name}/#{id}.#{image_ext}"
puts " :scale:#{scale}%" if scale
blank
puts " #{caption}"
blank
end
|
#important(lines, caption = nil) ⇒ Object
581
582
583
|
# File 'lib/review/rstbuilder.rb', line 581
def important(lines, caption = nil)
base_parablock 'important', lines, caption
end
|
#indepimage(_lines, id, caption = '', _metric = nil) ⇒ Object
Also known as:
numberlessimage
635
636
637
638
639
640
641
642
643
|
# File 'lib/review/rstbuilder.rb', line 635
def indepimage(_lines, id, caption = '', _metric = nil)
chapter, id = (id)
puts ".. _#{id}:"
blank
puts ".. figure:: images/#{chapter.name}/#{id}.#{image_ext}"
blank
puts " #{compile_inline(caption)}"
blank
end
|
#info(lines, caption = nil) ⇒ Object
569
570
571
|
# File 'lib/review/rstbuilder.rb', line 569
def info(lines, caption = nil)
base_parablock 'info', lines, caption
end
|
#inline_ami(str) ⇒ Object
395
396
397
398
|
# File 'lib/review/rstbuilder.rb', line 395
def inline_ami(str)
" :ami:`#{str}` "
end
|
#inline_b(str) ⇒ Object
Also known as:
inline_strong
404
405
406
|
# File 'lib/review/rstbuilder.rb', line 404
def inline_b(str)
" **#{str.gsub('*', '\*')}** "
end
|
#inline_balloon(str) ⇒ Object
437
438
439
|
# File 'lib/review/rstbuilder.rb', line 437
def inline_balloon(str)
%Q(\t←#{str.gsub(/@maru\[(\d+)\]/, inline_maru('\1'))})
end
|
#inline_bib(id) ⇒ Object
733
734
735
|
# File 'lib/review/rstbuilder.rb', line 733
def inline_bib(id)
" [#{id}]_ "
end
|
#inline_bou(str) ⇒ Object
427
428
429
430
|
# File 'lib/review/rstbuilder.rb', line 427
def inline_bou(str)
" :bou:`#{str}` "
end
|
#inline_br(_str) ⇒ Object
672
673
674
|
# File 'lib/review/rstbuilder.rb', line 672
def inline_br(_str)
"\n"
end
|
#inline_chap(id) ⇒ Object
680
681
682
|
# File 'lib/review/rstbuilder.rb', line 680
def inline_chap(id)
super
end
|
#inline_chapref(id) ⇒ Object
684
685
686
|
# File 'lib/review/rstbuilder.rb', line 684
def inline_chapref(id)
" :numref:`#{id}` "
end
|
#inline_code(str) ⇒ Object
668
669
670
|
# File 'lib/review/rstbuilder.rb', line 668
def inline_code(str)
" :code:`#{str}` "
end
|
445
446
447
448
449
450
451
|
# File 'lib/review/rstbuilder.rb', line 445
def (str)
if @book.config['draft']
str
else
''
end
end
|
#inline_del(str) ⇒ Object
664
665
666
|
# File 'lib/review/rstbuilder.rb', line 664
def inline_del(str)
" :del:`#{str}` "
end
|
#inline_dtp(_str) ⇒ Object
660
661
662
|
# File 'lib/review/rstbuilder.rb', line 660
def inline_dtp(_str)
''
end
|
#inline_fn(id) ⇒ Object
340
341
342
|
# File 'lib/review/rstbuilder.rb', line 340
def inline_fn(id)
" [##{id.sub(' ', '_')}]_ "
end
|
#inline_hd_chap(_chap, id) ⇒ Object
457
458
459
|
# File 'lib/review/rstbuilder.rb', line 457
def inline_hd_chap(_chap, id)
" :ref:`#{id}` "
end
|
#inline_hidx(str) ⇒ Object
391
392
393
|
# File 'lib/review/rstbuilder.rb', line 391
def inline_hidx(str)
" :index:`#{str}` "
end
|
#inline_hint(str) ⇒ Object
377
378
379
380
|
# File 'lib/review/rstbuilder.rb', line 377
def inline_hint(str)
" :hint:`#{str}` "
end
|
#inline_i(str) ⇒ Object
400
401
402
|
# File 'lib/review/rstbuilder.rb', line 400
def inline_i(str)
" *#{str.gsub('*', '\*')}* "
end
|
#inline_icon(id) ⇒ Object
423
424
425
|
# File 'lib/review/rstbuilder.rb', line 423
def inline_icon(id)
" :ref:`#{id}` "
end
|
#inline_idx(str) ⇒ Object
387
388
389
|
# File 'lib/review/rstbuilder.rb', line 387
def inline_idx(str)
" :index:`#{str}` "
end
|
#inline_img(id) ⇒ Object
254
255
256
|
# File 'lib/review/rstbuilder.rb', line 254
def inline_img(id)
" :numref:`#{id}` "
end
|
#inline_keytop(str) ⇒ Object
432
433
434
435
|
# File 'lib/review/rstbuilder.rb', line 432
def inline_keytop(str)
" :keytop:`#{str}` "
end
|
#inline_labelref(idref) ⇒ Object
Also known as:
inline_ref
697
698
|
# File 'lib/review/rstbuilder.rb', line 697
def inline_labelref(idref)
end
|
#inline_list(id) ⇒ Object
179
180
181
|
# File 'lib/review/rstbuilder.rb', line 179
def inline_list(id)
" :numref:`#{id}` "
end
|
#inline_m(str) ⇒ Object
453
454
455
|
# File 'lib/review/rstbuilder.rb', line 453
def inline_m(str)
" :math:`#{str}` "
end
|
#inline_maru(str) ⇒ Object
382
383
384
385
|
# File 'lib/review/rstbuilder.rb', line 382
def inline_maru(str)
" :maru:`#{str}` "
end
|
702
703
704
|
# File 'lib/review/rstbuilder.rb', line 702
def (idref)
" :ref:`#{idref}` "
end
|
#inline_raw(str) ⇒ Object
368
369
370
371
372
373
374
375
|
# File 'lib/review/rstbuilder.rb', line 368
def inline_raw(str)
matched = str.match(/\|(.*?)\|(.*)/)
if matched
matched[2].gsub('\\n', "\n")
else
str.gsub('\\n', "\n")
end
end
|
#inline_sub(str) ⇒ Object
364
365
366
|
# File 'lib/review/rstbuilder.rb', line 364
def inline_sub(str)
" :subscript:`#{str}` "
end
|
#inline_sup(str) ⇒ Object
360
361
362
|
# File 'lib/review/rstbuilder.rb', line 360
def inline_sup(str)
" :superscript:`#{str}` "
end
|
#inline_table(id) ⇒ Object
250
251
252
|
# File 'lib/review/rstbuilder.rb', line 250
def inline_table(id)
"表 :numref:`#{id}` "
end
|
#inline_tt(str) ⇒ Object
Also known as:
inline_ttb, inline_tti
410
411
412
|
# File 'lib/review/rstbuilder.rb', line 410
def inline_tt(str)
" ``#{str}`` "
end
|
#inline_ttibold(str) ⇒ Object
692
693
694
695
|
# File 'lib/review/rstbuilder.rb', line 692
def inline_ttibold(str)
" **#{str}** "
end
|
#inline_u(str) ⇒ Object
419
420
421
|
# File 'lib/review/rstbuilder.rb', line 419
def inline_u(str)
" :subscript:`#{str}` "
end
|
#inline_uchar(str) ⇒ Object
441
442
443
|
# File 'lib/review/rstbuilder.rb', line 441
def inline_uchar(str)
[str.to_i(16)].pack('U')
end
|
#inline_warn(str) ⇒ Object
729
730
731
|
# File 'lib/review/rstbuilder.rb', line 729
def inline_warn(str)
" :warn:`#{str}` "
end
|
#insideout_begin(_level, _label, caption) ⇒ Object
525
526
527
|
# File 'lib/review/rstbuilder.rb', line 525
def insideout_begin(_level, _label, caption)
common_column_begin('insideout', caption)
end
|
#insideout_end(_level) ⇒ Object
529
530
531
|
# File 'lib/review/rstbuilder.rb', line 529
def insideout_end(_level)
common_column_end('insideout')
end
|
#insn(lines, caption = nil) ⇒ Object
Also known as:
box
625
626
627
|
# File 'lib/review/rstbuilder.rb', line 625
def insn(lines, caption = nil)
base_block 'insn', lines, caption
end
|
#label(id) ⇒ Object
647
648
649
650
|
# File 'lib/review/rstbuilder.rb', line 647
def label(id)
puts ".. _#{id}:"
blank
end
|
#link(lines, caption = nil) ⇒ Object
597
598
599
|
# File 'lib/review/rstbuilder.rb', line 597
def link(lines, caption = nil)
base_parablock 'link', lines, caption
end
|
#list_body(_id, lines, _lang) ⇒ Object
188
189
190
|
# File 'lib/review/rstbuilder.rb', line 188
def list_body(_id, lines, _lang)
lines.each { |line| puts '-' + detab(line) }
end
|
183
184
185
186
|
# File 'lib/review/rstbuilder.rb', line 183
def (id, _caption, _lang)
puts ".. _#{id}:"
blank
end
|
#listnum_body(lines, _lang) ⇒ Object
234
235
236
237
|
# File 'lib/review/rstbuilder.rb', line 234
def listnum_body(lines, _lang)
lines.each_with_index { |line, i| puts(i + 1).to_s.rjust(2) + ": #{line}" }
blank
end
|
#memo(lines, caption = nil) ⇒ Object
561
562
563
|
# File 'lib/review/rstbuilder.rb', line 561
def memo(lines, caption = nil)
base_parablock 'memo', lines, caption
end
|
#nofunc_text(str) ⇒ Object
713
714
715
|
# File 'lib/review/rstbuilder.rb', line 713
def nofunc_text(str)
str
end
|
461
462
463
|
# File 'lib/review/rstbuilder.rb', line 461
def noindent
end
|
#nonum_begin(_level, _label, caption) ⇒ Object
465
466
467
468
|
# File 'lib/review/rstbuilder.rb', line 465
def nonum_begin(_level, _label, caption)
puts ".. rubric: #{compile_inline(caption)}"
blank
end
|
#nonum_end(level) ⇒ Object
470
471
|
# File 'lib/review/rstbuilder.rb', line 470
def nonum_end(level)
end
|
#note(lines, caption = nil) ⇒ Object
557
558
559
|
# File 'lib/review/rstbuilder.rb', line 557
def note(lines, caption = nil)
base_parablock 'note', lines, caption
end
|
#notice(lines, caption = nil) ⇒ Object
601
602
603
|
# File 'lib/review/rstbuilder.rb', line 601
def notice(lines, caption = nil)
base_parablock 'notice', lines, caption
end
|
133
134
135
136
|
# File 'lib/review/rstbuilder.rb', line 133
def ol_begin
blank
@ol_indent += 1
end
|
142
143
144
145
|
# File 'lib/review/rstbuilder.rb', line 142
def ol_end
@ol_indent -= 1
blank
end
|
#ol_item(lines, _num) ⇒ Object
138
139
140
|
# File 'lib/review/rstbuilder.rb', line 138
def ol_item(lines, _num)
puts ' ' * (@ol_indent - 1) + "#. #{lines.join}"
end
|
#paragraph(lines) ⇒ Object
161
162
163
164
165
166
|
# File 'lib/review/rstbuilder.rb', line 161
def paragraph(lines)
pre = ''
pre = ' ' if @in_role == true
puts pre + lines.join
puts "\n"
end
|
#planning(lines, caption = nil) ⇒ Object
573
574
575
|
# File 'lib/review/rstbuilder.rb', line 573
def planning(lines, caption = nil)
base_parablock 'planning', lines, caption
end
|
#point(lines, caption = nil) ⇒ Object
605
606
607
|
# File 'lib/review/rstbuilder.rb', line 605
def point(lines, caption = nil)
base_parablock 'point', lines, caption
end
|
#post_paragraph ⇒ Object
42
43
44
|
# File 'lib/review/rstbuilder.rb', line 42
def post_paragraph
''
end
|
#practice(lines) ⇒ Object
617
618
619
|
# File 'lib/review/rstbuilder.rb', line 617
def practice(lines)
base_parablock 'practice', lines, nil
end
|
#pre_paragraph ⇒ Object
38
39
40
|
# File 'lib/review/rstbuilder.rb', line 38
def pre_paragraph
''
end
|
#quote(lines) ⇒ Object
244
245
246
247
248
|
# File 'lib/review/rstbuilder.rb', line 244
def quote(lines)
blank
puts lines.map { |line| " #{line}" }.join
blank
end
|
#read(lines) ⇒ Object
Also known as:
lead
168
169
170
171
|
# File 'lib/review/rstbuilder.rb', line 168
def read(lines)
puts split_paragraph(lines).map { |line| " #{line}" }.join
blank
end
|
#ref_begin(_level, _label, caption) ⇒ Object
533
534
535
|
# File 'lib/review/rstbuilder.rb', line 533
def ref_begin(_level, _label, caption)
common_column_begin('ref', caption)
end
|
#ref_end(_level) ⇒ Object
537
538
539
|
# File 'lib/review/rstbuilder.rb', line 537
def ref_end(_level)
common_column_end('ref')
end
|
#reference(lines) ⇒ Object
613
614
615
|
# File 'lib/review/rstbuilder.rb', line 613
def reference(lines)
base_parablock 'reference', lines, nil
end
|
86
87
88
|
# File 'lib/review/rstbuilder.rb', line 86
def result
@output.string
end
|
#security(lines, caption = nil) ⇒ Object
585
586
587
|
# File 'lib/review/rstbuilder.rb', line 585
def security(lines, caption = nil)
base_parablock 'security', lines, caption
end
|
#shoot(lines, caption = nil) ⇒ Object
609
610
611
|
# File 'lib/review/rstbuilder.rb', line 609
def shoot(lines, caption = nil)
base_parablock 'shoot', lines, caption
end
|
#source(lines, caption = nil, _lang = nil) ⇒ Object
688
689
690
|
# File 'lib/review/rstbuilder.rb', line 688
def source(lines, caption = nil, _lang = nil)
base_block 'source', lines, caption
end
|
#sup_begin(_level, _label, caption) ⇒ Object
541
542
543
|
# File 'lib/review/rstbuilder.rb', line 541
def sup_begin(_level, _label, caption)
common_column_begin('sup', caption)
end
|
#sup_end(_level) ⇒ Object
545
546
547
|
# File 'lib/review/rstbuilder.rb', line 545
def sup_end(_level)
common_column_end('sup')
end
|
#table_begin(ncols) ⇒ Object
300
301
|
# File 'lib/review/rstbuilder.rb', line 300
def table_begin(ncols)
end
|
#table_end ⇒ Object
323
324
325
|
# File 'lib/review/rstbuilder.rb', line 323
def table_end
blank
end
|
289
290
291
292
293
294
295
296
297
298
|
# File 'lib/review/rstbuilder.rb', line 289
def (id, caption)
unless id.nil?
blank
puts ".. _#{id}:"
end
blank
puts ".. list-table:: #{compile_inline(caption)}"
puts ' :header-rows: 1'
blank
end
|
319
320
321
|
# File 'lib/review/rstbuilder.rb', line 319
def td(str)
str
end
|
#term(lines) ⇒ Object
593
594
595
|
# File 'lib/review/rstbuilder.rb', line 593
def term(lines)
base_parablock 'term', lines, nil
end
|
#texequation(lines) ⇒ Object
282
283
284
285
286
287
|
# File 'lib/review/rstbuilder.rb', line 282
def texequation(lines)
puts '.. math::'
blank
puts lines.map { |line| " #{line}" }.join
blank
end
|
#text(str) ⇒ Object
676
677
678
|
# File 'lib/review/rstbuilder.rb', line 676
def text(str)
str
end
|
315
316
317
|
# File 'lib/review/rstbuilder.rb', line 315
def th(str)
str
end
|
#tip(lines, caption = nil) ⇒ Object
565
566
567
|
# File 'lib/review/rstbuilder.rb', line 565
def tip(lines, caption = nil)
base_parablock 'tip', lines, caption
end
|
303
304
305
306
307
308
309
310
311
312
313
|
# File 'lib/review/rstbuilder.rb', line 303
def tr(rows)
first = true
rows.each do |row|
if first
puts " * - #{row}"
first = false
else
puts " - #{row}"
end
end
end
|
119
120
121
122
|
# File 'lib/review/rstbuilder.rb', line 119
def ul_begin
blank
@ul_indent += 1
end
|
128
129
130
131
|
# File 'lib/review/rstbuilder.rb', line 128
def ul_end
@ul_indent -= 1
blank
end
|
#ul_item(lines) ⇒ Object
124
125
126
|
# File 'lib/review/rstbuilder.rb', line 124
def ul_item(lines)
puts ' ' * (@ul_indent - 1) + "* #{lines.join}"
end
|
#warning(lines, caption = nil) ⇒ Object
629
630
631
|
# File 'lib/review/rstbuilder.rb', line 629
def warning(lines, caption = nil)
base_parablock 'warning', lines, caption
end
|
#world_begin(_level, _label, caption) ⇒ Object
501
502
503
|
# File 'lib/review/rstbuilder.rb', line 501
def world_begin(_level, _label, caption)
common_column_begin('world', caption)
end
|
#world_end(_level) ⇒ Object
505
506
507
|
# File 'lib/review/rstbuilder.rb', line 505
def world_end(_level)
common_column_end('world')
end
|
#xcolumn_begin(_level, _label, caption) ⇒ Object
493
494
495
|
# File 'lib/review/rstbuilder.rb', line 493
def xcolumn_begin(_level, _label, caption)
common_column_begin('xcolumn', caption)
end
|
#xcolumn_end(_level) ⇒ Object
497
498
499
|
# File 'lib/review/rstbuilder.rb', line 497
def xcolumn_end(_level)
common_column_end('xcolumn')
end
|