class RDoc::Generator::Darkfish
def excerpt(comment)
def excerpt(comment) text = case comment when RDoc::Comment comment.text else comment end # Match from a capital letter to the first period, discarding any links, so # that we don't end up matching badges in the README pattern = ParagraphExcerptRegexpUnicode begin first_paragraph_match = text.match(pattern) rescue Encoding::CompatibilityError # The doc is non-ASCII text and encoded in other than Unicode base encodings. raise if pattern == ParagraphExcerptRegexpOther pattern = ParagraphExcerptRegexpOther retry end return text[0...150].tr_s("\n", " ").squeeze(" ") unless first_paragraph_match extracted_text = first_paragraph_match[0] second_paragraph = text.match(pattern, first_paragraph_match.end(0)) extracted_text << " " << second_paragraph[0] if second_paragraph extracted_text[0...150].tr_s("\n", " ").squeeze(" ") end