mason/.perl-lib/TrivGal.pm: Introduce a `-' flag to hide an entry.
authorMark Wooding <mdw@distorted.org.uk>
Mon, 12 Jun 2023 10:46:07 +0000 (11:46 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Mon, 12 Jun 2023 10:49:10 +0000 (11:49 +0100)
This is only useful if the entry is /also/ an index: it allows an index
page to designate an image that's in a different folder.

mason/.perl-lib/TrivGal.pm

index b47835a..80cce08 100644 (file)
@@ -304,12 +304,13 @@ sub listdir ($) {
       } else {
        if ($item && $comment) { $item->comment($comment); }
        my ($flags, $name, $c) =
-         /^ (?: ([!]+) \s+)?           # flags
+         /^ (?: ([-!]+) \s+)?          # flags
             (\S+) \s*                  # filename
             (\S | \S.*\S )?            # start of the comment
             \s*
             $/x;
        my $indexp = $flags =~ /!/;
+       my $hidep = $flags =~ /-/;
        $name = urldecode $name;
        my $list;
        $item = TrivGal::Item->new($name);
@@ -326,7 +327,7 @@ sub listdir ($) {
          }
        }
        $comment = $c;
-       push @$list, $item;
+       push @$list, $item unless $hidep;
       }
     }
     if ($item && $comment) { $item->comment($comment); }