From: Kevin Scaldeferri Date: Mon, 10 Jul 2006 20:34:08 +0000 (+0000) Subject: allow for empty (but defined) templates X-Git-Tag: debian/2.1.2-2~123 X-Git-Url: https://git.deb.at/?p=pkg%2Fblosxom.git;a=commitdiff_plain;h=f44af6eebbd9d8aafe14db09b54f8a33b23f9e07 allow for empty (but defined) templates --- diff --git a/blosxom.cgi b/blosxom.cgi index 997fcc7..a979a0d 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"; }