Class: ReVIEW::TOPBuilder
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(lines, id, caption) ⇒ 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
-
#expert(lines) ⇒ Object
-
#extname ⇒ Object
-
#flushright(lines) ⇒ Object
-
#footnote(id, str) ⇒ Object
-
#handle_metric(str) ⇒ Object
-
#headline(level, _label, caption) ⇒ Object
-
#hood_begin(_level, _label, caption) ⇒ Object
-
#hood_end(_level) ⇒ Object
-
#image(lines, id, caption, metric = nil) ⇒ Object
-
#important(lines, caption = nil) ⇒ Object
-
#indepimage(_lines, id, caption = nil, 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
-
#inline_ttb(str) ⇒ Object
(also: #inline_ttbold)
-
#inline_tti(str) ⇒ Object
-
#inline_ttibold(str) ⇒ Object
-
#inline_u(str) ⇒ Object
-
#inline_uchar(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
-
#nodisp_begin(level, label, caption) ⇒ Object
-
#nodisp_end(level) ⇒ 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
-
#notoc_begin(level, _label, caption) ⇒ Object
-
#notoc_end(level) ⇒ 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
-
#result_metric(array) ⇒ 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(lines, id = nil, caption = nil) ⇒ 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
#bind, #captionblock, #compile_inline, #detab, #embed, #emtable, #error, #extract_chapter_id, #firstlinenum, #get_chap, #graph, #image_ext, #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, #target_name, #tsize, #ul_item_begin, #ul_item_end, #warn
Instance Method Details
#base_block(type, lines, caption = nil) ⇒ Object
205
206
207
208
209
210
211
212
|
# File 'lib/review/topbuilder.rb', line 205
def base_block(type, lines, caption = nil)
blank
puts "◆→開始:#{@titles[type]}←◆"
puts "■#{compile_inline(caption)}" if caption.present?
puts lines.join("\n")
puts "◆→終了:#{@titles[type]}←◆"
blank
end
|
#base_parablock(type, lines, caption = nil) ⇒ Object
214
215
216
217
218
219
220
221
|
# File 'lib/review/topbuilder.rb', line 214
def base_parablock(type, lines, caption = nil)
blank
puts "◆→開始:#{@titles[type]}←◆"
puts "■#{compile_inline(caption)}" if caption.present?
puts split_paragraph(lines).join("\n")
puts "◆→終了:#{@titles[type]}←◆"
blank
end
|
#best(lines, caption = nil) ⇒ Object
657
658
659
|
# File 'lib/review/topbuilder.rb', line 657
def best(lines, caption = nil)
base_parablock 'best', lines, caption
end
|
#bibpaper(lines, id, caption) ⇒ Object
503
504
505
506
|
# File 'lib/review/topbuilder.rb', line 503
def bibpaper(lines, id, caption)
id, caption
bibpaper_bibpaper id, caption, lines unless lines.empty?
end
|
#bibpaper_bibpaper(_id, _caption, lines) ⇒ Object
513
514
515
|
# File 'lib/review/topbuilder.rb', line 513
def bibpaper_bibpaper(_id, _caption, lines)
print split_paragraph(lines).join
end
|
508
509
510
511
|
# File 'lib/review/topbuilder.rb', line 508
def (id, caption)
print "[#{@chapter.bibpaper(id).number}]"
puts " #{compile_inline(caption)}"
end
|
#bpo(lines) ⇒ Object
740
741
742
|
# File 'lib/review/topbuilder.rb', line 740
def bpo(lines)
base_block 'bpo', lines, nil
end
|
#caution(lines, caption = nil) ⇒ Object
669
670
671
|
# File 'lib/review/topbuilder.rb', line 669
def caution(lines, caption = nil)
base_parablock 'caution', lines, caption
end
|
#centering(lines) ⇒ Object
633
634
635
|
# File 'lib/review/topbuilder.rb', line 633
def centering(lines)
base_parablock 'centering', lines, nil
end
|
#circle_begin(_level, _label, caption) ⇒ Object
803
804
805
|
# File 'lib/review/topbuilder.rb', line 803
def circle_begin(_level, _label, caption)
puts "・\t#{caption}"
end
|
#circle_end(level) ⇒ Object
807
808
|
# File 'lib/review/topbuilder.rb', line 807
def circle_end(level)
end
|
#cmd(lines, caption = nil) ⇒ Object
242
243
244
|
# File 'lib/review/topbuilder.rb', line 242
def cmd(lines, caption = nil)
base_block 'cmd', lines, caption
end
|
#column_begin(_level, _label, caption) ⇒ Object
565
566
567
|
# File 'lib/review/topbuilder.rb', line 565
def column_begin(_level, _label, caption)
common_column_begin('column', caption)
end
|
#column_end(_level) ⇒ Object
569
570
571
|
# File 'lib/review/topbuilder.rb', line 569
def column_end(_level)
common_column_end('column')
end
|
371
372
373
374
375
376
377
|
# File 'lib/review/topbuilder.rb', line 371
def (lines, = nil)
return unless @book.config['draft']
lines ||= []
lines.unshift unless .blank?
str = lines.join
puts "◆→#{str}←◆"
end
|
#common_column_begin(type, caption) ⇒ Object
554
555
556
557
558
|
# File 'lib/review/topbuilder.rb', line 554
def common_column_begin(type, caption)
blank
puts "◆→開始:#{@titles[type]}←◆"
puts "■#{compile_inline(caption)}"
end
|
#common_column_end(type) ⇒ Object
560
561
562
563
|
# File 'lib/review/topbuilder.rb', line 560
def common_column_end(type)
puts "◆→終了:#{@titles[type]}←◆"
blank
end
|
#compile_href(url, label) ⇒ Object
398
399
400
401
402
403
404
|
# File 'lib/review/topbuilder.rb', line 398
def compile_href(url, label)
if label
"#{label}(△#{url}☆)"
else
"△#{url}☆"
end
end
|
#compile_kw(word, alt) ⇒ Object
391
392
393
394
395
396
|
# File 'lib/review/topbuilder.rb', line 391
def compile_kw(word, alt)
if alt
then "★#{word}☆(#{alt.strip})"
else "★#{word}☆"
end
end
|
#compile_ruby(base, ruby) ⇒ Object
387
388
389
|
# File 'lib/review/topbuilder.rb', line 387
def compile_ruby(base, ruby)
"#{base}◆→DTP連絡:「#{base}」に「#{ruby}」とルビ←◆"
end
|
#dd(lines) ⇒ Object
158
159
160
|
# File 'lib/review/topbuilder.rb', line 158
def dd(lines)
split_paragraph(lines).each { |paragraph| puts "\t#{paragraph.gsub(/\n/, '')}" }
end
|
150
151
152
|
# File 'lib/review/topbuilder.rb', line 150
def dl_begin
blank
end
|
162
163
164
|
# File 'lib/review/topbuilder.rb', line 162
def dl_end
blank
end
|
154
155
156
|
# File 'lib/review/topbuilder.rb', line 154
def dt(line)
puts "★#{line}☆"
end
|
736
737
738
|
# File 'lib/review/topbuilder.rb', line 736
def dtp(str)
end
|
#edition_begin(_level, _label, caption) ⇒ Object
597
598
599
|
# File 'lib/review/topbuilder.rb', line 597
def edition_begin(_level, _label, caption)
common_column_begin('edition', caption)
end
|
#edition_end(_level) ⇒ Object
601
602
603
|
# File 'lib/review/topbuilder.rb', line 601
def edition_end(_level)
common_column_end('edition')
end
|
#emlist(lines, caption = nil, _lang = nil) ⇒ Object
223
224
225
|
# File 'lib/review/topbuilder.rb', line 223
def emlist(lines, caption = nil, _lang = nil)
base_block 'emlist', lines, caption
end
|
#emlistnum(lines, caption = nil, _lang = nil) ⇒ Object
227
228
229
230
231
232
233
234
|
# File 'lib/review/topbuilder.rb', line 227
def emlistnum(lines, caption = nil, _lang = nil)
blank
puts "◆→開始:#{@titles['emlist']}←◆"
puts "■#{compile_inline(caption)}" if caption.present?
lines.each_with_index { |line, i| puts((i + 1).to_s.rjust(2) + ": #{line}") }
puts "◆→終了:#{@titles['emlist']}←◆"
blank
end
|
#expert(lines) ⇒ Object
701
702
703
|
# File 'lib/review/topbuilder.rb', line 701
def expert(lines)
base_parablock 'expert', lines, nil
end
|
39
40
41
|
# File 'lib/review/topbuilder.rb', line 39
def extname
'.txt'
end
|
#flushright(lines) ⇒ Object
629
630
631
|
# File 'lib/review/topbuilder.rb', line 629
def flushright(lines)
base_parablock 'flushright', lines, nil
end
|
379
380
381
|
# File 'lib/review/topbuilder.rb', line 379
def (id, str)
puts "【注#{@chapter.(id).number}】#{compile_inline(str)}"
end
|
#handle_metric(str) ⇒ Object
268
269
270
|
# File 'lib/review/topbuilder.rb', line 268
def handle_metric(str)
str
end
|
#headline(level, _label, caption) ⇒ Object
119
120
121
122
|
# File 'lib/review/topbuilder.rb', line 119
def headline(level, _label, caption)
prefix, _anchor = headline_prefix(level)
puts %Q(■H#{level}■#{prefix}#{compile_inline(caption)})
end
|
#hood_begin(_level, _label, caption) ⇒ Object
589
590
591
|
# File 'lib/review/topbuilder.rb', line 589
def hood_begin(_level, _label, caption)
common_column_begin('hood', caption)
end
|
#hood_end(_level) ⇒ Object
593
594
595
|
# File 'lib/review/topbuilder.rb', line 593
def hood_end(_level)
common_column_end('hood')
end
|
#image(lines, id, caption, metric = nil) ⇒ Object
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
|
# File 'lib/review/topbuilder.rb', line 276
def image(lines, id, caption, metric = nil)
metrics = parse_metric('top', metric)
metrics = " #{metrics}" if metrics.present?
blank
puts "◆→開始:#{@titles['image']}←◆"
if get_chap
puts "#{I18n.t('image')}#{I18n.t('format_number', [get_chap, @chapter.image(id).number])}#{I18n.t('caption_prefix_idgxml')}#{compile_inline(caption)}"
else
puts "#{I18n.t('image')}#{I18n.t('format_number_without_chapter', [@chapter.image(id).number])}#{I18n.t('caption_prefix_idgxml')}#{compile_inline(caption)}"
end
blank
if @chapter.image(id).bound?
puts "◆→#{@chapter.image(id).path}#{metrics}←◆"
else
warn "image not bound: #{id}"
lines.each { |line| puts line }
end
puts "◆→終了:#{@titles['image']}←◆"
blank
end
|
#important(lines, caption = nil) ⇒ Object
661
662
663
|
# File 'lib/review/topbuilder.rb', line 661
def important(lines, caption = nil)
base_parablock 'important', lines, caption
end
|
#indepimage(_lines, id, caption = nil, metric = nil) ⇒ Object
Also known as:
numberlessimage
715
716
717
718
719
720
721
722
723
724
725
726
727
|
# File 'lib/review/topbuilder.rb', line 715
def indepimage(_lines, id, caption = nil, metric = nil)
metrics = parse_metric('top', metric)
metrics = " #{metrics}" if metrics.present?
blank
begin
puts "◆→画像 #{@chapter.image(id).path.sub(%r{\A\./}, '')}#{metrics}←◆"
rescue
warn "image not bound: #{id}"
puts "◆→画像 #{id}←◆"
end
puts "図 #{compile_inline(caption)}" if caption.present?
blank
end
|
#info(lines, caption = nil) ⇒ Object
649
650
651
|
# File 'lib/review/topbuilder.rb', line 649
def info(lines, caption = nil)
base_parablock 'info', lines, caption
end
|
#inline_ami(str) ⇒ Object
434
435
436
|
# File 'lib/review/topbuilder.rb', line 434
def inline_ami(str)
"#{str}◆→DTP連絡:「#{str}」に網カケ←◆"
end
|
#inline_b(str) ⇒ Object
Also known as:
inline_strong
442
443
444
|
# File 'lib/review/topbuilder.rb', line 442
def inline_b(str)
"★#{str}☆"
end
|
#inline_balloon(str) ⇒ Object
483
484
485
|
# File 'lib/review/topbuilder.rb', line 483
def inline_balloon(str)
%Q(\t←#{str.gsub(/@maru\[(\d+)\]/, inline_maru('\1'))})
end
|
#inline_bib(id) ⇒ Object
517
518
519
|
# File 'lib/review/topbuilder.rb', line 517
def inline_bib(id)
%Q([#{@chapter.bibpaper(id).number}])
end
|
#inline_bou(str) ⇒ Object
475
476
477
|
# File 'lib/review/topbuilder.rb', line 475
def inline_bou(str)
"#{str}◆→DTP連絡:「#{str}」に傍点←◆"
end
|
#inline_br(_str) ⇒ Object
758
759
760
|
# File 'lib/review/topbuilder.rb', line 758
def inline_br(_str)
"\n"
end
|
#inline_chap(id) ⇒ Object
766
767
768
769
770
|
# File 'lib/review/topbuilder.rb', line 766
def inline_chap(id)
super
end
|
#inline_chapref(id) ⇒ Object
772
773
774
775
776
777
778
779
780
781
782
783
|
# File 'lib/review/topbuilder.rb', line 772
def inline_chapref(id)
chs = ['', '「', '」']
if @book.config['chapref']
chs2 = @book.config['chapref'].split(',')
error '--chapsplitter must have exactly 3 parameters with comma.' if chs2.size != 3
chs = chs2
end
"#{chs[0]}#{@book.chapter_index.number(id)}#{chs[1]}#{@book.chapter_index.title(id)}#{chs[2]}"
rescue KeyError
error "unknown chapter: #{id}"
nofunc_text("[UnknownChapter:#{id}]")
end
|
#inline_code(str) ⇒ Object
754
755
756
|
# File 'lib/review/topbuilder.rb', line 754
def inline_code(str)
"△#{str}☆"
end
|
491
492
493
494
495
496
497
|
# File 'lib/review/topbuilder.rb', line 491
def (str)
if @book.config['draft']
"◆→#{str}←◆"
else
''
end
end
|
#inline_del(_str) ⇒ Object
749
750
751
752
|
# File 'lib/review/topbuilder.rb', line 749
def inline_del(_str)
''
end
|
#inline_dtp(_str) ⇒ Object
744
745
746
747
|
# File 'lib/review/topbuilder.rb', line 744
def inline_dtp(_str)
''
end
|
#inline_fn(id) ⇒ Object
383
384
385
|
# File 'lib/review/topbuilder.rb', line 383
def inline_fn(id)
"【注#{@chapter.(id).number}】"
end
|
#inline_hd_chap(chap, id) ⇒ Object
521
522
523
524
525
526
527
|
# File 'lib/review/topbuilder.rb', line 521
def inline_hd_chap(chap, id)
if chap.number
n = chap.headline_index.number(id)
return I18n.t('chapter_quote', "#{n} #{compile_inline(chap.headline(id).caption)}") if @book.config['secnolevel'] >= n.split('.').size
end
I18n.t('chapter_quote', compile_inline(chap.headline(id).caption))
end
|
#inline_hidx(str) ⇒ Object
430
431
432
|
# File 'lib/review/topbuilder.rb', line 430
def inline_hidx(str)
"◆→索引項目:#{str}←◆"
end
|
#inline_hint(str) ⇒ Object
418
419
420
|
# File 'lib/review/topbuilder.rb', line 418
def inline_hint(str)
"◆→ヒントスタイルここから←◆#{str}◆→ヒントスタイルここまで←◆"
end
|
#inline_i(str) ⇒ Object
438
439
440
|
# File 'lib/review/topbuilder.rb', line 438
def inline_i(str)
"▲#{str}☆"
end
|
#inline_icon(id) ⇒ Object
466
467
468
469
470
471
472
473
|
# File 'lib/review/topbuilder.rb', line 466
def inline_icon(id)
begin
"◆→画像 #{@chapter.image(id).path.sub(%r{\A\./}, '')}←◆"
rescue
warn "image not bound: #{id}"
"◆→画像 #{id}←◆"
end
end
|
#inline_idx(str) ⇒ Object
426
427
428
|
# File 'lib/review/topbuilder.rb', line 426
def inline_idx(str)
"#{str}◆→索引項目:#{str}←◆"
end
|
#inline_img(id) ⇒ Object
259
260
261
262
263
264
265
266
|
# File 'lib/review/topbuilder.rb', line 259
def inline_img(id)
chapter, id = (id)
if get_chap(chapter)
"#{I18n.t('image')}#{I18n.t('format_number', [get_chap(chapter), chapter.image(id).number])}"
else
"#{I18n.t('image')}#{I18n.t('format_number_without_chapter', [chapter.image(id).number])}"
end
end
|
#inline_keytop(str) ⇒ Object
479
480
481
|
# File 'lib/review/topbuilder.rb', line 479
def inline_keytop(str)
"#{str}◆→キートップ#{str}←◆"
end
|
#inline_labelref(idref) ⇒ Object
Also known as:
inline_ref
793
794
795
|
# File 'lib/review/topbuilder.rb', line 793
def inline_labelref(idref)
"「◆→#{idref}←◆」" end
|
#inline_list(id) ⇒ Object
179
180
181
182
183
184
185
186
|
# File 'lib/review/topbuilder.rb', line 179
def inline_list(id)
chapter, id = (id)
if get_chap(chapter)
%Q(#{I18n.t('list')}#{I18n.t('format_number', [get_chap(chapter), chapter.list(id).number])})
else
%Q(#{I18n.t('list')}#{I18n.t('format_number_without_chapter', [chapter.list(id).number])})
end
end
|
#inline_m(str) ⇒ Object
499
500
501
|
# File 'lib/review/topbuilder.rb', line 499
def inline_m(str)
%Q(◆→TeX式ここから←◆#{str}◆→TeX式ここまで←◆)
end
|
#inline_maru(str) ⇒ Object
422
423
424
|
# File 'lib/review/topbuilder.rb', line 422
def inline_maru(str)
"#{str}◆→丸数字#{str}←◆"
end
|
799
800
801
|
# File 'lib/review/topbuilder.rb', line 799
def (idref)
"●ページ◆→#{idref}←◆" end
|
#inline_raw(str) ⇒ Object
414
415
416
|
# File 'lib/review/topbuilder.rb', line 414
def inline_raw(str)
super(str).gsub('\\n', "\n")
end
|
#inline_sub(str) ⇒ Object
410
411
412
|
# File 'lib/review/topbuilder.rb', line 410
def inline_sub(str)
"#{str}◆→DTP連絡:「#{str}」は下付き←◆"
end
|
#inline_sup(str) ⇒ Object
406
407
408
|
# File 'lib/review/topbuilder.rb', line 406
def inline_sup(str)
"#{str}◆→DTP連絡:「#{str}」は上付き←◆"
end
|
#inline_table(id) ⇒ Object
250
251
252
253
254
255
256
257
|
# File 'lib/review/topbuilder.rb', line 250
def inline_table(id)
chapter, id = (id)
if get_chap(chapter)
"#{I18n.t('table')}#{I18n.t('format_number', [get_chap(chapter), chapter.table(id).number])}"
else
"#{I18n.t('table')}#{I18n.t('format_number_without_chapter', [chapter.table(id).number])}"
end
end
|
#inline_tt(str) ⇒ Object
448
449
450
|
# File 'lib/review/topbuilder.rb', line 448
def inline_tt(str)
"△#{str}☆"
end
|
#inline_ttb(str) ⇒ Object
Also known as:
inline_ttbold
452
453
454
|
# File 'lib/review/topbuilder.rb', line 452
def inline_ttb(str)
"★#{str}☆◆→等幅フォント太字←◆"
end
|
#inline_tti(str) ⇒ Object
458
459
460
|
# File 'lib/review/topbuilder.rb', line 458
def inline_tti(str)
"▲#{str}☆◆→等幅フォントイタ←◆"
end
|
#inline_ttibold(str) ⇒ Object
789
790
791
|
# File 'lib/review/topbuilder.rb', line 789
def inline_ttibold(str)
"▲#{str}☆◆→等幅フォント太字イタ←◆"
end
|
#inline_u(str) ⇒ Object
462
463
464
|
# File 'lib/review/topbuilder.rb', line 462
def inline_u(str)
"@#{str}@◆→@〜@部分に下線←◆"
end
|
#inline_uchar(str) ⇒ Object
487
488
489
|
# File 'lib/review/topbuilder.rb', line 487
def inline_uchar(str)
[str.to_i(16)].pack('U')
end
|
#insideout_begin(_level, _label, caption) ⇒ Object
605
606
607
|
# File 'lib/review/topbuilder.rb', line 605
def insideout_begin(_level, _label, caption)
common_column_begin('insideout', caption)
end
|
#insideout_end(_level) ⇒ Object
609
610
611
|
# File 'lib/review/topbuilder.rb', line 609
def insideout_end(_level)
common_column_end('insideout')
end
|
#insn(lines, caption = nil) ⇒ Object
Also known as:
box
705
706
707
|
# File 'lib/review/topbuilder.rb', line 705
def insn(lines, caption = nil)
base_block 'insn', lines, caption
end
|
#label(_id) ⇒ Object
731
732
733
734
|
# File 'lib/review/topbuilder.rb', line 731
def label(_id)
''
end
|
#link(lines, caption = nil) ⇒ Object
677
678
679
|
# File 'lib/review/topbuilder.rb', line 677
def link(lines, caption = nil)
base_parablock 'link', lines, caption
end
|
#list_body(_id, lines, _lang) ⇒ Object
199
200
201
202
203
|
# File 'lib/review/topbuilder.rb', line 199
def list_body(_id, lines, _lang)
lines.each { |line| puts detab(line) }
puts "◆→終了:#{@titles['list']}←◆"
blank
end
|
188
189
190
191
192
193
194
195
196
197
|
# File 'lib/review/topbuilder.rb', line 188
def (id, caption, _lang)
blank
puts "◆→開始:#{@titles['list']}←◆"
if get_chap
puts %Q(#{I18n.t('list')}#{I18n.t('format_number', [get_chap, @chapter.list(id).number])}#{I18n.t('caption_prefix_idgxml')}#{compile_inline(caption)})
else
puts %Q(#{I18n.t('list')}#{I18n.t('format_number_without_chapter', [@chapter.list(id).number])}#{I18n.t('caption_prefix_idgxml')}#{compile_inline(caption)})
end
blank
end
|
#listnum_body(lines, _lang) ⇒ Object
236
237
238
239
240
|
# File 'lib/review/topbuilder.rb', line 236
def listnum_body(lines, _lang)
lines.each_with_index { |line, i| puts((i + 1).to_s.rjust(2) + ": #{line}") }
puts "◆→終了:#{@titles['list']}←◆"
blank
end
|
#memo(lines, caption = nil) ⇒ Object
641
642
643
|
# File 'lib/review/topbuilder.rb', line 641
def memo(lines, caption = nil)
base_parablock 'memo', lines, caption
end
|
#nodisp_begin(level, label, caption) ⇒ Object
547
548
549
|
# File 'lib/review/topbuilder.rb', line 547
def nodisp_begin(level, label, caption)
end
|
#nodisp_end(level) ⇒ Object
551
552
|
# File 'lib/review/topbuilder.rb', line 551
def nodisp_end(level)
end
|
#nofunc_text(str) ⇒ Object
810
811
812
|
# File 'lib/review/topbuilder.rb', line 810
def nofunc_text(str)
str
end
|
529
530
531
|
# File 'lib/review/topbuilder.rb', line 529
def noindent
puts '◆→DTP連絡:次の1行インデントなし←◆'
end
|
#nonum_begin(level, _label, caption) ⇒ Object
533
534
535
|
# File 'lib/review/topbuilder.rb', line 533
def nonum_begin(level, _label, caption)
puts "■H#{level}■#{compile_inline(caption)}"
end
|
#nonum_end(level) ⇒ Object
537
538
|
# File 'lib/review/topbuilder.rb', line 537
def nonum_end(level)
end
|
#note(lines, caption = nil) ⇒ Object
637
638
639
|
# File 'lib/review/topbuilder.rb', line 637
def note(lines, caption = nil)
base_parablock 'note', lines, caption
end
|
#notice(lines, caption = nil) ⇒ Object
681
682
683
|
# File 'lib/review/topbuilder.rb', line 681
def notice(lines, caption = nil)
base_parablock 'notice', lines, caption
end
|
#notoc_begin(level, _label, caption) ⇒ Object
540
541
542
|
# File 'lib/review/topbuilder.rb', line 540
def notoc_begin(level, _label, caption)
puts "■H#{level}■#{compile_inline(caption)}◆→DTP連絡:目次に掲載しない←◆"
end
|
#notoc_end(level) ⇒ Object
544
545
|
# File 'lib/review/topbuilder.rb', line 544
def notoc_end(level)
end
|
136
137
138
139
|
# File 'lib/review/topbuilder.rb', line 136
def ol_begin
blank
@olitem = 0
end
|
145
146
147
148
|
# File 'lib/review/topbuilder.rb', line 145
def ol_end
blank
@olitem = nil
end
|
#ol_item(lines, num) ⇒ Object
141
142
143
|
# File 'lib/review/topbuilder.rb', line 141
def ol_item(lines, num)
puts "#{num}\t#{lines.join}"
end
|
#paragraph(lines) ⇒ Object
166
167
168
|
# File 'lib/review/topbuilder.rb', line 166
def paragraph(lines)
puts lines.join
end
|
#planning(lines, caption = nil) ⇒ Object
653
654
655
|
# File 'lib/review/topbuilder.rb', line 653
def planning(lines, caption = nil)
base_parablock 'planning', lines, caption
end
|
#point(lines, caption = nil) ⇒ Object
685
686
687
|
# File 'lib/review/topbuilder.rb', line 685
def point(lines, caption = nil)
base_parablock 'point', lines, caption
end
|
#post_paragraph ⇒ Object
35
36
37
|
# File 'lib/review/topbuilder.rb', line 35
def post_paragraph
''
end
|
#practice(lines) ⇒ Object
697
698
699
|
# File 'lib/review/topbuilder.rb', line 697
def practice(lines)
base_parablock 'practice', lines, nil
end
|
#pre_paragraph ⇒ Object
31
32
33
|
# File 'lib/review/topbuilder.rb', line 31
def pre_paragraph
''
end
|
#quote(lines) ⇒ Object
246
247
248
|
# File 'lib/review/topbuilder.rb', line 246
def quote(lines)
base_parablock 'quote', lines, nil
end
|
#read(lines) ⇒ Object
Also known as:
lead
170
171
172
173
174
175
|
# File 'lib/review/topbuilder.rb', line 170
def read(lines)
puts "◆→開始:#{@titles['lead']}←◆"
puts split_paragraph(lines).join("\n")
puts "◆→終了:#{@titles['lead']}←◆"
blank
end
|
#ref_begin(_level, _label, caption) ⇒ Object
613
614
615
|
# File 'lib/review/topbuilder.rb', line 613
def ref_begin(_level, _label, caption)
common_column_begin('ref', caption)
end
|
#ref_end(_level) ⇒ Object
617
618
619
|
# File 'lib/review/topbuilder.rb', line 617
def ref_end(_level)
common_column_end('ref')
end
|
#reference(lines) ⇒ Object
693
694
695
|
# File 'lib/review/topbuilder.rb', line 693
def reference(lines)
base_parablock 'reference', lines, nil
end
|
115
116
117
|
# File 'lib/review/topbuilder.rb', line 115
def result
@output.string
end
|
#result_metric(array) ⇒ Object
272
273
274
|
# File 'lib/review/topbuilder.rb', line 272
def result_metric(array)
array.join(',')
end
|
#security(lines, caption = nil) ⇒ Object
665
666
667
|
# File 'lib/review/topbuilder.rb', line 665
def security(lines, caption = nil)
base_parablock 'security', lines, caption
end
|
#shoot(lines, caption = nil) ⇒ Object
689
690
691
|
# File 'lib/review/topbuilder.rb', line 689
def shoot(lines, caption = nil)
base_parablock 'shoot', lines, caption
end
|
#source(lines, caption = nil, _lang = nil) ⇒ Object
785
786
787
|
# File 'lib/review/topbuilder.rb', line 785
def source(lines, caption = nil, _lang = nil)
base_block 'source', lines, caption
end
|
#sup_begin(_level, _label, caption) ⇒ Object
621
622
623
|
# File 'lib/review/topbuilder.rb', line 621
def sup_begin(_level, _label, caption)
common_column_begin('sup', caption)
end
|
#sup_end(_level) ⇒ Object
625
626
627
|
# File 'lib/review/topbuilder.rb', line 625
def sup_end(_level)
common_column_end('sup')
end
|
#table(lines, id = nil, caption = nil) ⇒ Object
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
|
# File 'lib/review/topbuilder.rb', line 304
def table(lines, id = nil, caption = nil)
blank
puts "◆→開始:#{@titles['table']}←◆"
rows = []
sepidx = nil
lines.each_with_index do |line, idx|
if /\A[\=\-]{12}/ =~ line
sepidx ||= idx
next
end
rows.push(line.strip.split(/\t+/).map { |s| s.sub(/\A\./, '') })
end
rows = adjust_n_cols(rows)
begin
id, caption if caption.present?
rescue KeyError
error "no such table: #{id}"
end
return if rows.empty?
table_begin rows.first.size
if sepidx
sepidx.times { tr(rows.shift.map { |s| th(s) }) }
rows.each { |cols| tr(cols.map { |s| td(s) }) }
else
rows.each do |cols|
h, *cs = *cols
tr([th(h)] + cs.map { |s| td(s) })
end
end
table_end
end
|
#table_begin(ncols) ⇒ Object
351
352
|
# File 'lib/review/topbuilder.rb', line 351
def table_begin(ncols)
end
|
#table_end ⇒ Object
366
367
368
369
|
# File 'lib/review/topbuilder.rb', line 366
def table_end
puts "◆→終了:#{@titles['table']}←◆"
blank
end
|
340
341
342
343
344
345
346
347
348
349
|
# File 'lib/review/topbuilder.rb', line 340
def (id, caption)
if id.nil?
puts compile_inline(caption)
elsif get_chap
puts "#{I18n.t('table')}#{I18n.t('format_number', [get_chap, @chapter.table(id).number])}#{I18n.t('caption_prefix_idgxml')}#{compile_inline(caption)}"
else
puts "#{I18n.t('table')}#{I18n.t('format_number_without_chapter', [@chapter.table(id).number])}#{I18n.t('caption_prefix_idgxml')}#{compile_inline(caption)}"
end
blank
end
|
362
363
364
|
# File 'lib/review/topbuilder.rb', line 362
def td(str)
str
end
|
#term(lines) ⇒ Object
673
674
675
|
# File 'lib/review/topbuilder.rb', line 673
def term(lines)
base_parablock 'term', lines, nil
end
|
#texequation(lines) ⇒ Object
297
298
299
300
301
302
|
# File 'lib/review/topbuilder.rb', line 297
def texequation(lines)
puts "◆→開始:#{@titles['texequation']}←◆"
puts lines.join("\n")
puts "◆→終了:#{@titles['texequation']}←◆"
blank
end
|
#text(str) ⇒ Object
762
763
764
|
# File 'lib/review/topbuilder.rb', line 762
def text(str)
str
end
|
358
359
360
|
# File 'lib/review/topbuilder.rb', line 358
def th(str)
"★#{str}☆"
end
|
#tip(lines, caption = nil) ⇒ Object
645
646
647
|
# File 'lib/review/topbuilder.rb', line 645
def tip(lines, caption = nil)
base_parablock 'tip', lines, caption
end
|
354
355
356
|
# File 'lib/review/topbuilder.rb', line 354
def tr(rows)
puts rows.join("\t")
end
|
124
125
126
|
# File 'lib/review/topbuilder.rb', line 124
def ul_begin
blank
end
|
132
133
134
|
# File 'lib/review/topbuilder.rb', line 132
def ul_end
blank
end
|
#ul_item(lines) ⇒ Object
128
129
130
|
# File 'lib/review/topbuilder.rb', line 128
def ul_item(lines)
puts "●\t#{lines.join}"
end
|
#warning(lines, caption = nil) ⇒ Object
709
710
711
|
# File 'lib/review/topbuilder.rb', line 709
def warning(lines, caption = nil)
base_parablock 'warning', lines, caption
end
|
#world_begin(_level, _label, caption) ⇒ Object
581
582
583
|
# File 'lib/review/topbuilder.rb', line 581
def world_begin(_level, _label, caption)
common_column_begin('world', caption)
end
|
#world_end(_level) ⇒ Object
585
586
587
|
# File 'lib/review/topbuilder.rb', line 585
def world_end(_level)
common_column_end('world')
end
|
#xcolumn_begin(_level, _label, caption) ⇒ Object
573
574
575
|
# File 'lib/review/topbuilder.rb', line 573
def xcolumn_begin(_level, _label, caption)
common_column_begin('xcolumn', caption)
end
|
#xcolumn_end(_level) ⇒ Object
577
578
579
|
# File 'lib/review/topbuilder.rb', line 577
def xcolumn_end(_level)
common_column_end('xcolumn')
end
|