# File lib/asciidoctor/substituters.rb, line 147
  def extract_passthroughs(text)
    result = text.dup

    result.gsub!(REGEXP[:pass_macro]) {
      # alias match for Ruby 1.8.7 compat
      m = $~
      # honor the escape
      if m[0].start_with? '\\'
        next m[0][1..-1]
      end

      if m[1] == '$$'
        subs = [:specialcharacters]
      elsif !m[3].nil? && !m[3].empty?
        subs = resolve_subs(m[3])
      else
        subs = []
      end

      # TODO move unescaping closing square bracket to an operation
      @passthroughs << {:text => m[2] || m[4].gsub('\]', ']'), :subs => subs}
      index = @passthroughs.size - 1
      "\e#{index}\e"
    } unless !(result.include?('+++') || result.include?('$$') || result.include?('pass:'))

    result.gsub!(REGEXP[:pass_lit]) {
      # alias match for Ruby 1.8.7 compat
      m = $~

      # honor the escape
      if m[2].start_with? '\\'
        next "#{m[1]}#{m[2][1..-1]}"
      end
      
      @passthroughs << {:text => m[3], :subs => [:specialcharacters], :literal => true}
      index = @passthroughs.size - 1
      "#{m[1]}\e#{index}\e"
    } unless !result.include?('`')

    result
  end