lib/asciidoctor/pdf_renderer.rb
def caption subject, options = {}
    mark = { cursor: cursor, page_number: page_number }
    string = case subject
    when ::String
      subject
    when ::Asciidoctor::AbstractBlock
      subject.title? ? subject.captioned_title : nil
    end
    return 0 if string.nil?
    theme_font :caption do
      margin = if ((options.delete :position) || :top) == :top
        { top: @theme.caption_margin_outside, bottom: @theme.caption_margin_inside }
      else
        { top: @theme.caption_margin_inside, bottom: @theme.caption_margin_outside }
      end
      prose string, {
        margin_top: margin[:top],
        margin_bottom: margin[:bottom],
        align: (@theme.caption_align || :left).to_sym,
        normalize: false
      }.merge(options)
    end
    # NOTE we assume we don't clear more than one page
    if page_number > mark[:page_number]
      mark[:cursor] + (bounds.top - cursor)
    else
      mark[:cursor] - cursor
    end
  end
# Render the caption and return the height of the rendered content
Render the caption and return the height of the rendered content
Render the caption and return the height of the rendered content
def caption subject, options = {}
    mark = { cursor: cursor, page_number: page_number }
    string = case subject
    when ::String
      subject
    when ::Asciidoctor::AbstractBlock
      subject.title? ? subject.captioned_title : nil
    end
    return 0 if string.nil?
    theme_font :caption do
      margin = if ((options.delete :position) || :top) == :top
        { top: @theme.caption_margin_outside, bottom: @theme.caption_margin_inside }
      else
        { top: @theme.caption_margin_inside, bottom: @theme.caption_margin_outside }
      end
      prose string, {
        margin_top: margin[:top],
        margin_bottom: margin[:bottom],
        align: (@theme.caption_align || :left).to_sym,
        normalize: false
      }.merge(options)
    end
    if page_number > mark[:page_number]
      mark[:cursor] + (bounds.top - cursor)
    else
      mark[:cursor] - cursor
    end
  end
def caption subject , options = { } mark = { cursor : cursor , page_number : page_number } string = case subject when :: String subject when :: Asciidoctor :: AbstractBlock subject . title? ? subject . captioned_title : nil end return 0 if string . nil? theme_font :caption do margin = if ( ( options . delete :position ) || :top ) == :top { top : @theme . caption_margin_outside , bottom : @theme . caption_margin_inside } else { top : @theme . caption_margin_inside , bottom : @theme . caption_margin_outside } end prose string , { margin_top : margin [ :top ] , margin_bottom : margin [ :bottom ] , align : ( @theme . caption_align || :left ) . to_sym , normalize : false } . merge ( options ) end if page_number > mark [ :page_number ] mark [ :cursor ] + ( bounds . top - cursor ) else mark [ :cursor ] - cursor end end
Render the caption and return the height of the rendered content
Render the caption and return the height of the rendered content
# NOTE we assume we don't clear more than one page
subject
options