Compare commits

..
Author SHA1 Message Date
Ask Bjørn Hansen bf71ca8cec Accept options for the Template object
Prepare 0.02
2008-11-10 11:14:38 -08:00
Ask Bjørn Hansen d6ac8a1c94 Template.pm is required (duh) 2008-11-10 10:12:49 -08:00
3 changed files with 36 additions and 12 deletions
+6 -2
View File
@@ -1,5 +1,9 @@
Revision history for MojoX-Renderer-TT
0.01 November 9, 2008
First version, released on an unsuspecting world.
0.02 November 10, 2008
- Add template_options parameter
- Fix Template dependency
0.01 November 9, 2008
- First version, released on an unsuspecting world.
+1
View File
@@ -14,6 +14,7 @@ WriteMakefile(
PREREQ_PM => {
'Test::More' => 0,
'Mojo' => 0.8009,
'Template' => 2.18,
},
dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', },
clean => { FILES => 'MojoX-Renderer-TT-*' },
+29 -10
View File
@@ -34,6 +34,7 @@ sub _init {
CACHE_SIZE => 128,
RELATIVE => 1,
ABSOLUTE => 1,
%{$args{template_options} || {}},
);
$self->tt(Template->new(\%config))
@@ -64,13 +65,9 @@ sub _render {
MojoX::Renderer::TT - Template Toolkit renderer for Mojo
=head1 VERSION
Version 0.01
=cut
our $VERSION = '0.01';
our $VERSION = '0.02';
=head1 SYNOPSIS
@@ -81,7 +78,16 @@ Add the handler:
sub startup {
...
$self->renderer->add_handler( tt => MojoX::Renderer::TT->new( mojo => $self ) );
my $tt = MojoX::Renderer::TT->new(
mojo => $self,
template_options =>
{ PROCESS => 'tpl/wrapper',
FILTERS => [ foo => [ \&filter_factory, 1]
}
);
$self->renderer->add_handler( html => $tt );
}
And then in the handler call render which will call the
@@ -94,8 +100,22 @@ MojoX::Renderer::TT renderer.
=head2 new
This currently requires a C<mojo> parameter pointing to the base class (Mojo).
object. This method returns not a TT object, but a handler for the Mojo renderer.
This method returns not a TT object, but a handler for the Mojo renderer.
Supported parameters are
=over 4
=item mojo
C<new> currently requires a C<mojo> parameter pointing to the base class (Mojo).
object.
=item template_options
A hash reference of options that are passed to Template->new().
=back
=head1 AUTHOR
@@ -108,8 +128,7 @@ Ask Bjørn Hansen, C<< <ask at develooper.com> >>
* Don't require the mojo parameter
* Move the default template cache directory?
* Should the "tx" tpl parameter be called "c" (for context) instead?
* Accept options for setting up the Tempate object
* Better way to pass parameters to the templates?
* Better way to pass parameters to the templates? (stash)
* More sophisticated default search path?
=head1 BUGS