module Asciidoctor::Substitutors

def sub_callouts text

Returns the converted String text

text - The String text to process

Public: Substitute callout source references
def sub_callouts text
  callout_rx = (attr? 'line-comment') ? CalloutSourceRxMap[attr 'line-comment'] : CalloutSourceRx
  autonum = 0
  text.gsub callout_rx do
    # honor the escape
    if $2
      # use sub since it might be behind a line comment
      $&.sub RS, ''
    else
      Inline.new(self, :callout, $4 == '.' ? (autonum += 1).to_s : $4, id: @document.callouts.read_next_id, attributes: { 'guard' => $1 || ($3 == '--' ? ['<!--', '-->'] : nil) }).convert
    end
  end
end