The html filter is fast and simple but it doesn't encode the full range of HTML entities that your text may contain. The html_entity filter uses either the Apache::Util module (which is written in C and is therefore faster) or the HTML::Entities module (written in Perl but equally as comprehensive) to perform the encoding. If one or other of these modules are installed on your system then the text will be encoded (via the escape_html() or encode_entities() subroutines respectively) to convert all extended characters into their appropriate HTML entities (e.g. converting 'é' to '&eacute;'). If neither module is available on your system then an 'html_entity' exception will be thrown reporting an appropriate message.

This filter URI escapes the input text, converting any characters outside of the permitted URI character set (as defined by RFC 2396) into a %nn hex escape.

[% 'my file.html' | uri %]

output:

my%20file.html

Note that URI escaping isn't always enough when generating hyperlinks in an HTML document. The & character, for example, is valid in a URI and will not be escaped by the URI filter. In this case you should also filter the text through the 'html' filter.

Truncates the text block to the length specified, or a default length of 32. Truncated text will be terminated with '...' (i.e. the '...' falls inside the required length, rather than appending to it).

[% FILTER truncate(21) %]
I have much to say on this matter that has previously
been said on more than one occasion.
[% END %]

The 'eval' filter evaluates the block as template text, processing any directives embedded within it. This allows template variables to contain template fragments, or for some method to be provided for returning template fragments from an external source such as a database, which can then be processed in the template as required.

The 'perl' filter evaluates the block as Perl code. The EVAL_PERL option must be set to a true value or a 'perl' exception will be thrown.

[% my_perl_code | perl %]

In most cases, the [% PERL %] ... [% END %] block should suffice for evaluating Perl code, given that template directives are processed before being evaluate as Perl. Thus, the previous example could have been written in the more verbose form:

[% PERL %]
[% my_perl_code %]
[% END %]

as well as

[% FILTER perl %]
[% my_perl_code %]
[% END %]

The 'evalperl' filter is provided as an alias for 'perl' for backwards compatibility.

The stdout filter prints the output generated by the enclosing block to STDOUT. The 'binmode' option can be passed as either a named parameter or a single argument to set STDOUT to binary mode (see the binmode perl function).

The null filter prints nothing. This is useful for plugins whose methods return values that you don't want to appear in the output. Rather than assigning every plugin method call to a dummy variable to silence it, you can wrap the block in a null filter:

Passes the text block to LaTeX and produces either PDF, DVI or PostScript output. The 'outputType' argument determines the output format and it should be set to one of the strings: "pdf" (default), "dvi", or "ps".

The output will be a PDF file. You should be careful not to prepend or append any extraneous characters or text outside the FILTER block, since this text will wrap the (binary) output of the latex filter. Notice the END directive uses '-%]' for the END_TAG to remove the trailing new line.

One example where you might prepend text is in a CGI script where you might include the Content-Type before the latex output, eg: