Class: ReVIEW::TOPBuilder
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
-
#bibpaper_header(id, caption) ⇒ Object
-
#circle_begin(_level, _label, caption) ⇒ Object
-
#comment(lines, comment = nil) ⇒ Object
-
#common_block_begin(type, _level, _label, caption = nil) ⇒ Object
-
#common_block_end(type, _level) ⇒ 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
-
#dt(line) ⇒ Object
-
#emlistnum(lines, caption = nil, _lang = nil) ⇒ Object
-
#endnote_begin ⇒ Object
-
#endnote_end ⇒ Object
-
#endnote_item(id) ⇒ Object
-
#footnote(id, str) ⇒ Object
-
#headline(level, _label, caption) ⇒ Object
-
#image(lines, id, caption, metric = nil) ⇒ Object
-
#image_header(id, caption) ⇒ Object
-
#imgtable(lines, id, caption = nil, metric = nil) ⇒ Object
-
#indepimage(lines, id, caption = nil, metric = nil) ⇒ Object
(also: #numberlessimage)
-
#indepimage_header(_id, caption) ⇒ 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_code(str) ⇒ Object
-
#inline_comment(str) ⇒ Object
-
#inline_del(str) ⇒ Object
-
#inline_endnote(id) ⇒ Object
-
#inline_fn(id) ⇒ Object
-
#inline_hidx(str) ⇒ Object
-
#inline_hint(str) ⇒ Object
-
#inline_i(str) ⇒ Object
-
#inline_icon(id) ⇒ Object
-
#inline_idx(str) ⇒ Object
-
#inline_ins(str) ⇒ Object
-
#inline_keytop(str) ⇒ Object
-
#inline_labelref(idref) ⇒ Object
(also: #inline_ref)
-
#inline_m(str) ⇒ Object
-
#inline_maru(str) ⇒ Object
-
#inline_pageref(idref) ⇒ Object
-
#inline_sub(str) ⇒ Object
-
#inline_sup(str) ⇒ Object
-
#inline_tcy(str) ⇒ Object
-
#inline_tt(str) ⇒ Object
-
#inline_ttb(str) ⇒ Object
(also: #inline_ttbold)
-
#inline_tti(str) ⇒ Object
-
#inline_ttibold(str) ⇒ Object
-
#inline_u(str) ⇒ Object
-
#list(lines, id, caption, lang = nil) ⇒ Object
-
#list_body(_id, lines, _lang) ⇒ Object
-
#list_header(id, caption, _lang) ⇒ Object
-
#listnum(lines, id, caption, lang = nil) ⇒ Object
-
#listnum_body(lines, _lang) ⇒ Object
-
#noindent ⇒ Object
-
#nonum_begin(level, _label, caption) ⇒ Object
-
#notoc_begin(level, _label, caption) ⇒ Object
-
#ol_item(lines, num) ⇒ Object
-
#read(lines) ⇒ Object
(also: #lead)
-
#table(lines, id = nil, caption = nil) ⇒ Object
-
#table_end ⇒ Object
-
#table_rows(sepidx, rows) ⇒ Object
-
#texequation(lines, id = nil, caption = '') ⇒ Object
-
#texequation_header(id, caption) ⇒ Object
-
#th(str) ⇒ Object
-
#ul_item(lines) ⇒ Object
#best, #bibpaper, #bibpaper_bibpaper, #bpo, #caution, #centering, #circle_end, #cmd, #column_begin, #column_end, #dl_begin, #dl_end, #dtp, #edition_begin, #edition_end, #emlist, #expert, #extname, #flushright, #graph_mermaid, #hood_begin, #hood_end, #image_ext, #important, #info, #inline_br, #inline_chap, #inline_chapref, #inline_dtp, #inline_hd_chap, #inline_raw, #inline_uchar, #insideout_begin, #insideout_end, #insn, #label, #link, #memo, #nodisp_begin, #nodisp_end, #nofunc_text, #nonum_end, #note, #notice, #notoc_end, #ol_begin, #ol_end, #olnum, #paragraph, #planning, #point, #post_paragraph, #practice, #pre_paragraph, #quote, #ref_begin, #ref_end, #reference, #result, #security, #shoot, #solve_nest, #source, #sup_begin, #sup_end, #table_begin, #table_header, #term, #text, #tip, #tr, #ul_begin, #ul_end, #warning, #world_begin, #world_end, #xcolumn_begin, #xcolumn_end
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, #emtable, #endchild, #endnote, #escape, #extract_chapter_id, #firstlinenum, #get_chap, #graph, #graph_aafigure, #graph_blockdiag, #graph_gnuplot, #graph_graphviz, #graph_mermaid, #graph_plantuml, #handle_metric, #highlight?, #image_ext, #in_minicolumn?, #initialize, #inline_chap, #inline_chapref, #inline_column, #inline_column_chap, #inline_embed, #inline_eq, #inline_hd, #inline_href, #inline_img, #inline_imgref, #inline_include, #inline_kw, #inline_list, #inline_raw, #inline_ruby, #inline_sec, #inline_sectitle, #inline_table, #inline_title, #inline_w, #inline_wb, #line_num, #load_words, #minicolumn_block_name?, #over_secnolevel?, #parse_metric, #parse_table_rows, #post_paragraph, #pre_paragraph, #previous_list_type, #print, #printendnotes, #puts, #raw, #result, #result_metric, #solve_nest, #source, #system_graph, #table_row_separator_regexp, #target_name, #text, #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
128
129
130
131
132
133
134
135
136
137
138
139
140
|
# File 'lib/review/topbuilder.rb', line 128
def base_block(type, lines, caption = nil)
blank
puts "◆→開始:#{@titles[type]}←◆"
if caption_top?('list') && caption.present?
puts "■#{compile_inline(caption)}"
end
puts lines.join("\n")
if !caption_top?('list') && caption.present?
puts "■#{compile_inline(caption)}"
end
puts "◆→終了:#{@titles[type]}←◆"
blank
end
|
#base_parablock(type, lines, caption = nil) ⇒ Object
142
143
144
145
146
147
148
149
|
# File 'lib/review/topbuilder.rb', line 142
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
|
487
488
489
490
|
# File 'lib/review/topbuilder.rb', line 487
def (id, caption)
print "[#{@chapter.bibpaper(id).number}]"
puts " #{compile_inline(caption)}"
end
|
#circle_begin(_level, _label, caption) ⇒ Object
596
597
598
|
# File 'lib/review/topbuilder.rb', line 596
def circle_begin(_level, _label, caption)
puts "・\t#{caption}"
end
|
320
321
322
323
324
325
326
327
328
329
|
# File 'lib/review/topbuilder.rb', line 320
def (lines, = nil)
return unless @book.config['draft']
lines ||= []
unless .blank?
lines.unshift()
end
str = lines.join("\n")
puts "◆→#{str}←◆"
end
|
#common_block_begin(type, _level, _label, caption = nil) ⇒ Object
521
522
523
524
525
|
# File 'lib/review/topbuilder.rb', line 521
def common_block_begin(type, _level, _label, caption = nil)
blank
puts "◆→開始:#{@titles[type]}←◆"
puts '■' + compile_inline(caption) if caption.present?
end
|
#common_block_end(type, _level) ⇒ Object
527
528
529
530
|
# File 'lib/review/topbuilder.rb', line 527
def common_block_end(type, _level)
puts "◆→終了:#{@titles[type]}←◆"
blank
end
|
#common_column_begin(type, caption) ⇒ Object
510
511
512
513
514
|
# File 'lib/review/topbuilder.rb', line 510
def common_column_begin(type, caption)
blank
puts "◆→開始:#{@titles[type]}←◆"
puts "■#{compile_inline(caption)}"
end
|
#common_column_end(type) ⇒ Object
516
517
518
519
|
# File 'lib/review/topbuilder.rb', line 516
def common_column_end(type)
puts "◆→終了:#{@titles[type]}←◆"
blank
end
|
#compile_href(url, label) ⇒ Object
371
372
373
374
375
376
377
|
# File 'lib/review/topbuilder.rb', line 371
def compile_href(url, label)
if label
"#{label}(△#{url}☆)"
else
"△#{url}☆"
end
end
|
#compile_kw(word, alt) ⇒ Object
363
364
365
366
367
368
369
|
# File 'lib/review/topbuilder.rb', line 363
def compile_kw(word, alt)
if alt
"★#{word}☆(#{alt.strip})"
else
"★#{word}☆"
end
end
|
#compile_ruby(base, ruby) ⇒ Object
359
360
361
|
# File 'lib/review/topbuilder.rb', line 359
def compile_ruby(base, ruby)
"#{base}◆→DTP連絡:「#{base}」に「#{ruby}」とルビ←◆"
end
|
#dd(lines) ⇒ Object
79
80
81
82
83
|
# File 'lib/review/topbuilder.rb', line 79
def dd(lines)
split_paragraph(lines).each do |paragraph|
puts "\t#{paragraph.delete("\n")}"
end
end
|
75
76
77
|
# File 'lib/review/topbuilder.rb', line 75
def dt(line)
puts "★#{line}☆"
end
|
#emlistnum(lines, caption = nil, _lang = nil) ⇒ Object
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
|
# File 'lib/review/topbuilder.rb', line 151
def emlistnum(lines, caption = nil, _lang = nil)
blank
puts "◆→開始:#{@titles['emlist']}←◆"
if caption_top?('list') && caption.present?
puts "■#{compile_inline(caption)}"
end
lines.each_with_index do |line, i|
puts((i + 1).to_s.rjust(2) + ": #{line}")
end
if !caption_top?('list') && caption.present?
puts "■#{compile_inline(caption)}"
end
puts "◆→終了:#{@titles['emlist']}←◆"
blank
end
|
#endnote_begin ⇒ Object
347
348
349
|
# File 'lib/review/topbuilder.rb', line 347
def endnote_begin
puts '◆→開始:後注←◆'
end
|
#endnote_end ⇒ Object
351
352
353
|
# File 'lib/review/topbuilder.rb', line 351
def endnote_end
puts '◆→終了:後注←◆'
end
|
#endnote_item(id) ⇒ Object
355
356
357
|
# File 'lib/review/topbuilder.rb', line 355
def endnote_item(id)
puts "【後注#{@chapter.endnote(id).number}】#{compile_inline(@chapter.endnote(id).content)}"
end
|
331
332
333
|
# File 'lib/review/topbuilder.rb', line 331
def (id, str)
puts "【注#{@chapter.(id).number}】#{compile_inline(str)}"
end
|
#headline(level, _label, caption) ⇒ Object
62
63
64
65
|
# File 'lib/review/topbuilder.rb', line 62
def headline(level, _label, caption)
prefix, _anchor = headline_prefix(level)
puts %Q(■H#{level}■#{prefix}#{compile_inline(caption)})
end
|
#image(lines, id, caption, metric = nil) ⇒ Object
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
|
# File 'lib/review/topbuilder.rb', line 193
def image(lines, id, caption, metric = nil)
metrics = parse_metric('top', metric)
metrics = " #{metrics}" if metrics.present?
blank
puts "◆→開始:#{@titles['image']}←◆"
if caption_top?('image')
(id, caption)
blank
end
if @chapter.image_bound?(id)
puts "◆→#{@chapter.image(id).path}#{metrics}←◆"
else
warn "image not bound: #{id}", location: location
lines.each do |line|
puts line
end
end
unless caption_top?('image')
blank
(id, caption)
end
puts "◆→終了:#{@titles['image']}←◆"
blank
end
|
218
219
220
221
222
223
224
|
# File 'lib/review/topbuilder.rb', line 218
def (id, caption)
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
end
|
#imgtable(lines, id, caption = nil, metric = nil) ⇒ Object
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
|
# File 'lib/review/topbuilder.rb', line 295
def imgtable(lines, id, caption = nil, metric = nil)
metrics = parse_metric('top', metric)
metrics = " #{metrics}" if metrics.present?
blank
puts "◆→開始:#{@titles['table']}←◆"
if caption_top?('table') && caption.present?
(id, caption)
end
if @chapter.image_bound?(id)
puts "◆→#{@chapter.image(id).path}#{metrics}←◆"
else
warn "image not bound: #{id}", location: location
lines.each do |line|
puts line
end
end
if !caption_top?('table') && caption.present?
(id, caption)
end
puts "◆→終了:#{@titles['table']}←◆"
blank
end
|
#indepimage(lines, id, caption = nil, metric = nil) ⇒ Object
Also known as:
numberlessimage
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
|
# File 'lib/review/topbuilder.rb', line 547
def indepimage(lines, id, caption = nil, metric = nil)
metrics = parse_metric('top', metric)
metrics = " #{metrics}" if metrics.present?
blank
puts "◆→開始:#{@titles['image']}←◆"
if caption_top?('image') && caption.present?
(id, caption)
blank
end
if @chapter.image_bound?(id)
puts "◆→#{@chapter.image(id).path}#{metrics}←◆"
else
warn "image not bound: #{id}", location: location
lines.each do |line|
puts line
end
end
if !caption_top?('image') && caption.present?
blank
(id, caption)
end
puts "◆→終了:#{@titles['image']}←◆"
blank
end
|
574
575
576
|
# File 'lib/review/topbuilder.rb', line 574
def (_id, caption)
puts "図#{I18n.t('caption_prefix_idgxml')}#{compile_inline(caption)}"
end
|
#inline_ami(str) ⇒ Object
403
404
405
|
# File 'lib/review/topbuilder.rb', line 403
def inline_ami(str)
"#{str}◆→DTP連絡:「#{str}」に網カケ←◆"
end
|
#inline_b(str) ⇒ Object
Also known as:
inline_strong
411
412
413
|
# File 'lib/review/topbuilder.rb', line 411
def inline_b(str)
"★#{str}☆"
end
|
#inline_balloon(str) ⇒ Object
464
465
466
|
# File 'lib/review/topbuilder.rb', line 464
def inline_balloon(str)
%Q(\t←#{str.gsub(/@maru\[(\d+)\]/, inline_maru('\1'))})
end
|
#inline_bib(id) ⇒ Object
492
493
494
495
496
|
# File 'lib/review/topbuilder.rb', line 492
def inline_bib(id)
%Q([#{@chapter.bibpaper(id).number}])
rescue KeyError
app_error "unknown bib: #{id}"
end
|
#inline_bou(str) ⇒ Object
456
457
458
|
# File 'lib/review/topbuilder.rb', line 456
def inline_bou(str)
"#{str}◆→DTP連絡:「#{str}」に傍点←◆"
end
|
#inline_code(str) ⇒ Object
578
579
580
|
# File 'lib/review/topbuilder.rb', line 578
def inline_code(str)
"△#{str}☆"
end
|
468
469
470
471
472
473
474
|
# File 'lib/review/topbuilder.rb', line 468
def (str)
if @book.config['draft']
"◆→#{str}←◆"
else
''
end
end
|
#inline_del(str) ⇒ Object
439
440
441
|
# File 'lib/review/topbuilder.rb', line 439
def inline_del(str)
"◆→開始:削除表現←◆#{str}◆→終了:削除表現←◆"
end
|
#inline_endnote(id) ⇒ Object
341
342
343
344
345
|
# File 'lib/review/topbuilder.rb', line 341
def inline_endnote(id)
"【後注#{@chapter.endnote(id).number}】"
rescue KeyError
app_error "unknown endnote: #{id}"
end
|
#inline_fn(id) ⇒ Object
335
336
337
338
339
|
# File 'lib/review/topbuilder.rb', line 335
def inline_fn(id)
"【注#{@chapter.(id).number}】"
rescue KeyError
app_error "unknown footnote: #{id}"
end
|
#inline_hidx(str) ⇒ Object
399
400
401
|
# File 'lib/review/topbuilder.rb', line 399
def inline_hidx(str)
"◆→索引項目:#{str}←◆"
end
|
#inline_hint(str) ⇒ Object
387
388
389
|
# File 'lib/review/topbuilder.rb', line 387
def inline_hint(str)
"◆→ヒントスタイルここから←◆#{str}◆→ヒントスタイルここまで←◆"
end
|
#inline_i(str) ⇒ Object
407
408
409
|
# File 'lib/review/topbuilder.rb', line 407
def inline_i(str)
"▲#{str}☆"
end
|
#inline_icon(id) ⇒ Object
447
448
449
450
451
452
453
454
|
# File 'lib/review/topbuilder.rb', line 447
def inline_icon(id)
begin
"◆→画像 #{@chapter.image(id).path.sub(%r{\A\./}, '')}←◆"
rescue StandardError
warn "image not bound: #{id}", location: location
"◆→画像 #{id}←◆"
end
end
|
#inline_idx(str) ⇒ Object
395
396
397
|
# File 'lib/review/topbuilder.rb', line 395
def inline_idx(str)
"#{str}◆→索引項目:#{str}←◆"
end
|
#inline_ins(str) ⇒ Object
435
436
437
|
# File 'lib/review/topbuilder.rb', line 435
def inline_ins(str)
"◆→開始:挿入表現←◆#{str}◆→終了:挿入表現←◆"
end
|
#inline_keytop(str) ⇒ Object
460
461
462
|
# File 'lib/review/topbuilder.rb', line 460
def inline_keytop(str)
"#{str}◆→キートップ#{str}←◆"
end
|
#inline_labelref(idref) ⇒ Object
Also known as:
inline_ref
586
587
588
|
# File 'lib/review/topbuilder.rb', line 586
def inline_labelref(idref)
"「◆→#{idref}←◆」" end
|
#inline_m(str) ⇒ Object
476
477
478
479
480
481
482
483
484
485
|
# File 'lib/review/topbuilder.rb', line 476
def inline_m(str)
if @book.config['math_format'] == 'imgmath'
math_str = '$' + str + '$'
key = Digest::SHA256.hexdigest(str)
img_path = @img_math.defer_math_image(math_str, key)
%Q(◆→TeX式ここから←◆◆→math:#{File.basename(img_path)}←◆◆→TeX式ここまで←◆)
else
%Q(◆→TeX式ここから←◆#{str}◆→TeX式ここまで←◆)
end
end
|
#inline_maru(str) ⇒ Object
391
392
393
|
# File 'lib/review/topbuilder.rb', line 391
def inline_maru(str)
"#{str}◆→丸数字#{str}←◆"
end
|
592
593
594
|
# File 'lib/review/topbuilder.rb', line 592
def (idref)
"●ページ◆→#{idref}←◆" end
|
#inline_sub(str) ⇒ Object
383
384
385
|
# File 'lib/review/topbuilder.rb', line 383
def inline_sub(str)
"#{str}◆→DTP連絡:「#{str}」は下付き←◆"
end
|
#inline_sup(str) ⇒ Object
379
380
381
|
# File 'lib/review/topbuilder.rb', line 379
def inline_sup(str)
"#{str}◆→DTP連絡:「#{str}」は上付き←◆"
end
|
#inline_tcy(str) ⇒ Object
443
444
445
|
# File 'lib/review/topbuilder.rb', line 443
def inline_tcy(str)
"◆→開始:回転←◆#{str}◆→終了:縦回転←◆"
end
|
#inline_tt(str) ⇒ Object
417
418
419
|
# File 'lib/review/topbuilder.rb', line 417
def inline_tt(str)
"△#{str}☆"
end
|
#inline_ttb(str) ⇒ Object
Also known as:
inline_ttbold
421
422
423
|
# File 'lib/review/topbuilder.rb', line 421
def inline_ttb(str)
"★#{str}☆◆→等幅フォント太字←◆"
end
|
#inline_tti(str) ⇒ Object
427
428
429
|
# File 'lib/review/topbuilder.rb', line 427
def inline_tti(str)
"▲#{str}☆◆→等幅フォントイタ←◆"
end
|
#inline_ttibold(str) ⇒ Object
582
583
584
|
# File 'lib/review/topbuilder.rb', line 582
def inline_ttibold(str)
"▲#{str}☆◆→等幅フォント太字イタ←◆"
end
|
#inline_u(str) ⇒ Object
431
432
433
|
# File 'lib/review/topbuilder.rb', line 431
def inline_u(str)
"@#{str}@◆→@〜@部分に下線←◆"
end
|
#list(lines, id, caption, lang = nil) ⇒ Object
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
|
# File 'lib/review/topbuilder.rb', line 94
def list(lines, id, caption, lang = nil)
blank
puts "◆→開始:#{@titles['list']}←◆"
begin
if caption_top?('list')
(id, caption, lang)
blank
end
list_body(id, lines, lang)
unless caption_top?('list')
blank
(id, caption, lang)
end
rescue KeyError
app_error "no such list: #{id}"
end
puts "◆→終了:#{@titles['list']}←◆"
blank
end
|
#list_body(_id, lines, _lang) ⇒ Object
122
123
124
125
126
|
# File 'lib/review/topbuilder.rb', line 122
def list_body(_id, lines, _lang)
lines.each do |line|
puts detab(line)
end
end
|
114
115
116
117
118
119
120
|
# File 'lib/review/topbuilder.rb', line 114
def (id, caption, _lang)
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
end
|
#listnum(lines, id, caption, lang = nil) ⇒ Object
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
|
# File 'lib/review/topbuilder.rb', line 167
def listnum(lines, id, caption, lang = nil)
blank
puts "◆→開始:#{@titles['list']}←◆"
begin
if caption_top?('list') && caption.present?
(id, caption, lang)
blank
end
listnum_body(lines, lang)
if !caption_top?('list') && caption.present?
blank
(id, caption, lang)
end
rescue KeyError
app_error "no such list: #{id}"
end
puts "◆→終了:#{@titles['list']}←◆"
blank
end
|
#listnum_body(lines, _lang) ⇒ Object
187
188
189
190
191
|
# File 'lib/review/topbuilder.rb', line 187
def listnum_body(lines, _lang)
lines.each_with_index do |line, i|
puts((i + 1).to_s.rjust(2) + ": #{line}")
end
end
|
498
499
500
|
# File 'lib/review/topbuilder.rb', line 498
def noindent
puts '◆→DTP連絡:次の1行インデントなし←◆'
end
|
#nonum_begin(level, _label, caption) ⇒ Object
502
503
504
|
# File 'lib/review/topbuilder.rb', line 502
def nonum_begin(level, _label, caption)
puts "■H#{level}■#{compile_inline(caption)}"
end
|
#notoc_begin(level, _label, caption) ⇒ Object
506
507
508
|
# File 'lib/review/topbuilder.rb', line 506
def notoc_begin(level, _label, caption)
puts "■H#{level}■#{compile_inline(caption)}◆→DTP連絡:目次に掲載しない←◆"
end
|
#ol_item(lines, num) ⇒ Object
71
72
73
|
# File 'lib/review/topbuilder.rb', line 71
def ol_item(lines, num)
puts "#{num}\t#{join_lines_to_paragraph(lines)}"
end
|
#read(lines) ⇒ Object
Also known as:
lead
85
86
87
88
89
90
|
# File 'lib/review/topbuilder.rb', line 85
def read(lines)
puts "◆→開始:#{@titles['lead']}←◆"
puts split_paragraph(lines).join("\n")
puts "◆→終了:#{@titles['lead']}←◆"
blank
end
|
#table(lines, id = nil, caption = nil) ⇒ Object
257
258
259
260
261
262
263
|
# File 'lib/review/topbuilder.rb', line 257
def table(lines, id = nil, caption = nil)
blank
puts "◆→開始:#{@titles['table']}←◆"
super(lines, id, caption, true)
puts "◆→終了:#{@titles['table']}←◆"
blank
end
|
#table_end ⇒ Object
292
293
|
# File 'lib/review/topbuilder.rb', line 292
def table_end
end
|
#table_rows(sepidx, rows) ⇒ Object
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
|
# File 'lib/review/topbuilder.rb', line 265
def table_rows(sepidx, rows)
if sepidx
sepidx.times do
tr(rows.shift.map { |s| th(s) })
end
if !@book.config['textmaker'] || !@book.config['textmaker']['th_bold']
puts '-' * 12
end
rows.each do |cols|
tr(cols.map { |s| td(s) })
end
else
rows.each do |cols|
h, *cs = *cols
tr([th(h)] + cs.map { |s| td(s) })
end
end
end
|
#texequation(lines, id = nil, caption = '') ⇒ Object
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
|
# File 'lib/review/topbuilder.rb', line 226
def texequation(lines, id = nil, caption = '')
blank
puts "◆→開始:#{@titles['texequation']}←◆"
(id, caption) if caption_top?('equation')
if @book.config['math_format'] == 'imgmath'
fontsize = @book.config['imgmath_options']['fontsize'].to_f
lineheight = @book.config['imgmath_options']['lineheight'].to_f
math_str = "\\begin{equation*}\n\\fontsize{#{fontsize}}{#{lineheight}}\\selectfont\n#{lines.join("\n")}\n\\end{equation*}\n"
key = Digest::SHA256.hexdigest(math_str)
img_path = @img_math.defer_math_image(math_str, key)
puts "◆→math:#{File.basename(img_path)}←◆"
else
puts lines.join("\n")
end
(id, caption) unless caption_top?('equation')
puts "◆→終了:#{@titles['texequation']}←◆"
blank
end
|
247
248
249
250
251
252
253
254
255
|
# File 'lib/review/topbuilder.rb', line 247
def (id, caption)
if id
if get_chap
puts "#{I18n.t('equation')}#{I18n.t('format_number', [get_chap, @chapter.equation(id).number])}#{I18n.t('caption_prefix_idgxml')}#{compile_inline(caption)}"
else
puts "#{I18n.t('equation')}#{I18n.t('format_number_without_chapter', [@chapter.equation(id).number])}#{I18n.t('caption_prefix_idgxml')}#{compile_inline(caption)}"
end
end
end
|
284
285
286
287
288
289
290
|
# File 'lib/review/topbuilder.rb', line 284
def th(str)
if @book.config['textmaker'] && @book.config['textmaker']['th_bold']
"★#{str}☆"
else
str
end
end
|