The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Text::Xslate::Syntax::HTMLTemplate - An alternative syntax compatible with HTML Template

SYNOPSIS

    use Text::Xslate;

    local $Text::Xslate::Syntax::HTP::before_parse_hook = sub {
        my $parser = shift;
        $parser->use_global_vars(1);
        $parser->use_loop_context_vars(1);
        $parser->use_has_value(1);
    };
    my $tx = Text::Xslate->new(syntax => 'HTMLTemplate', compiler => 'Text::Xslate::Compiler::HTMLTemplate',
                               function => {
                                 __choise_global_var__ => \&Text::Xslate::Syntax::HTMLTemplate::default_choise_global_var,
                                 __has_value__ => \&Text::Xslate::Syntax::HTMLTemplate::default_has_value,
                               }
                              );

    print $tx->render('hello.tx');

    For Migration test:

    Text::Xslate::Syntax::HTMLTemplate::install_Xslate_as_HTMLTemplate();
    my $htp = HTML::Template::Pro->new(...);
    ...
    my $output = $htp->output(); # generated by xsalte engine;
    my $output_htp = $htp->output_original_HTMLTemplate(); # generated by HTML::Template::Pro;
    diff($output, $output_htp);

DESCRIPTION

Syntax::HTMLTemplate is a parser for Text::Xslate. It parse HTML::Template syntax template.

OPTIONS

use_global_vars

same as global_vars option of HTML::Template. you have to register function to handle that.

use_loop_context_vars

same as loop_context_vars option of HTML::Template.

use_has_value

HTML::Template treats empty array referense as Flase. But Xslate treats empty array referense as True. when use_has_value is seted, Syntax::HTMLTemplate you have to register function to handle that.

is_escaped_var

Method that determine var is escaped or not. For temporary use while migration. You should use Text::Xslate::mark_raw().

AUTHOR

Shigeki Morimoto <Shigeki(at)Morimo.to>

LICENSE AND COPYRIGHT

Copyright (c) 2011, Shigeki, Morimoto. All rights reserved.

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