Hi,

I have come to the conclusion that a FILTER is what I need. I have been trying to understand the documentation and examples and I am a little stuck.

I have written my own module like so:

package MyOrg::Template::Plugin::latex_filter;
use Template::Plugin::Filter;
use base qw( Template::Plugin::Filter );
sub latex_escape {
    my $return = $_[0];
    $return =~ s/([%&\$])/\\$1/g;
    return $return;
}
1;

Here is where I get stuck. How do i now apply my filter and use it in my template?

I added the filter to the tpage program (which is how i process my template) by adding the following lines to tpage:

use latex_filter '.';
my $tt2 = Template->new({
    PLUGINS=> {
        latex_filter => 'MyOrg::Template::Pulgin::latex_filter',
    },
});

and then I try and use the filter in my template like so:

[% USE latex_filter %]

but I get an error from perl:

[EMAIL PROTECTED]:~/catalogue/latex/tt$ ./tpage catalogue.tex
plugin error - latex_filter: plugin not found at ./tpage line 67.

can anyone point me to where I am going wrong, or prehaps a more complete example than hte documentation online please? thanks.

Jason


_______________________________________________ templates mailing list [EMAIL PROTECTED] http://lists.template-toolkit.org/mailman/listinfo/templates

Reply via email to