From 538dc2a86215f99b4477d824eca2d65b6791a9f2 Mon Sep 17 00:00:00 2001 From: Doug Bell Date: Fri, 20 May 2011 14:16:16 -0500 Subject: [PATCH] process non-TT templates before including them --- lib/WebGUI/Template/Provider.pm | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/lib/WebGUI/Template/Provider.pm b/lib/WebGUI/Template/Provider.pm index 0a9152124..3e842f2bd 100644 --- a/lib/WebGUI/Template/Provider.pm +++ b/lib/WebGUI/Template/Provider.pm @@ -63,7 +63,22 @@ sub _template_content { return wantarray ? ( "", $@, 0 ) : ""; } - my $content = $type eq 'template' ? $asset->template : $asset->view; + my $content; + # If not a TT template, process it. + if ( $type eq 'template' ) { + if ( $asset->parser ne 'WebGUI::Asset::Template::TemplateToolkit' ) { + $content = $asset->process( $self->context->stash ); + } + else { + # It may or may not get processed, according to the user's desire + $content = $asset->template; + } + } + # Normal assets, call view + else { + $content = $asset->view; + } + return wantarray ? ( $content, "", $asset->getLastModified ) : $content; } else {