$blosxom::plugins{$plugin} > 0
and $plugin->can($action)
and $result = $plugin->$action($attributes, $content);
-
- return $attributes->{'output'} =~ /yes/i ? $result : undef;
+
+ # Optionally interpolate and/or output the result, if requested.
+ if ($attributes->{'output'} =~ /yes/i) {
+ if ($attributes->{'interpolate'} =~ /yes/i) {
+ $result = interpolate_fancy::do_interpolate($result);
+ }
+ return $result;
+ } else {
+ return undef;
+ }
}
sub _attributes {
Otherwise, subroutines will still have their effect, but the results will be tossed out.
+Normally, the result from the subroutine is sent as-is, but you can set the interpolate="yes" attribute to let interpolate_fancy interpolate the results, as follows:
+
+ <@plugin.subroutine arg1="a" arg2="bee" output="yes" interpolate="yes"/>
+
Content wrapped in the action call is sent as another argument to the subroutine:
<@thePlugin.subroutine encoding="Latin1" output="yes">
return substr($content, 0, $attributes->{'length'}||$default_length);
}
+# This action includes the template specified in the 'name' attribute
+
+sub includetemplate {
+ my($self, $attributes, $content) = @_;
+ $name = $attributes->{'name'};
+ return &$blosxom::template($blosxom::path_info, $name, $blosxom::flavour);
+}
+
--
Calling these individually in a Blosxom flavour template looks something like:
</@myplugin.strip_html>
</@myplugin.foreshorten>
+The following includes the 'sidebar' template, while interpolating
+the contents of that file:
+
+<@myplugin.include name="sidebar" output="yes" interpolate="yes"/>
+
=head1 INSTALLATION
Drop the interpolate_fancy plug-in into your Blosxom plugins folder.