projects
/
matthijs
/
upstream
/
blosxom.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add hash/hashref interpolation support to blosxom.cgi, and tests.
[matthijs/upstream/blosxom.git]
/
blosxom.cgi
diff --git
a/blosxom.cgi
b/blosxom.cgi
index 3bd3ae9a1510a91caba0f6c4f5e4dc7988631dda..4e19e64a27e20e423427d02a3fdf93045d616553 100755
(executable)
--- a/
blosxom.cgi
+++ b/
blosxom.cgi
@@
-293,6
+293,8
@@
foreach my $plugin (@plugin_list) {
my $on_off = $off eq '_' ? -1 : 1;
# Allow perl module plugins
my $on_off = $off eq '_' ? -1 : 1;
# Allow perl module plugins
+ # The -z test is a hack to allow a zero-length placeholder file in a
+ # $plugin_path directory to indicate an @INC module should be loaded
if ( $plugin =~ m/::/ && ( $plugin_list || -z $plugin_hash{$plugin} ) ) {
# For Blosxom::Plugin::Foo style plugins, we need to use a string require
if ( $plugin =~ m/::/ && ( $plugin_list || -z $plugin_hash{$plugin} ) ) {
# For Blosxom::Plugin::Foo style plugins, we need to use a string require
@@
-508,10
+510,10
@@
sub generate {
# Define default interpolation subroutine
$interpolate = sub {
# Define default interpolation subroutine
$interpolate = sub {
-
package blosxom;
my $template = shift;
package blosxom;
my $template = shift;
- $template =~ s/(\$\w+(?:::\w+)*)/"defined $1 ? $1 : ''"/gee;
+ # Interpolate scalars, namespaced scalars, and hash/hashref scalars
+ $template =~ s/(\$\w+(?:::\w+)*(?:(?:->)?{(['"]?)[-\w]+\2})?)/"defined $1 ? $1 : ''"/gee;
return $template;
};
return $template;
};
@@
-724,7
+726,7
@@
html content_type text/html; charset=$blog_encoding
html head <html>
html head <head>
html head <meta http-equiv="content-type" content="text/html;charset=$blog_encoding" />
html head <html>
html head <head>
html head <meta http-equiv="content-type" content="text/html;charset=$blog_encoding" />
-html head <link rel="alternate" type="
type="
application/rss+xml" title="RSS" href="$url/index.rss" />
+html head <link rel="alternate" type="application/rss+xml" title="RSS" href="$url/index.rss" />
html head <title>$blog_title $path_info_da $path_info_mo $path_info_yr
html head </title>
html head </head>
html head <title>$blog_title $path_info_da $path_info_mo $path_info_yr
html head </title>
html head </head>