Class: ReVIEW::RSTBuilder
Overview
Constant Summary
Constants inherited
from Builder
Builder::CAPTION_TITLES
Instance Attribute Summary
Attributes inherited from Builder
#doc_status, #location
Attributes included from Loggable
#logger
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
-
#endnote_item(id) ⇒ 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
rubocop:disable Lint/UselessMethodDefinition.
-
#inline_chapref(id) ⇒ Object
-
#inline_code(str) ⇒ Object
-
#inline_comment(str) ⇒ Object
-
#inline_del(str) ⇒ Object
-
#inline_dtp(_str) ⇒ Object
-
#inline_endnote(id) ⇒ 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, id = nil, caption = '') ⇒ 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
#add_space?, #detab, #join_lines_to_paragraph, #split_paragraph
Methods inherited from Builder
#beginchild, #bibpaper, #bind, #blankline, #caption_top?, #captionblock, #check_nest, #check_nested_minicolumn, #check_printendnotes, #compile_inline, #detab, #embed, #endchild, #endnote, #endnote_begin, #endnote_end, #escape, #extract_chapter_id, #firstlinenum, #get_chap, #graph, #graph_aafigure, #graph_blockdiag, #graph_gnuplot, #graph_graphviz, #graph_mermaid, #graph_plantuml, #handle_metric, #highlight?, #image, #in_minicolumn?, #initialize, #inline_column, #inline_column_chap, #inline_embed, #inline_eq, #inline_hd, #inline_href, #inline_imgref, #inline_include, #inline_kw, #inline_ruby, #inline_sec, #inline_sectitle, #inline_tcy, #inline_title, #inline_w, #inline_wb, #line_num, #list, #listnum, #load_words, #minicolumn_block_name?, #over_secnolevel?, #parse_metric, #parse_table_rows, #previous_list_type, #printendnotes, #raw, #result_metric, #solve_nest, #system_graph, #table, #table_row_separator_regexp, #table_rows, #target_name, #tsize, #ul_item_begin, #ul_item_end
Methods included from Loggable
#app_error, #debug, #error, #error!, #warn
Instance Method Details
#base_block(_type, lines, caption = nil) ⇒ Object
201
202
203
204
205
206
|
# File 'lib/review/rstbuilder.rb', line 201
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
208
209
210
211
212
213
214
|
# File 'lib/review/rstbuilder.rb', line 208
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
633
634
635
|
# File 'lib/review/rstbuilder.rb', line 633
def best(lines, caption = nil)
base_parablock('best', lines, caption)
end
|
#bibpaper_bibpaper(id, caption, lines) ⇒ Object
781
782
783
|
# File 'lib/review/rstbuilder.rb', line 781
def bibpaper_bibpaper(id, caption, lines)
puts ".. [#{id}] #{compile_inline(caption)} #{split_paragraph(lines).join}"
end
|
778
779
|
# File 'lib/review/rstbuilder.rb', line 778
def (id, caption)
end
|
#bpo(lines) ⇒ Object
712
713
714
|
# File 'lib/review/rstbuilder.rb', line 712
def bpo(lines)
base_block('bpo', lines, nil)
end
|
#caution(lines, caption = nil) ⇒ Object
645
646
647
|
# File 'lib/review/rstbuilder.rb', line 645
def caution(lines, caption = nil)
base_parablock('caution', lines, caption)
end
|
#centering(lines) ⇒ Object
591
592
593
|
# File 'lib/review/rstbuilder.rb', line 591
def centering(lines)
base_parablock('centering', lines, nil)
end
|
#circle_begin(_level, _label, caption) ⇒ Object
762
763
764
|
# File 'lib/review/rstbuilder.rb', line 762
def circle_begin(_level, _label, caption)
puts "・\t#{caption}"
end
|
#circle_end(level) ⇒ Object
766
767
|
# File 'lib/review/rstbuilder.rb', line 766
def circle_end(level)
end
|
#cmd(lines, _caption = nil) ⇒ Object
254
255
256
257
258
259
|
# File 'lib/review/rstbuilder.rb', line 254
def cmd(lines, _caption = nil)
puts '.. code-block:: bash'
lines.each do |line|
puts ' ' + detab(line)
end
end
|
#column_begin(_level, _label, caption) ⇒ Object
523
524
525
|
# File 'lib/review/rstbuilder.rb', line 523
def column_begin(_level, _label, caption)
common_column_begin('column', caption)
end
|
#column_end(_level) ⇒ Object
527
528
529
|
# File 'lib/review/rstbuilder.rb', line 527
def column_end(_level)
common_column_end('column')
end
|
358
359
360
|
# File 'lib/review/rstbuilder.rb', line 358
def (lines, = nil)
puts lines.map { |line| " .. #{line}" }.join
end
|
#common_column_begin(_type, caption) ⇒ Object
511
512
513
514
515
516
|
# File 'lib/review/rstbuilder.rb', line 511
def common_column_begin(_type, caption)
blank
puts ".. column:: #{compile_inline(caption)}"
blank
@in_role = true
end
|
#common_column_end(_type) ⇒ Object
518
519
520
521
|
# File 'lib/review/rstbuilder.rb', line 518
def common_column_end(_type)
@in_role = false
blank
end
|
#compile_href(url, label) ⇒ Object
391
392
393
394
395
396
|
# File 'lib/review/rstbuilder.rb', line 391
def compile_href(url, label)
if label.blank?
label = url
end
" `#{label} <#{url}>`_ "
end
|
#compile_kw(word, alt) ⇒ Object
383
384
385
386
387
388
389
|
# File 'lib/review/rstbuilder.rb', line 383
def compile_kw(word, alt)
if alt
" **#{word}(#{alt.strip})** "
else
" **#{word}** "
end
end
|
#compile_ruby(base, ruby) ⇒ Object
379
380
381
|
# File 'lib/review/rstbuilder.rb', line 379
def compile_ruby(base, ruby)
" :ruby:`#{base}`<#{ruby}>`_ "
end
|
#dd(lines) ⇒ Object
157
158
159
160
161
|
# File 'lib/review/rstbuilder.rb', line 157
def dd(lines)
split_paragraph(lines).each do |paragraph|
puts " #{paragraph.delete("\n")}"
end
end
|
150
151
|
# File 'lib/review/rstbuilder.rb', line 150
def dl_begin
end
|
163
164
|
# File 'lib/review/rstbuilder.rb', line 163
def dl_end
end
|
153
154
155
|
# File 'lib/review/rstbuilder.rb', line 153
def dt(line)
puts line
end
|
708
709
710
|
# File 'lib/review/rstbuilder.rb', line 708
def dtp(str)
end
|
#edition_begin(_level, _label, caption) ⇒ Object
555
556
557
|
# File 'lib/review/rstbuilder.rb', line 555
def edition_begin(_level, _label, caption)
common_column_begin('edition', caption)
end
|
#edition_end(_level) ⇒ Object
559
560
561
|
# File 'lib/review/rstbuilder.rb', line 559
def edition_end(_level)
common_column_end('edition')
end
|
#emlist(lines, caption = nil, lang = nil) ⇒ Object
216
217
218
219
220
221
222
223
224
225
226
227
228
229
|
# File 'lib/review/rstbuilder.rb', line 216
def emlist(lines, caption = nil, lang = nil)
blank
if caption
puts caption
print "\n"
end
lang ||= 'none'
puts ".. code-block:: #{lang}"
blank
lines.each do |line|
puts ' ' + detab(line)
end
blank
end
|
#emlistnum(lines, caption = nil, lang = nil) ⇒ Object
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
|
# File 'lib/review/rstbuilder.rb', line 231
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 do |line|
puts ' ' + detab(line)
end
blank
end
|
#emtable(lines, caption = nil) ⇒ Object
354
355
356
|
# File 'lib/review/rstbuilder.rb', line 354
def emtable(lines, caption = nil)
table(lines, nil, caption)
end
|
#endnote_item(id) ⇒ Object
375
376
377
|
# File 'lib/review/rstbuilder.rb', line 375
def endnote_item(id)
puts ".. [(#{@chapter.endnote(id).number})] #{compile_inline(@chapter.endnote(id).content)}"
end
|
#expert(lines) ⇒ Object
677
678
679
|
# File 'lib/review/rstbuilder.rb', line 677
def expert(lines)
base_parablock('expert', lines, nil)
end
|
52
53
54
|
# File 'lib/review/rstbuilder.rb', line 52
def extname
'.rst'
end
|
#flushright(lines) ⇒ Object
587
588
589
|
# File 'lib/review/rstbuilder.rb', line 587
def flushright(lines)
base_parablock('flushright', lines, nil)
end
|
362
363
364
365
|
# File 'lib/review/rstbuilder.rb', line 362
def (id, str)
puts ".. [##{id.sub(' ', '_')}] #{compile_inline(str)}"
blank
end
|
#headline(level, label, caption) ⇒ Object
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
118
119
120
|
# File 'lib/review/rstbuilder.rb', line 93
def headline(level, label, caption)
blank
if label
puts ".. _#{label}:"
blank
end
p = '='
case level
when 1
unless label
puts ".. _#{@chapter.name}:"
blank
end
puts '=' * caption.size * 2
when 2
p = '='
when 3
p = '-'
when 4
p = '`'
when 5
p = '~'
end
puts caption
puts p * caption.size * 2
blank
end
|
#hood_begin(_level, _label, caption) ⇒ Object
547
548
549
|
# File 'lib/review/rstbuilder.rb', line 547
def hood_begin(_level, _label, caption)
common_column_begin('hood', caption)
end
|
#hood_end(_level) ⇒ Object
551
552
553
|
# File 'lib/review/rstbuilder.rb', line 551
def hood_end(_level)
common_column_end('hood')
end
|
182
183
184
|
# File 'lib/review/rstbuilder.rb', line 182
def hr
puts '----'
end
|
#image_dummy(id, caption, lines) ⇒ Object
290
291
292
293
294
295
296
297
298
299
|
# File 'lib/review/rstbuilder.rb', line 290
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
48
49
50
|
# File 'lib/review/rstbuilder.rb', line 48
def image_ext
'png'
end
|
#image_image(id, caption, metric) ⇒ Object
275
276
277
278
279
280
281
282
283
284
285
286
287
288
|
# File 'lib/review/rstbuilder.rb', line 275
def image_image(id, caption, metric)
chapter, id = (id)
if metric
scale = metric.split('=')[1].to_f * 100
end
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
637
638
639
|
# File 'lib/review/rstbuilder.rb', line 637
def important(lines, caption = nil)
base_parablock('important', lines, caption)
end
|
#indepimage(_lines, id, caption = '', _metric = nil) ⇒ Object
Also known as:
numberlessimage
691
692
693
694
695
696
697
698
699
|
# File 'lib/review/rstbuilder.rb', line 691
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
625
626
627
|
# File 'lib/review/rstbuilder.rb', line 625
def info(lines, caption = nil)
base_parablock('info', lines, caption)
end
|
#inline_ami(str) ⇒ Object
433
434
435
436
|
# File 'lib/review/rstbuilder.rb', line 433
def inline_ami(str)
" :ami:`#{str}` "
end
|
#inline_b(str) ⇒ Object
Also known as:
inline_strong
442
443
444
|
# File 'lib/review/rstbuilder.rb', line 442
def inline_b(str)
" **#{str.gsub('*', '\*')}** "
end
|
#inline_balloon(str) ⇒ Object
475
476
477
|
# File 'lib/review/rstbuilder.rb', line 475
def inline_balloon(str)
%Q(\t←#{str.gsub(/@maru\[(\d+)\]/, inline_maru('\1'))})
end
|
#inline_bib(id) ⇒ Object
789
790
791
|
# File 'lib/review/rstbuilder.rb', line 789
def inline_bib(id)
" [#{id}]_ "
end
|
#inline_bou(str) ⇒ Object
465
466
467
468
|
# File 'lib/review/rstbuilder.rb', line 465
def inline_bou(str)
" :bou:`#{str}` "
end
|
#inline_br(_str) ⇒ Object
728
729
730
|
# File 'lib/review/rstbuilder.rb', line 728
def inline_br(_str)
"\n"
end
|
#inline_chap(id) ⇒ Object
rubocop:disable Lint/UselessMethodDefinition
736
737
738
|
# File 'lib/review/rstbuilder.rb', line 736
def inline_chap(id) super
end
|
#inline_chapref(id) ⇒ Object
740
741
742
|
# File 'lib/review/rstbuilder.rb', line 740
def inline_chapref(id)
" :numref:`#{id}` "
end
|
#inline_code(str) ⇒ Object
724
725
726
|
# File 'lib/review/rstbuilder.rb', line 724
def inline_code(str)
" :code:`#{str}` "
end
|
483
484
485
486
487
488
489
|
# File 'lib/review/rstbuilder.rb', line 483
def (str)
if @book.config['draft']
str
else
''
end
end
|
#inline_del(str) ⇒ Object
720
721
722
|
# File 'lib/review/rstbuilder.rb', line 720
def inline_del(str)
" :del:`#{str}` "
end
|
#inline_dtp(_str) ⇒ Object
716
717
718
|
# File 'lib/review/rstbuilder.rb', line 716
def inline_dtp(_str)
''
end
|
#inline_endnote(id) ⇒ Object
371
372
373
|
# File 'lib/review/rstbuilder.rb', line 371
def inline_endnote(id)
" [(#{@chapter.endnote(id).number})]_ "
end
|
#inline_fn(id) ⇒ Object
367
368
369
|
# File 'lib/review/rstbuilder.rb', line 367
def inline_fn(id)
" [##{id.sub(' ', '_')}]_ "
end
|
#inline_hd_chap(_chap, id) ⇒ Object
495
496
497
|
# File 'lib/review/rstbuilder.rb', line 495
def inline_hd_chap(_chap, id)
" :ref:`#{id}` "
end
|
#inline_hidx(str) ⇒ Object
429
430
431
|
# File 'lib/review/rstbuilder.rb', line 429
def inline_hidx(str)
" :index:`#{str}` "
end
|
#inline_hint(str) ⇒ Object
415
416
417
418
|
# File 'lib/review/rstbuilder.rb', line 415
def inline_hint(str)
" :hint:`#{str}` "
end
|
#inline_i(str) ⇒ Object
438
439
440
|
# File 'lib/review/rstbuilder.rb', line 438
def inline_i(str)
" *#{str.gsub('*', '\*')}* "
end
|
#inline_icon(id) ⇒ Object
461
462
463
|
# File 'lib/review/rstbuilder.rb', line 461
def inline_icon(id)
" :ref:`#{id}` "
end
|
#inline_idx(str) ⇒ Object
425
426
427
|
# File 'lib/review/rstbuilder.rb', line 425
def inline_idx(str)
" :index:`#{str}` "
end
|
#inline_img(id) ⇒ Object
271
272
273
|
# File 'lib/review/rstbuilder.rb', line 271
def inline_img(id)
" :numref:`#{id}` "
end
|
#inline_keytop(str) ⇒ Object
470
471
472
473
|
# File 'lib/review/rstbuilder.rb', line 470
def inline_keytop(str)
" :keytop:`#{str}` "
end
|
#inline_labelref(idref) ⇒ Object
Also known as:
inline_ref
753
754
|
# File 'lib/review/rstbuilder.rb', line 753
def inline_labelref(idref)
end
|
#inline_list(id) ⇒ Object
186
187
188
|
# File 'lib/review/rstbuilder.rb', line 186
def inline_list(id)
" :numref:`#{id}` "
end
|
#inline_m(str) ⇒ Object
491
492
493
|
# File 'lib/review/rstbuilder.rb', line 491
def inline_m(str)
" :math:`#{str}` "
end
|
#inline_maru(str) ⇒ Object
420
421
422
423
|
# File 'lib/review/rstbuilder.rb', line 420
def inline_maru(str)
" :maru:`#{str}` "
end
|
758
759
760
|
# File 'lib/review/rstbuilder.rb', line 758
def (idref)
" :ref:`#{idref}` "
end
|
#inline_raw(str) ⇒ Object
406
407
408
409
410
411
412
413
|
# File 'lib/review/rstbuilder.rb', line 406
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
402
403
404
|
# File 'lib/review/rstbuilder.rb', line 402
def inline_sub(str)
" :subscript:`#{str}` "
end
|
#inline_sup(str) ⇒ Object
398
399
400
|
# File 'lib/review/rstbuilder.rb', line 398
def inline_sup(str)
" :superscript:`#{str}` "
end
|
#inline_table(id) ⇒ Object
267
268
269
|
# File 'lib/review/rstbuilder.rb', line 267
def inline_table(id)
"表 :numref:`#{id}` "
end
|
#inline_tt(str) ⇒ Object
Also known as:
inline_ttb, inline_tti
448
449
450
|
# File 'lib/review/rstbuilder.rb', line 448
def inline_tt(str)
" ``#{str}`` "
end
|
#inline_ttibold(str) ⇒ Object
748
749
750
751
|
# File 'lib/review/rstbuilder.rb', line 748
def inline_ttibold(str)
" **#{str}** "
end
|
#inline_u(str) ⇒ Object
457
458
459
|
# File 'lib/review/rstbuilder.rb', line 457
def inline_u(str)
" :subscript:`#{str}` "
end
|
#inline_uchar(str) ⇒ Object
479
480
481
|
# File 'lib/review/rstbuilder.rb', line 479
def inline_uchar(str)
[str.to_i(16)].pack('U')
end
|
#inline_warn(str) ⇒ Object
785
786
787
|
# File 'lib/review/rstbuilder.rb', line 785
def inline_warn(str)
" :warn:`#{str}` "
end
|
#insideout_begin(_level, _label, caption) ⇒ Object
563
564
565
|
# File 'lib/review/rstbuilder.rb', line 563
def insideout_begin(_level, _label, caption)
common_column_begin('insideout', caption)
end
|
#insideout_end(_level) ⇒ Object
567
568
569
|
# File 'lib/review/rstbuilder.rb', line 567
def insideout_end(_level)
common_column_end('insideout')
end
|
#insn(lines, caption = nil) ⇒ Object
Also known as:
box
681
682
683
|
# File 'lib/review/rstbuilder.rb', line 681
def insn(lines, caption = nil)
base_block('insn', lines, caption)
end
|
#label(id) ⇒ Object
703
704
705
706
|
# File 'lib/review/rstbuilder.rb', line 703
def label(id)
puts ".. _#{id}:"
blank
end
|
#link(lines, caption = nil) ⇒ Object
653
654
655
|
# File 'lib/review/rstbuilder.rb', line 653
def link(lines, caption = nil)
base_parablock('link', lines, caption)
end
|
#list_body(_id, lines, _lang) ⇒ Object
195
196
197
198
199
|
# File 'lib/review/rstbuilder.rb', line 195
def list_body(_id, lines, _lang)
lines.each do |line|
puts '-' + detab(line)
end
end
|
190
191
192
193
|
# File 'lib/review/rstbuilder.rb', line 190
def (id, _caption, _lang)
puts ".. _#{id}:"
blank
end
|
#listnum_body(lines, _lang) ⇒ Object
247
248
249
250
251
252
|
# File 'lib/review/rstbuilder.rb', line 247
def listnum_body(lines, _lang)
lines.each_with_index do |line, i|
puts(i + 1).to_s.rjust(2) + ": #{line}"
end
blank
end
|
#memo(lines, caption = nil) ⇒ Object
617
618
619
|
# File 'lib/review/rstbuilder.rb', line 617
def memo(lines, caption = nil)
base_parablock('memo', lines, caption)
end
|
#nofunc_text(str) ⇒ Object
769
770
771
|
# File 'lib/review/rstbuilder.rb', line 769
def nofunc_text(str)
str
end
|
499
500
501
|
# File 'lib/review/rstbuilder.rb', line 499
def noindent
end
|
#nonum_begin(_level, _label, caption) ⇒ Object
503
504
505
506
|
# File 'lib/review/rstbuilder.rb', line 503
def nonum_begin(_level, _label, caption)
puts ".. rubric: #{compile_inline(caption)}"
blank
end
|
#nonum_end(level) ⇒ Object
508
509
|
# File 'lib/review/rstbuilder.rb', line 508
def nonum_end(level)
end
|
#note(lines, caption = nil) ⇒ Object
613
614
615
|
# File 'lib/review/rstbuilder.rb', line 613
def note(lines, caption = nil)
base_parablock('note', lines, caption)
end
|
#notice(lines, caption = nil) ⇒ Object
657
658
659
|
# File 'lib/review/rstbuilder.rb', line 657
def notice(lines, caption = nil)
base_parablock('notice', lines, caption)
end
|
136
137
138
139
|
# File 'lib/review/rstbuilder.rb', line 136
def ol_begin
blank
@ol_indent += 1
end
|
145
146
147
148
|
# File 'lib/review/rstbuilder.rb', line 145
def ol_end
@ol_indent -= 1
blank
end
|
#ol_item(lines, _num) ⇒ Object
141
142
143
|
# File 'lib/review/rstbuilder.rb', line 141
def ol_item(lines, _num)
puts (' ' * (@ol_indent - 1)) + "#. #{join_lines_to_paragraph(lines)}"
end
|
#paragraph(lines) ⇒ Object
166
167
168
169
170
171
172
173
|
# File 'lib/review/rstbuilder.rb', line 166
def paragraph(lines)
pre = ''
if @in_role
pre = ' '
end
puts pre + join_lines_to_paragraph(lines)
puts "\n"
end
|
#planning(lines, caption = nil) ⇒ Object
629
630
631
|
# File 'lib/review/rstbuilder.rb', line 629
def planning(lines, caption = nil)
base_parablock('planning', lines, caption)
end
|
#point(lines, caption = nil) ⇒ Object
661
662
663
|
# File 'lib/review/rstbuilder.rb', line 661
def point(lines, caption = nil)
base_parablock('point', lines, caption)
end
|
#post_paragraph ⇒ Object
44
45
46
|
# File 'lib/review/rstbuilder.rb', line 44
def post_paragraph
''
end
|
#practice(lines) ⇒ Object
673
674
675
|
# File 'lib/review/rstbuilder.rb', line 673
def practice(lines)
base_parablock('practice', lines, nil)
end
|
#pre_paragraph ⇒ Object
40
41
42
|
# File 'lib/review/rstbuilder.rb', line 40
def pre_paragraph
''
end
|
#quote(lines) ⇒ Object
261
262
263
264
265
|
# File 'lib/review/rstbuilder.rb', line 261
def quote(lines)
blank
puts lines.map { |line| " #{line}" }.join
blank
end
|
#read(lines) ⇒ Object
Also known as:
lead
175
176
177
178
|
# File 'lib/review/rstbuilder.rb', line 175
def read(lines)
puts split_paragraph(lines).map { |line| " #{line}" }.join
blank
end
|
#ref_begin(_level, _label, caption) ⇒ Object
571
572
573
|
# File 'lib/review/rstbuilder.rb', line 571
def ref_begin(_level, _label, caption)
common_column_begin('ref', caption)
end
|
#ref_end(_level) ⇒ Object
575
576
577
|
# File 'lib/review/rstbuilder.rb', line 575
def ref_end(_level)
common_column_end('ref')
end
|
#reference(lines) ⇒ Object
669
670
671
|
# File 'lib/review/rstbuilder.rb', line 669
def reference(lines)
base_parablock('reference', lines, nil)
end
|
88
89
90
91
|
# File 'lib/review/rstbuilder.rb', line 88
def result
check_printendnotes
solve_nest(@output.string)
end
|
#security(lines, caption = nil) ⇒ Object
641
642
643
|
# File 'lib/review/rstbuilder.rb', line 641
def security(lines, caption = nil)
base_parablock('security', lines, caption)
end
|
#shoot(lines, caption = nil) ⇒ Object
665
666
667
|
# File 'lib/review/rstbuilder.rb', line 665
def shoot(lines, caption = nil)
base_parablock('shoot', lines, caption)
end
|
#source(lines, caption = nil, _lang = nil) ⇒ Object
744
745
746
|
# File 'lib/review/rstbuilder.rb', line 744
def source(lines, caption = nil, _lang = nil)
base_block('source', lines, caption)
end
|
#sup_begin(_level, _label, caption) ⇒ Object
579
580
581
|
# File 'lib/review/rstbuilder.rb', line 579
def sup_begin(_level, _label, caption)
common_column_begin('sup', caption)
end
|
#sup_end(_level) ⇒ Object
583
584
585
|
# File 'lib/review/rstbuilder.rb', line 583
def sup_end(_level)
common_column_end('sup')
end
|
#table_begin(ncols) ⇒ Object
327
328
|
# File 'lib/review/rstbuilder.rb', line 327
def table_begin(ncols)
end
|
#table_end ⇒ Object
350
351
352
|
# File 'lib/review/rstbuilder.rb', line 350
def table_end
blank
end
|
316
317
318
319
320
321
322
323
324
325
|
# File 'lib/review/rstbuilder.rb', line 316
def (id, caption)
unless id.nil?
blank
puts ".. _#{id}:"
end
blank
puts ".. list-table:: #{compile_inline(caption)}"
puts ' :header-rows: 1'
blank
end
|
346
347
348
|
# File 'lib/review/rstbuilder.rb', line 346
def td(str)
str
end
|
#term(lines) ⇒ Object
649
650
651
|
# File 'lib/review/rstbuilder.rb', line 649
def term(lines)
base_parablock('term', lines, nil)
end
|
#texequation(lines, id = nil, caption = '') ⇒ Object
301
302
303
304
305
306
307
308
309
310
311
312
313
314
|
# File 'lib/review/rstbuilder.rb', line 301
def texequation(lines, id = nil, caption = '')
if id
puts ".. _#{id}:"
end
puts '.. math::'
blank
puts lines.map { |line| " #{line}" }.join
blank
if caption.present?
puts " #{caption}"
blank
end
end
|
#text(str) ⇒ Object
732
733
734
|
# File 'lib/review/rstbuilder.rb', line 732
def text(str)
str
end
|
342
343
344
|
# File 'lib/review/rstbuilder.rb', line 342
def th(str)
str
end
|
#tip(lines, caption = nil) ⇒ Object
621
622
623
|
# File 'lib/review/rstbuilder.rb', line 621
def tip(lines, caption = nil)
base_parablock('tip', lines, caption)
end
|
330
331
332
333
334
335
336
337
338
339
340
|
# File 'lib/review/rstbuilder.rb', line 330
def tr(rows)
first = true
rows.each do |row|
if first
puts " * - #{row}"
first = false
else
puts " - #{row}"
end
end
end
|
122
123
124
125
|
# File 'lib/review/rstbuilder.rb', line 122
def ul_begin
blank
@ul_indent += 1
end
|
131
132
133
134
|
# File 'lib/review/rstbuilder.rb', line 131
def ul_end
@ul_indent -= 1
blank
end
|
#ul_item(lines) ⇒ Object
127
128
129
|
# File 'lib/review/rstbuilder.rb', line 127
def ul_item(lines)
puts (' ' * (@ul_indent - 1)) + "* #{join_lines_to_paragraph(lines)}"
end
|
#warning(lines, caption = nil) ⇒ Object
685
686
687
|
# File 'lib/review/rstbuilder.rb', line 685
def warning(lines, caption = nil)
base_parablock('warning', lines, caption)
end
|
#world_begin(_level, _label, caption) ⇒ Object
539
540
541
|
# File 'lib/review/rstbuilder.rb', line 539
def world_begin(_level, _label, caption)
common_column_begin('world', caption)
end
|
#world_end(_level) ⇒ Object
543
544
545
|
# File 'lib/review/rstbuilder.rb', line 543
def world_end(_level)
common_column_end('world')
end
|
#xcolumn_begin(_level, _label, caption) ⇒ Object
531
532
533
|
# File 'lib/review/rstbuilder.rb', line 531
def xcolumn_begin(_level, _label, caption)
common_column_begin('xcolumn', caption)
end
|
#xcolumn_end(_level) ⇒ Object
535
536
537
|
# File 'lib/review/rstbuilder.rb', line 535
def xcolumn_end(_level)
common_column_end('xcolumn')
end
|