# HG changeset patch # User Simon Howkins # Date 1273750460 -3600 # Node ID d01a4084d621a0a00ea3728ddd265c012fe2b3b6 # Parent 09b83ca8e0cf98571a9ab2f47cac403142010135 Extended to put the preferred column headings into the table. Also made a few other simplifications. diff -r 09b83ca8e0cf -r d01a4084d621 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";