class RDoc::Markup::ToLabel

def convert text

def convert text
  label = convert_flow @am.flow text
  CGI.escape(label).gsub('%', '-').sub(/^-/, '')
end

def handle_regexp_CROSSREF target

def handle_regexp_CROSSREF target
  text = target.text
  text.sub(/^\\/, '')
end

def handle_regexp_TIDYLINK target

def handle_regexp_TIDYLINK target
  text = target.text
  return text unless text =~ /\{(.*?)\}\[(.*?)\]/ or text =~ /(\S+)\[(.*?)\]/
  $1
end

def initialize markup = nil

def initialize markup = nil
  super nil, markup
  @markup.add_regexp_handling RDoc::CrossReference::CROSSREF_REGEXP, :CROSSREF
  @markup.add_regexp_handling(/(((\{.*?\})|\b\S+?)\[\S+?\])/, :TIDYLINK)
  add_tag :BOLD, '', ''
  add_tag :TT,   '', ''
  add_tag :EM,   '', ''
  @res = []
end