class RDoc::Markup::ToHtmlSnippet

def truncate text

def truncate text
  length = text.length
  characters = @characters
  @characters += length
  return text if @characters < @character_limit
  remaining = @character_limit - characters
  text =~ /\A(.{#{remaining},}?)(\s|$)/m # TODO word-break instead of \s?
  $1
end