Allow .html routes to call a sub
This commit is contained in:
parent
0119e3a229
commit
12ca5e62b9
|
@ -56,7 +56,7 @@ sub genRoute {
|
||||||
else {
|
else {
|
||||||
$dest ||= $word;
|
$dest ||= $word;
|
||||||
}
|
}
|
||||||
if ( $dest =~ /^(.+)\.html$/ ) {
|
if ( $word =~ /^(.+)\.html$/ and $word eq $dest ) {
|
||||||
my $tpl = $1 or die;
|
my $tpl = $1 or die;
|
||||||
$self->logger->debug("route $dest will use $tpl");
|
$self->logger->debug("route $dest will use $tpl");
|
||||||
$routes->{$word} = sub { $self->sendHtml( $_[1], $tpl ) };
|
$routes->{$word} = sub { $self->sendHtml( $_[1], $tpl ) };
|
||||||
|
@ -305,8 +305,8 @@ the subroutine will be called with the word of path_info as second argument
|
||||||
|
|
||||||
=item 'something.html':
|
=item 'something.html':
|
||||||
|
|
||||||
if $word finishes with '.html', then sendHtml() will be called with
|
if $word finishes with '.html', and $dest is undef, then sendHtml() will be
|
||||||
'something.tpl' as template name. In this case, $dest is not used.
|
called with 'something.tpl' as template name.
|
||||||
|
|
||||||
=back
|
=back
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue