From: Mischa POSLAWSKY Date: Wed, 29 Mar 2017 16:05:12 +0000 (+0200) Subject: common: join page options inline X-Git-Tag: v1.10~279 X-Git-Url: http://git.shiar.nl/sheet.git/commitdiff_plain/5ea095893fafdce2fa34e33cbc1d73ba1c65f167 common: join page options inline --- diff --git a/common.inc.plp b/common.inc.plp index 6330329..d6ef393 100644 --- a/common.inc.plp +++ b/common.inc.plp @@ -85,7 +85,9 @@ sub Html { $meta->{stylesheet} ||= [qw'light dark circus mono red terse']; $meta->{charset} ||= 'utf-8'; - ref $_ eq 'ARRAY' or $_ = [$_] for $meta->{raw}; + # convert options to arrays + ref $_ eq 'ARRAY' or $_ = [$_] + for grep {$_} $meta->{raw}, $meta->{description}, $meta->{keywords}; # optional amends push @{ $meta->{raw} }, ( @@ -97,11 +99,6 @@ sub Html { '', ) if $meta->{keys}; - # flatten arrays - ref $_ eq 'ARRAY' and $_ = join ' ', @$_ for $meta->{description}; - ref $_ eq 'ARRAY' and $_ = join ', ', @$_ for $meta->{keywords}; - ref $_ eq 'ARRAY' and $_ = join "\n", @$_ for $meta->{raw}; - # other vars my $Dev = $ENV{HTTP_HOST} =~ /\bdev\./; my ($file) = $ENV{SCRIPT_FILENAME} =~ m{ ([^/]+) \.plp$ }x; @@ -115,13 +112,15 @@ sub Html { $meta->{title} - - - - EOT + say sprintf '', EscapeHTML($_) + for join(' ', @{ $meta->{description} }) || (); + say sprintf '', EscapeHTML($_) + for join(', ', @{ $meta->{keywords} }) || (); + say ''; + say ''; say for stylesheet($meta->{stylesheet}); - say for $meta->{raw} || (); + say for map { @{$_} } $meta->{raw} || (); say '' if $Dev; say qq{\n\n};