Merge "Try to extract an excerpt from a revision"

This commit is contained in:
jenkins-bot 2016-06-19 10:02:39 +00:00 committed by Gerrit Code Review
commit 15dc477e04

View file

@ -885,4 +885,18 @@ abstract class EchoDiscussionParser {
public static function htmlToText( $html ) {
return trim( html_entity_decode( strip_tags( $html ), ENT_QUOTES ) );
}
/**
* Extract an edit excerpt from a revision
*
* @param Revision $revision
* @param Language $lang
* @param int $length
* @return string
*/
public static function getEditExcerpt( Revision $revision, Language $lang, $length = 150 ) {
$interpretation = self::getChangeInterpretationForRevision( $revision );
$section = self::detectSectionTitleAndText( $interpretation );
return $lang->truncate( $section['section-title'] . ' ' . $section['section-text'], $length );
}
}