mirror of
https://github.com/subsurface/subsurface.git
synced 2024-12-11 03:21:29 +00:00
be7978679a
I had forgotten that I used <dl> and not <ul> for the dive computers on the web site. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
39 lines
922 B
Perl
39 lines
922 B
Perl
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 "") {
|
|
printf("<dl><dt>%s</dt><dd>\n\t<ul>\n\t <li>%s", $vend, $mod);
|
|
} else {
|
|
printf("</li>\n\t</ul>\n </dd>\n <dt>%s</dt><dd>\n\t<ul>\n\t <li>%s", $vend, $mod);
|
|
}
|
|
}
|
|
} 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") {
|
|
print("</li>\n\t</ul>\n </dd>\n</dl>");
|
|
}
|
|
close $fh;
|