CGI-Application-Plugin-AnyTemplate

 view release on metacpan or  search on metacpan

lib/CGI/Application/Plugin/AnyTemplate/Driver/Petal.pm  view on Meta::CPAN


package CGI::Application::Plugin::AnyTemplate::Driver::Petal;

=head1 NAME

CGI::Application::Plugin::AnyTemplate::Driver::Petal - Petal plugin to AnyTemplate

=head1 DESCRIPTION

This is a driver for L<CGI::Application::Plugin::AnyTemplate>, which
provides the implementation details specific to rendering templates via
the L<Petal> templating system.

All C<AnyTemplate> drivers are designed to be used the same way.  For
general usage instructions, see the documentation of
L<CGI::Application::Plugin::AnyTemplate>.

=head1 EMBEDDED COMPONENT SYNTAX (Petal)

B<Note that for embedding component to work properly in Petal, you need to enclose>
B<the contents of the included file in tags, such as C<< <span> >> tags.>

    <span>
    var: <span petal:replace="var"></span>
    </span>

The C<Petal> syntax for embedding components is:

    <span tal:replace="structure CGIAPP/embed 'some_run_mode' some_param1 some_param2 'some literal string 3'">
        this text gets replaced by the output of some_run_mode
    </span>

This can be overridden by the following configuration variables:

    embed_tag_name       # default 'CGIAPP'

For instance by setting the following values in your configuration file:

    embed_tag_name       'MYAPP'

Then the embedded component tag will look like:

    <span tal:replace="structure MYAPP/embed 'some_run_mode'">
        this text gets replaced by the output of some_run_mode
    </span>

Note that when creating documents to be included as components, they
must be complete XML documents.


=cut

use strict;
use Carp;

use CGI::Application::Plugin::AnyTemplate::ComponentHandler;

use CGI::Application::Plugin::AnyTemplate::Base;
use vars qw(@ISA);
@ISA = ('CGI::Application::Plugin::AnyTemplate::Base');

=head1 CONFIGURATION

The L<CGI::Application::Plugin::AnyTemplate::Driver::Petal> driver
accepts the following config parameters:

=over 4

=item embed_tag_name

The name of the tag used for embedding components.  Defaults to
C<CGIAPP>.

=item template_extension

If C<auto_add_template_extension> is true, then
L<CGI::Application::Plugin::AnyTemplate> will append the value of
C<template_extension> to C<filename>.  By default



( run in 0.471 second using v1.01-cache-2.11-cpan-71847e10f99 )