467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
|
# File 'lib/review/latexbuilder.rb', line 467
def common_code_block(id, lines, command, caption, _lang)
@doc_status[:caption] = true
captionstr = nil
unless @book.config.check_version('2', exception: false)
puts '\\begin{reviewlistblock}'
end
if caption.present?
if command =~ /emlist/ || command =~ /cmd/ || command =~ /source/
captionstr = macro(command + 'caption', compile_inline(caption))
else
begin
captionstr = if get_chap.nil?
macro('reviewlistcaption', "#{I18n.t('list')}#{I18n.t('format_number_header_without_chapter', [@chapter.list(id).number])}#{I18n.t('caption_prefix')}#{compile_inline(caption)}")
else
macro('reviewlistcaption', "#{I18n.t('list')}#{I18n.t('format_number_header', [get_chap, @chapter.list(id).number])}#{I18n.t('caption_prefix')}#{compile_inline(caption)}")
end
rescue KeyError
app_error "no such list: #{id}"
end
end
end
@doc_status[:caption] = nil
if caption_top?('list') && captionstr
puts captionstr
end
body = ''
lines.each_with_index do |line, idx|
body.concat(yield(line, idx))
end
puts macro('begin', command)
print body
puts macro('end', command)
if !caption_top?('list') && captionstr
puts captionstr
end
unless @book.config.check_version('2', exception: false)
puts '\\end{reviewlistblock}'
end
blank
end
|