1 #! perl |
1 #! perl -w |
2 |
2 |
3 # Copyright (c) 2009 Symbian Foundation Ltd |
3 # Copyright (c) 2009 Symbian Foundation Ltd |
4 # This component and the accompanying materials are made available |
4 # This component and the accompanying materials are made available |
5 # under the terms of the License "Eclipse Public License v1.0" |
5 # under the terms of the License "Eclipse Public License v1.0" |
6 # which accompanies this distribution, and is available |
6 # which accompanies this distribution, and is available |
14 # Description: |
14 # Description: |
15 # Convert tab-separated buglist into Mediawiki table |
15 # Convert tab-separated buglist into Mediawiki table |
16 |
16 |
17 use strict; |
17 use strict; |
18 |
18 |
19 my $line; |
19 print "{|\n"; # start of table |
20 my $header = 1; |
|
21 |
20 |
22 while ($line =<>) |
21 while (my $line = <>) |
23 { |
22 { |
24 chomp $line; |
23 chomp $line; |
25 my @columns = split /\t/, $line; |
24 my @columns = split /\t/, $line; |
26 |
25 |
27 next if scalar @columns < 2; # skip dubious looking lines |
26 next if scalar @columns < 2; # skip dubious looking lines |
28 |
27 |
29 if ($header) |
28 if ($. == 1) |
30 { |
29 { |
31 print "{|\n"; # start of table |
30 # First line of file = table headings |
|
31 my %preferredHeadings = |
|
32 ( |
|
33 bug_id => "ID", |
|
34 bug_severity => "Severity", |
|
35 reporter => "Reporter", |
|
36 bug_status => "Status", |
|
37 product => "Package", |
|
38 short_desc => "Title", |
|
39 ); |
|
40 @columns = map { $preferredHeadings{$_} || $_ } @columns; |
32 print "! ", join(" !! ", @columns), "\n"; |
41 print "! ", join(" !! ", @columns), "\n"; |
33 $header = 0; |
|
34 next; |
42 next; |
35 } |
43 } |
36 |
44 |
37 # row with a bug id |
45 # row with a bug id |
38 my $id = shift @columns; |
46 |
39 $id = sprintf "[http://developer.symbian.org/bugs/show_bug.cgi?id=%s Bug %s]", $id, $id; |
47 $columns[0] = "[http://developer.symbian.org/bugs/show_bug.cgi?id=$columns[0] Bug$columns[0]]"; |
40 unshift @columns, $id; |
|
41 |
48 |
42 print "|-\n"; # row separator |
49 print "|-\n"; # row separator |
43 print "| ", join(" || ", @columns), "\n"; |
50 print "| ", join(" || ", @columns), "\n"; |
44 } |
51 } |
45 |
52 |