Changed the Help so that chapters with only 1 page are directly linked, saving a click.
Added pluggable template parser docs. From the dev list, changed HTMLTemplateExpr to translate all dots in template variables to underscores, since EXPR's don't do dots, just like TemplateToolkit.
This commit is contained in:
parent
8905b7252c
commit
0b1e077f69
14 changed files with 319 additions and 4 deletions
|
|
@ -19,6 +19,25 @@ use base 'WebGUI::Asset::Template::Parser';
|
|||
use HTML::Template::Expr;
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub _rewriteVars { # replace dots with underscrores in keys (except in keys that aren't usable as variables (URLs etc.))
|
||||
my $vars = shift;
|
||||
foreach my $key (keys %$vars){
|
||||
my $newKey = $key;
|
||||
$newKey =~ s/\./_/g if $newKey !~ /\//;
|
||||
if(ref $vars->{$key} eq 'HASH'){
|
||||
$vars->{$newKey} = _rewriteVars($vars->{$key});
|
||||
delete $vars->{$key} if($key ne $newKey);
|
||||
}else{
|
||||
if($key ne $newKey){
|
||||
$vars->{$newKey} = $vars->{$key};
|
||||
delete $vars->{$key};
|
||||
}
|
||||
}
|
||||
}
|
||||
return $vars;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getName ( )
|
||||
|
|
@ -62,7 +81,7 @@ sub process {
|
|||
strict=>0);
|
||||
};
|
||||
unless ($@) {
|
||||
$t->param(%{$vars});
|
||||
$t->param(%{_rewriteVars($vars)});
|
||||
return $t->output;
|
||||
} else {
|
||||
$class->session->errorHandler->error("Error in template. ".$@);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue