williamr/buglist_to_mediawiki.pl
changeset 21 36e05c0da8f7
child 261 d01a4084d621
equal deleted inserted replaced
20:54785ea4cd2e 21:36e05c0da8f7
       
     1 #! perl
       
     2 
       
     3 # Copyright (c) 2009 Symbian Foundation Ltd
       
     4 # This component and the accompanying materials are made available
       
     5 # under the terms of the License "Eclipse Public License v1.0"
       
     6 # which accompanies this distribution, and is available
       
     7 # at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 #
       
     9 # Initial Contributors:
       
    10 # Symbian Foundation Ltd - initial contribution.
       
    11 # 
       
    12 # Contributors:
       
    13 #
       
    14 # Description:
       
    15 # Convert tab-separated buglist into Mediawiki table
       
    16 
       
    17 use strict;
       
    18 
       
    19 my $line;
       
    20 my $header = 1;
       
    21 
       
    22 while ($line =<>)
       
    23   {
       
    24   chomp $line;
       
    25   my @columns = split /\t/, $line;
       
    26   
       
    27   next if scalar @columns < 2;    # skip dubious looking lines
       
    28   
       
    29   if ($header)
       
    30     {
       
    31     print "{|\n";   # start of table
       
    32     print "! ", join(" !! ", @columns), "\n";
       
    33     $header = 0;
       
    34     next;
       
    35     }
       
    36 
       
    37   # row with a bug id
       
    38   my $id = shift @columns;
       
    39   $id = sprintf "[http://developer.symbian.org/bugs/show_bug.cgi?id=%s Bug %s]", $id, $id;
       
    40   unshift @columns, $id;   
       
    41   
       
    42   print "|-\n"; # row separator
       
    43   print "| ", join(" || ", @columns), "\n";
       
    44   }
       
    45 
       
    46 print "|}\n";