Revision: 47671
Author:   aaron
Date:     2009-02-22 15:58:39 +0000 (Sun, 22 Feb 2009)

Log Message:
-----------
More summary matching tweaks

Modified Paths:
--------------
    trunk/extensions/CodeReview/CodeReleaseNotes.php

Modified: trunk/extensions/CodeReview/CodeReleaseNotes.php
===================================================================
--- trunk/extensions/CodeReview/CodeReleaseNotes.php    2009-02-22 15:39:00 UTC 
(rev 47670)
+++ trunk/extensions/CodeReview/CodeReleaseNotes.php    2009-02-22 15:58:39 UTC 
(rev 47671)
@@ -115,15 +115,22 @@
                }
                $blurbs = array_map( 'trim', $blurbs ); # Clean up items
                $blurbs = array_filter( $blurbs ); # Filter out any garbage
+               # Doesn't start with '*' and has some length?
+               # If so, then assume that the top bit is important.
+               if( count($blurbs) ) {
+                       $header = strpos( ltrim($summary),'*' ) !== 0 && 
str_word_count($blurbs[0]) >= 5;
+               } else {
+                       $header = false;
+               }
                # Keep it short if possible...
                if( count($blurbs) > 1 ) {
                        $summary = array();
                        foreach( $blurbs as $blurb ) {
                                # Always show the first bit
-                               if( $first && count($summary) == 0 ) {
+                               if( $header && $first && count($summary) == 0 ) 
{
                                        $summary[] = 
$this->shortenSummary($blurb,true);
                                # Is this bit important? Does it mention a 
revision?
-                               } else if( $this->isRelevant( $blurb ) || 
preg_match('/\br(\d+)\b/',$blurb) ) {
+                               } else if( $this->isRelevant($blurb) || 
preg_match('/\br(\d+)\b/',$blurb) ) {
                                        $bit = 
$this->shortenSummary($blurb,false);
                                        if( $bit ) $summary[] = $bit;
                                }
@@ -145,7 +152,7 @@
                if( mb_strlen($summary) < 40 || $words <= 5 )
                        return false;
                # All caps words (like "BREAKING CHANGE"/magic words)? 
-               if( preg_match( '/\b[A-Z]{7,30}\b/', $summary ) )
+               if( preg_match( '/\b[A-Z]{6,30}\b/', $summary ) )
                        return true;
                # Random keywords
                if( preg_match( 
'/\b(wiki|HTML\d|CSS\d|UTF-?8|(Apache|PHP|CGI|Java|Perl|Python|\w+SQL) 
?\d?\.?\d?)\b/i', $summary ) )



_______________________________________________
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to