autobuild-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Autobuild-discuss] Skip useless commas


From: Julien ÉLIE
Subject: [Autobuild-discuss] Skip useless commas
Date: Wed, 24 Aug 2011 23:54:38 +0200
User-agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.7; fr; rv:1.9.2.20) Gecko/20110804 Thunderbird/3.1.12

Hi all,

Here is a patch to skip ", " (comma+space) at the end of the Revisions,
Host types and Build hosts summaries.

For instance:

  Revisions (3): 1.0, 2.0, 2.1, 

will be written:

  Revisions (3): 1.0, 2.0, 2.1

which I think is prettier.


--- autobuild           2011-08-24 23:48:24.000000000 +0200
+++ autobuild-new       2011-08-24 23:31:07.000000000 +0200
@@ -380,22 +380,33 @@
 }
 
 foreach $project (sort keys %Projects) {
+    my $count;
+
     print "<hr />\n";
     print "<h2><a name=\"$project\">Project '$project'</a></h2>\n";
     print "\n";
     print "<p>Revisions (" . keys(%{$Revisions{$project}}) . "): ";
+    $count = 0;
     foreach $revision (reverse sort { if ($a eq $b) { return 0; } else { my $i 
= 0; do { my $j = substr ($a, $i, 1); my $k = substr ($b, $i, 1); if ($j != $k) 
{ $j = substr ($a, $i); $k = substr ($b, $i); return $j <=> $k; } $i++; } while 
($i < length($a)); } } keys %{$Revisions{$project}}) {
-       print "<a href=\"#$project-$revision\">$revision</a>, ";
+        print ", " if $count;
+       print "<a href=\"#$project-$revision\">$revision</a>";
+        $count++;
     }
     print "</p>\n";
-    print "<p>Hosttypes (" . keys(%{$Hosttypes{$project}}) . "): ";
+    print "<p>Host types (" . keys(%{$Hosttypes{$project}}) . "): ";
+    $count = 0;
     foreach $hosttype (sort keys %{$Hosttypes{$project}}) {
-       print "<a href=\"#$project-$hosttype\">$hosttype</a>, \n";
+        print ", " if $count;
+       print "<a href=\"#$project-$hosttype\">$hosttype</a>\n";
+        $count++;
     }
     print "</p>\n";
     print "<p>Build hosts (" . keys(%{$Hostnames{$project}}) . "): ";
+    $count = 0;
     foreach $hostname (sort keys %{$Hostnames{$project}}) {
-       print "<a href=\"#$project-$hostname\">$hostname</a>, \n";
+        print ", " if $count;
+       print "<a href=\"#$project-$hostname\">$hostname</a>\n";
+        $count++;
     }
     print "</p>\n";
 



-- 
Julien ÉLIE

« – Alors j'ai eu une idée géniale : ramener à César un des
    Gaulois irréductibles de la région !
  – Mais, préfet, ces Gaulois irréductibles ont un grand défaut !
  – Ah ? Lequel ?
  – C'est qu'ils sont irréductibles justement ! » (Astérix)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]