From be496e81676a5ce8241ade46e0d3d5adce7136e7 Mon Sep 17 00:00:00 2001 From: Barijaona Ramaholimihaso Date: Thu, 27 Sep 2007 16:11:47 +0000 Subject: [PATCH] Enables module name and variable names with multiple :: separators --- general/interpolate_fancy | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/general/interpolate_fancy b/general/interpolate_fancy index a288808..ff888e1 100644 --- a/general/interpolate_fancy +++ b/general/interpolate_fancy @@ -2,7 +2,7 @@ # Author: Rael Dornfest , # Modified by: Matthijs Kooijman # and Barijaona Ramaholimihaso -# Version: 2007-09-13 +# Version: 2007-09-27 # Documentation: See the bottom of this file or type: # perldoc interpolate_fancy @@ -49,7 +49,7 @@ sub _resolve_nested { my $display = shift; while (1) { - if ($template !~ /(.*?)<\?(\!?\$\w+(?:::)?\w*)(?:\s+?(.+?))?>(.*)/s) { + if ($template !~ /(.*?)<\?(\!?\$\w+(?:::\w+)*)(?:\s+?(.+?))?>(.*)/s) { return $template; # No open tags, normal text } @@ -111,7 +111,7 @@ sub interpolate { # Backward Compatibility with core Blosxom style interpolation unless ($parsing_story) - {$template =~ s#(?#gs; }; + {$template =~ s#(?#gs; }; # # Conditional inclusion @@ -128,14 +128,14 @@ sub interpolate { # Variable expansion (unconditional, recursive) # # e.g. <$var /> - while( $template =~ s/<\$([a-zA-Z?]\w+(?:::)?\w*)\s+?\/>/"defined \$$1 ? \$$1 : undef"/gsee ) { } + while( $template =~ s/<\$([a-zA-Z?]\w+(?:::\w+)*)\s+?\/>/"defined \$$1 ? \$$1 : undef"/gsee ) { } # # Actions # # e.g. <@plugin.subroutine arg1="a" output="no" /> # e.g. <@plugin.subroutine encoding="Latin1" output="yes">pass content - $template =~ s#<\@(\w+?)\.(\w+?)\s+?(.+?)?(?:>(.*?)<\/\@\1\.\2>|\s+?\/>)#&interpolate_fancy::_action($1,$2,$3,$4)#gse; + $template =~ s#<\@((?:\w|::)+?)\.(\w+?)\s+?(.+?)?(?:>(.*?)<\/\@\1\.\2>|\s+?\/>)#&interpolate_fancy::_action($1,$2,$3,$4)#gse; # Unmangle mangled interpolation tags in story $title and $body # (by now in the template itself) @@ -166,7 +166,7 @@ sub _action { my($plugin, $action, $attr, $content) = @_; my $result; - $content =~ s#<\@(\w+?)\.(\w+?)\s+?(.+?)?(?:>(.*?)<\/\@\1\.\2>|\s+?\/>)#&interpolate_fancy::_action($1,$2,$3,$4)#gse; + $content =~ s#<\@((?:\w|::)+?)\.(\w+?)\s+?(.+?)?(?:>(.*?)<\/\@\1\.\2>|\s+?\/>)#&interpolate_fancy::_action($1,$2,$3,$4)#gse; my $attributes = interpolate_fancy::_attributes($attr); @@ -407,8 +407,17 @@ run your templates through the interpolate2fancy utility =head1 VERSION +2007-09-27 + +=head1 VERSION HISTORY + +2007-09-27 : enables more than one :: in variable names + 2007-09-13 : corrects the $recurse_into_story feature in XML flavours +v20061114 : fixes from Matthijs Kooijman (including properly support for nested +conditions) + =head1 AUTHOR Rael Dornfest , http://www.raelity.org/ -- 2.30.2