mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-12 18:06:17 +00:00
4a53c652e2
This adds a silly perl script to create either a txt or html file from the structured descriptor3.tsv file. This way we can maintain the structured file and easily create both text and html output from it. Instead of somehow adding this to qmake I decided to simply add the two output files so that they are included in the source tar file. Recreate them by running perl scripts/parse-descriptor.pl descriptor3.tsv SupportedDivecomputers.html perl scripts/parse-descriptor.pl descriptor3.tsv SupportedDivecomputers.txt Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
39 lines
903 B
Perl
39 lines
903 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("<ul><li>%s\n\t<ul>\n\t <li>%s", $vend, $mod);
|
|
} else {
|
|
printf("</li>\n\t</ul>\n </li>\n <li>%s\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 </li>\n<ul>");
|
|
}
|
|
close $fh;
|