Template-Toolkit
view release on metacpan or search on metacpan
lib/Template/Manual/Config.pod view on Meta::CPAN
#============================================================= -*-perl-*-
#
# Template::Manual::Config
#
# AUTHOR
# Andy Wardley <abw@wardley.org>
#
# COPYRIGHT
# Copyright (C) 1996-2022 Andy Wardley. All Rights Reserved.
#
# This module is free software; you can redistribute it and/or
# modify it under the same terms as Perl itself.
#
#========================================================================
=head1 NAME
Template::Manual::Config - Configuration options
=head1 Template Style and Parsing Options
=head2 ENCODING
The C<ENCODING> option specifies the template files' character encoding:
my $template = Template->new({
ENCODING => 'utf8',
});
A template which starts with a Unicode byte order mark (BOM) will have its
encoding detected automatically.
=head2 START_TAG, END_TAG
The C<START_TAG> and C<END_TAG> options are used to specify character
sequences or regular expressions that mark the start and end of inline
template directives. The default values for C<START_TAG> and C<END_TAG> are
'C<[%>' and 'C<%]>' respectively, giving us the familiar directive style:
[% example %]
Any Perl regex characters can be used and therefore should be escaped
(or use the Perl C<quotemeta> function) if they are intended to
represent literal characters.
my $template = Template->new({
START_TAG => quotemeta('<+'),
END_TAG => quotemeta('+>'),
});
Example:
<+ INCLUDE foobar +>
The C<TAGS> directive can also be used to set the C<START_TAG> and C<END_TAG> values
on a per-template file basis.
[% TAGS <+ +> %]
=head2 OUTLINE_TAG
The C<OUTLINE_TAG> option can be used to enable single-line "outline" directives.
my $template = Template->new({
OUTLINE_TAG => '%%',
});
This allows you to use both inline and outline tags like so:
%% IF user
Hello [% user.name %]
%% END
The C<OUTLINE_TAG> string (or regex) must appear at the start of a line. The
directive continues until the end of the line. The newline character at the
end of the line is considered to be the invisible end-of-directive marker and
is removed.
=head2 TAG_STYLE
The C<TAG_STYLE> option can be used to set both C<START_TAG> and C<END_TAG>
according to pre-defined tag styles.
my $template = Template->new({
TAG_STYLE => 'star',
});
Available styles are:
template [% ... %] (default)
( run in 0.872 second using v1.01-cache-2.11-cpan-5a3173703d6 )