Method: ReVIEW::LATEXBuilder#indepimage

Defined in:
lib/review/latexbuilder.rb

#indepimage(lines, id, caption = nil, metric = nil) ⇒ Object Also known as: numberlessimage



674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
# File 'lib/review/latexbuilder.rb', line 674

def indepimage(lines, id, caption = nil, metric = nil)
  metrics = parse_metric('latex', metric)

  captionstr = nil
  if caption.present?
    @doc_status[:caption] = true
    captionstr = macro('reviewindepimagecaption',
                       %Q(#{I18n.t('numberless_image')}#{I18n.t('caption_prefix')}#{compile_inline(caption)}))
    @doc_status[:caption] = nil
  end

  if @chapter.image(id).path
    puts "\\begin{reviewimage}%%#{id}"

    if caption_top?('image') && captionstr
      puts captionstr
    end

    command = 'reviewincludegraphics'
    if @book.config.check_version('2', exception: false)
      command = 'includegraphics'
    end

    if metrics.present?
      puts "\\#{command}[#{metrics}]{#{@chapter.image(id).path}}"
    else
      puts "\\#{command}[width=\\maxwidth]{#{@chapter.image(id).path}}"
    end
  else
    warn "image not bound: #{id}", location: location
    puts '\begin{reviewdummyimage}'
    puts escape("--[[path = #{escape(id)} (#{existence(id)})]]--")
    lines.each do |line|
      puts "\n"
      puts detab(line.rstrip)
    end
  end

  if !caption_top?('image') && captionstr
    puts captionstr
  end

  if @chapter.image(id).path
    puts '\end{reviewimage}'
  else
    puts '\end{reviewdummyimage}'
  end
end