Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bf71ca8cec | ||
|
|
d6ac8a1c94 |
@@ -1,5 +1,9 @@
|
|||||||
Revision history for MojoX-Renderer-TT
|
Revision history for MojoX-Renderer-TT
|
||||||
|
|
||||||
0.01 November 9, 2008
|
0.02 November 10, 2008
|
||||||
First version, released on an unsuspecting world.
|
- Add template_options parameter
|
||||||
|
- Fix Template dependency
|
||||||
|
|
||||||
|
0.01 November 9, 2008
|
||||||
|
- First version, released on an unsuspecting world.
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ WriteMakefile(
|
|||||||
PREREQ_PM => {
|
PREREQ_PM => {
|
||||||
'Test::More' => 0,
|
'Test::More' => 0,
|
||||||
'Mojo' => 0.8009,
|
'Mojo' => 0.8009,
|
||||||
|
'Template' => 2.18,
|
||||||
},
|
},
|
||||||
dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', },
|
dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', },
|
||||||
clean => { FILES => 'MojoX-Renderer-TT-*' },
|
clean => { FILES => 'MojoX-Renderer-TT-*' },
|
||||||
|
|||||||
+29
-10
@@ -34,6 +34,7 @@ sub _init {
|
|||||||
CACHE_SIZE => 128,
|
CACHE_SIZE => 128,
|
||||||
RELATIVE => 1,
|
RELATIVE => 1,
|
||||||
ABSOLUTE => 1,
|
ABSOLUTE => 1,
|
||||||
|
%{$args{template_options} || {}},
|
||||||
);
|
);
|
||||||
|
|
||||||
$self->tt(Template->new(\%config))
|
$self->tt(Template->new(\%config))
|
||||||
@@ -64,13 +65,9 @@ sub _render {
|
|||||||
|
|
||||||
MojoX::Renderer::TT - Template Toolkit renderer for Mojo
|
MojoX::Renderer::TT - Template Toolkit renderer for Mojo
|
||||||
|
|
||||||
=head1 VERSION
|
|
||||||
|
|
||||||
Version 0.01
|
|
||||||
|
|
||||||
=cut
|
=cut
|
||||||
|
|
||||||
our $VERSION = '0.01';
|
our $VERSION = '0.02';
|
||||||
|
|
||||||
|
|
||||||
=head1 SYNOPSIS
|
=head1 SYNOPSIS
|
||||||
@@ -81,7 +78,16 @@ Add the handler:
|
|||||||
|
|
||||||
sub startup {
|
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
|
And then in the handler call render which will call the
|
||||||
@@ -94,8 +100,22 @@ MojoX::Renderer::TT renderer.
|
|||||||
|
|
||||||
=head2 new
|
=head2 new
|
||||||
|
|
||||||
This currently requires a C<mojo> parameter pointing to the base class (Mojo).
|
This method returns not a TT object, but a handler for the Mojo renderer.
|
||||||
object. 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
|
=head1 AUTHOR
|
||||||
|
|
||||||
@@ -108,8 +128,7 @@ Ask Bjørn Hansen, C<< <ask at develooper.com> >>
|
|||||||
* Don't require the mojo parameter
|
* Don't require the mojo parameter
|
||||||
* Move the default template cache directory?
|
* Move the default template cache directory?
|
||||||
* Should the "tx" tpl parameter be called "c" (for context) instead?
|
* 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? (stash)
|
||||||
* Better way to pass parameters to the templates?
|
|
||||||
* More sophisticated default search path?
|
* More sophisticated default search path?
|
||||||
|
|
||||||
=head1 BUGS
|
=head1 BUGS
|
||||||
|
|||||||
Reference in New Issue
Block a user