class Asciidoctor::AbstractBlock

def assign_caption(caption = nil, key = nil)

Returns nothing

is used. (default: nil).
If not provided, the name of the context for this block
key - The prefix of the caption and counter attribute names.

do nothing.
If an explicit caption has been specified on this block, then

the block.
assign it a number and store it to the caption attribute on
for this block, then build a caption from this information,
If the block has a title and a caption prefix is available

is not already assigned.
Public: Generate a caption and assign it to this block if one
def assign_caption(caption = nil, key = nil)
  return unless title? || !@caption
  if caption
    @caption = caption
  else
    if (value = @document.attributes['caption'])
      @caption = value
    elsif title?
      key ||= @context.to_s
      caption_key = "#{key}-caption"
      if (caption_title = @document.attributes[caption_key])
        caption_num = @document.counter_increment("#{key}-number", self)
        @caption = "#{caption_title} #{caption_num}. "
      end
    end
  end
  nil
end