mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Avoid duplicate entries when parsing libdivecomputer descriptors
This just fixes the tool used for the next commit. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
1ab6e7fc8a
commit
cc8ee5ab96
1 changed files with 3 additions and 0 deletions
|
@ -22,6 +22,7 @@ open(my $fh, "<", $infi) || croak "can't open $infi: $!";
|
||||||
open(STDOUT, ">", $outfi) || croak "can't open $outfi: $!";
|
open(STDOUT, ">", $outfi) || croak "can't open $outfi: $!";
|
||||||
|
|
||||||
my $lastVend = "";
|
my $lastVend = "";
|
||||||
|
my $lastMod = "";
|
||||||
my @descriptors = ();
|
my @descriptors = ();
|
||||||
while (<$fh>) {
|
while (<$fh>) {
|
||||||
if (/^\s*{\s*"([^\,]*)"\s*,\s*"([^\,]*)"\s*,\s*([^\,]*).*}/) {
|
if (/^\s*{\s*"([^\,]*)"\s*,\s*"([^\,]*)"\s*,\s*([^\,]*).*}/) {
|
||||||
|
@ -31,6 +32,7 @@ while (<$fh>) {
|
||||||
my @sortedDescriptors = sort @descriptors;
|
my @sortedDescriptors = sort @descriptors;
|
||||||
foreach (@sortedDescriptors) {
|
foreach (@sortedDescriptors) {
|
||||||
($vend, $mod) = split(',', $_);
|
($vend, $mod) = split(',', $_);
|
||||||
|
next if ($vend eq $lastVend && $mod eq $lastMod);
|
||||||
if ($type eq "html") {
|
if ($type eq "html") {
|
||||||
if ($vend eq $lastVend) {
|
if ($vend eq $lastVend) {
|
||||||
printf(", %s", $mod);
|
printf(", %s", $mod);
|
||||||
|
@ -59,6 +61,7 @@ foreach (@sortedDescriptors) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$lastVend = $vend;
|
$lastVend = $vend;
|
||||||
|
$lastMod = $mod;
|
||||||
}
|
}
|
||||||
if ($type eq "html") {
|
if ($type eq "html") {
|
||||||
print("</li>\n\t</ul>\n </dd>\n</dl>");
|
print("</li>\n\t</ul>\n </dd>\n</dl>");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue