2013-12-14 00:28:54 +00:00
|
|
|
use Carp;
|
|
|
|
|
|
|
|
#set command line arguments
|
|
|
|
my ($infi, $outfi) = @ARGV;
|
|
|
|
my ($type) = $outfi =~ /\.([^.]+)$/;
|
|
|
|
|
|
|
|
open(my $fh, "<", $infi) || croak "can't open $infi: $!";
|
|
|
|
open(STDOUT, ">", $outfi) || croak "can't open $outfi: $!";
|
|
|
|
|
|
|
|
my $lastVend = "";
|
|
|
|
while (<$fh>) {
|
|
|
|
my ($vend, $mod, $set) = split('\t', $_);
|
|
|
|
if ($type eq "html") {
|
|
|
|
if ($vend eq $lastVend) {
|
|
|
|
printf(", %s", $mod);
|
|
|
|
} else {
|
|
|
|
if ($lastVend eq "") {
|
2013-12-15 16:16:06 +00:00
|
|
|
printf("<dl><dt>%s</dt><dd>\n\t<ul>\n\t <li>%s", $vend, $mod);
|
2013-12-14 00:28:54 +00:00
|
|
|
} else {
|
2013-12-15 16:16:06 +00:00
|
|
|
printf("</li>\n\t</ul>\n </dd>\n <dt>%s</dt><dd>\n\t<ul>\n\t <li>%s", $vend, $mod);
|
2013-12-14 00:28:54 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if ($vend eq $lastVend) {
|
|
|
|
printf(", %s", $mod);
|
|
|
|
} else {
|
|
|
|
if ($lastVend eq "") {
|
|
|
|
printf("%s: %s", $vend, $mod);
|
|
|
|
} else {
|
|
|
|
printf("\n%s: %s", $vend, $mod);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$lastVend = $vend;
|
|
|
|
}
|
|
|
|
if ($type eq "html") {
|
2013-12-15 16:16:06 +00:00
|
|
|
print("</li>\n\t</ul>\n </dd>\n</dl>");
|
2013-12-14 00:28:54 +00:00
|
|
|
}
|
|
|
|
close $fh;
|