Alex J. G. Burzyński > MojoX-Renderer-Alloy > Mojolicious::Plugin::AlloyRenderer

Download:
MojoX-Renderer-Alloy-1.121150.tar.gz

Dependencies

Annotate this POD

Website

CPAN RT

New  1
Open  0
View/Report Bugs
Module Version: 1.121150   Source  

NAME ^

Mojolicious::Plugin::AlloyRenderer - Template::Alloy renderer plugin

VERSION ^

version 1.121150

SYNOPSIS ^

Mojolicious

    $self->plugin( 'alloy_renderer' );

    $self->plugin( 'alloy_renderer',
        {
            syntax => 'TT',
            template_options => {
                TRIM => 1,
                PRE_CHOMP => 1,
                POST_CHOMP => 1,
            }
        }
    );

Mojolicious::Lite

    plugin( 'alloy_renderer' );

    plugin( 'alloy_renderer',
        {
            syntax => 'TT',
            template_options => {
                TRIM => 1,
                PRE_CHOMP => 1,
                POST_CHOMP => 1,
            }
        }
    );

DESCRIPTION ^

Mojolicious::Plugin::AlloyRenderer is a loader for MojoX::Renderer::Alloy.

METHODS ^

register

    $plugin->register( %config );

Registers this plugin within Mojolicious application.

Following options are supported:

syntax

Default syntax is TT.

    $plugin->register(
        syntax => 'TT',
    );

Possible scalar values are:

    # syntax    # default extension (handler)   # syntax
    TT          tt                              Template::Alloy::TT
    Velocity    vtl                             Template::Alloy::Velocity
    Tmpl        tmpl                            Template::Alloy::Tmpl
    HTE         hte                             Template::Alloy::HTE

You may also choose your own templates extensions (handler):

    $plugin->register(
        syntax => { 'TT' => 'tt3' },
    );

or enable multiple templating engines at once:

    # with default extensions
    $plugin->register(
        syntax => [qw( TT Tmpl )],
    );
    # or all
    $plugin->register(
        syntax => ':all',
    );

    # with custom extensions
    $plugin->register(
        syntax => {
            'TT' => 'tt3',
            'HTE' => 'ht',
        },
    );

Chosen syntax will be set as default handler by calling "default_handler" in Mojolicious::Renderer.

Please note that if you pass multiple options the last one will be set as default (random in case of hashref).

template_options
    $plugin->register(
        template_options => {
            INCLUDE_PATH => $app->home->rel_dir('templates'),
            COMPILE_EXT => '.ct',
            COMPILE_DIR => ( $app->home->rel_dir('tmp/ctpl') || File::Spec->tmpdir ),
            UNICODE     => 1,
            ENCODING    => 'utf-8',
            CACHE_SIZE  => 128,
            RELATIVE    => 1,
            ABSOLUTE    => 1,
        }
    );

Configuration options as described in "CONFIGURATION" in Template::Alloy.

Above are the default options for all engines.

SEE ALSO ^

Please see those modules/websites for more information related to this module.

AUTHOR ^

Alex J. G. Burzyński <ajgb@cpan.org>

COPYRIGHT AND LICENSE ^

This software is copyright (c) 2012 by Alex J. G. Burzyński <ajgb@cpan.org>.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

syntax highlighting: