class RDoc::Markup::ToLabel

def convert text

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

def handle_special_CROSSREF special

def handle_special_CROSSREF special
  text = special.text
  text.sub(/^\\/, '')
end

def handle_special_TIDYLINK special

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

def initialize markup = nil

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