class Asciidoctor::Document

def resolve_id text

Returns the String ID of the first reference with matching reference text or nothing if no reference is found.

text - The String reference text to compare to the converted reference text of each registered reference.

Public: Scan registered references and return the ID of the first reference that matches the specified reference text.
def resolve_id text
  if @reftexts
    @reftexts[text]
  elsif @parsed
    # @reftexts is set eagerly to prevent nested lazy init
    (@reftexts = {}).tap {|accum| @catalog[:refs].each {|id, ref| accum[ref.xreftext] ||= id } }[text]
  else
    resolved_id = nil
    # @reftexts is set eagerly to prevent nested lazy init
    @reftexts = accum = {}
    @catalog[:refs].each do |id, ref|
      # NOTE short-circuit early since we're throwing away this table anyway
      if (xreftext = ref.xreftext) == text
        resolved_id = id
        break
      end
      accum[xreftext] ||= id
    end
    @reftexts = nil
    resolved_id
  end
end