module RDoc::Text

def strip_stars text

def strip_stars text
  return text unless text =~ %r%/\*.*\*/%m
  encoding = text.encoding
  text = text.gsub %r%Document-method:\s+[\w:.#=!?|^&<>~+\-/*\%@`\[\]]+%, ''
  space = ' '
  space = RDoc::Encoding.change_encoding space, encoding if encoding
  text.sub!  %r%/\*+%       do space * $&.length end
  text.sub!  %r%\*+/%       do space * $&.length end
  text.gsub! %r%^[ \t]*\*%m do space * $&.length end
  empty = ''
  empty = RDoc::Encoding.change_encoding empty, encoding if encoding
  text.gsub(/^\s+$/, empty)
end