Method: ReVIEW::LATEXBuilder#common_code_block_lst

Defined in:
lib/review/latexbuilder.rb

#common_code_block_lst(_id, lines, command, title, caption, lang, first_line_num: 1) ⇒ Object



512
513
514
515
516
517
518
519
520
521
522
# File 'lib/review/latexbuilder.rb', line 512

def common_code_block_lst(_id, lines, command, title, caption, lang, first_line_num: 1)
  if title == 'title' && caption.blank? && @book.config.check_version('2', exception: false)
    print '\vspace{-1.5em}'
  end
  body = lines.inject('') { |i, j| i + detab(j) + "\n" }
  args = make_code_block_args(title, caption, lang, first_line_num: first_line_num)
  puts %Q(\\begin{#{command}}[#{args}])
  print body
  puts %Q(\\end{#{command}})
  blank
end