Parsing changes to summary text.
authorRyan C. Gordon <icculus@icculus.org>
Tue, 22 Mar 2016 12:47:54 -0400
changeset 86 afdfeb6893d6
parent 85 2d16871a12ae
child 87 6f646cf3a0df
Parsing changes to summary text.
IcculusFinger_archiveplans.pl
IcculusFinger_daemon.pl
--- a/IcculusFinger_archiveplans.pl	Tue Mar 15 14:52:55 2016 -0400
+++ b/IcculusFinger_archiveplans.pl	Tue Mar 22 12:47:54 2016 -0400
@@ -319,14 +319,20 @@
         $str =~ s/\s+\Z//;
 
         $summary = $str;
+        $summary =~ s/\A(.{1,80})\b.*\Z/$1/;	
+        $summary =~ s/\A(.{15,}?[.?!]).*\Z/$1/;  # gross.
     }
 
     1 while ($summary =~ s/\r\n/ /s);
     1 while ($summary =~ s/\r/ /s);
     1 while ($summary =~ s/\n/ /s);
-    if (length($summary) > 80) {
-        $summary =~ s/\A(.{15,}?[.?!])(.*?)\Z/$1/;  # gross.
-    }
+
+    if (length($summary) > 80) {   
+        $summary =~ s/\A(.{1,80})\b.*\Z/$1/;	
+        $summary =~ s/\A(.{15,}?[.?!]).*\Z/$1/;  # gross.
+    } 
+
+    #print("SUMMARY: $summary\n"); exit(0);
 
     $summary = $link->quote($summary);
 
--- a/IcculusFinger_daemon.pl	Tue Mar 15 14:52:55 2016 -0400
+++ b/IcculusFinger_daemon.pl	Tue Mar 22 12:47:54 2016 -0400
@@ -1404,14 +1404,19 @@
         $str =~ s/\A(.*?)[\r\n].*\Z/$1/s;
         $str =~ s/\A\s+//;
         $str =~ s/\s+\Z//;
+
         $metadata{'summary'} = $str;
+        $metadata{'summary'} =~ s/\A(.{1,80})\b.*\Z/$1/;
+        $metadata{'summary'} =~ s/\A(.{15,}?[.?!]).*\Z/$1/;  # gross.
     }
 
     1 while ($metadata{'summary'} =~ s/\r\n/ /s);
     1 while ($metadata{'summary'} =~ s/\r/ /s);
     1 while ($metadata{'summary'} =~ s/\n/ /s);
+
     if (length($metadata{'summary'}) > 80) {
-        $metadata{'summary'} =~ s/\A(.{15,}?[.?!])(.*?)\Z/$1/;  # gross.
+        $metadata{'summary'} =~ s/\A(.{1,80})\b.*\Z/$1/;
+        $metadata{'summary'} =~ s/\A(.{15,}?[.?!]).*\Z/$1/;  # gross.
     }
 
     if ($debug) {