Extended to put the preferred column headings into the table. PDK_3.0.i
authorSimon Howkins <simonh@symbian.org>
Thu, 13 May 2010 12:34:20 +0100
changeset 239 d01a4084d621
parent 238 09b83ca8e0cf
child 241 f10adc84543a
Extended to put the preferred column headings into the table. Also made a few other simplifications.
williamr/buglist_to_mediawiki.pl
--- a/williamr/buglist_to_mediawiki.pl	Wed May 12 10:32:26 2010 +0100
+++ b/williamr/buglist_to_mediawiki.pl	Thu May 13 12:34:20 2010 +0100
@@ -1,4 +1,4 @@
-#! perl
+#! perl -w
 
 # Copyright (c) 2009 Symbian Foundation Ltd
 # This component and the accompanying materials are made available
@@ -16,28 +16,35 @@
 
 use strict;
 
-my $line;
-my $header = 1;
+print "{|\n";   # start of table
 
-while ($line =<>)
+while (my $line = <>)
   {
   chomp $line;
   my @columns = split /\t/, $line;
   
   next if scalar @columns < 2;    # skip dubious looking lines
   
-  if ($header)
+  if ($. == 1)
     {
-    print "{|\n";   # start of table
+    # First line of file = table headings
+    my %preferredHeadings =
+      (
+      bug_id => "ID",
+      bug_severity => "Severity",
+      reporter => "Reporter",
+      bug_status => "Status",
+      product => "Package",
+      short_desc => "Title",
+      );
+    @columns = map { $preferredHeadings{$_} || $_ } @columns;
     print "! ", join(" !! ", @columns), "\n";
-    $header = 0;
     next;
     }
 
   # row with a bug id
-  my $id = shift @columns;
-  $id = sprintf "[http://developer.symbian.org/bugs/show_bug.cgi?id=%s Bug %s]", $id, $id;
-  unshift @columns, $id;   
+
+  $columns[0] = "[http://developer.symbian.org/bugs/show_bug.cgi?id=$columns[0] Bug$columns[0]]";
   
   print "|-\n"; # row separator
   print "| ", join(" || ", @columns), "\n";