X-Git-Url: https://git.stderr.nl/gitweb?p=matthijs%2Fupstream%2Fblosxom.git;a=blobdiff_plain;f=blosxom.cgi;h=48a79b57bd32ab341a9bfb3b9a5a35faa909903a;hp=997fcc74a4a00fdc80eb0cd82265e8c64f850643;hb=c9626e1f75bba2015a0522f907ca2a2155cd0cf6;hpb=0f7240c4441b085dd9f46a326abe19e6b5a77ed5 diff --git a/blosxom.cgi b/blosxom.cgi index 997fcc7..48a79b5 100755 --- a/blosxom.cgi +++ b/blosxom.cgi @@ -143,13 +143,20 @@ $template = return join '', <$fh> if $fh->open("< $datadir/$path/$chunk.$flavour"); } while ($path =~ s/(\/*[^\/]*)$// and $1); - return join '', ($template{$flavour}{$chunk} || $template{error}{$chunk} || ''); + # Check for definedness, since flavour can be the empty string + if (defined $template{$flavour}{$chunk}) { + return $template{$flavour}{$chunk}; + } elsif (defined $template{error}{$chunk}) { + return $template{error}{$chunk} + } else { + return ''; + } }; # Bring in the templates %template = (); while () { last if /^(__END__)$/; - my($ct, $comp, $txt) = /^(\S+)\s(\S+)\s(.*)$/ or next; + my($ct, $comp, $txt) = /^(\S+)\s(\S+)(?:\s(.*))?$/ or next; $txt =~ s/\\n/\n/mg; $template{$ct}{$comp} .= $txt . "\n"; } @@ -176,7 +183,7 @@ sub load_template { return &$template(@_); } -# Define default entries subroutine +# Define default find subroutine $entries = sub { my(%files, %indexes, %others);