You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Would it be possible to add Template::AutoFilter as Template engine?
I've amateurishly hacked together a working module (template: "template_autoFilter"), attached below but as AutoFilter itself just abstracts from Template::Toolkit that's probably overkill. Maybe TemplateToolkit.pm could detect $tt_config{'AUTO_FILTER'}, and if it exists just require Template::AutoFilter and use that one if installed.
For just HTML entity encoding Template::AutoFilter has a few advantages over the Template::Stash::AutoEscaping example in the pod, for example it allows the "none" filter plus a few other things. It was also mentioned in #1368
Looking forward to see this officially supported in one way or another.
--- TemplateToolkit.pm 2020-05-12 12:44:07.883241301 +0200+++ TemplateAutoFilter.pm 2020-05-12 12:47:28.923173917 +0200@@ -1,13 +1,13 @@-# ABSTRACT: Template toolkit engine for Dancer2+# ABSTRACT: Template::AutoFilter toolkit engine for Dancer2-package Dancer2::Template::TemplateToolkit;-$Dancer2::Template::TemplateToolkit::VERSION = '0.300003';+package Dancer2::Template::TemplateAutoFilter;+$Dancer2::Template::TemplateAutoFilter::VERSION = '0.300003';
use Moo;
use Carp qw<croak>;
use Dancer2::Core::Types;
use Dancer2::FileUtils qw<path>;
use Scalar::Util ();
-use Template;+use Template::AutoFilter;
with 'Dancer2::Core::Role::Template';
@@ -37,7 +37,7 @@
sub { [ $ttt->views ] },
];
- my $tt = Template->new(%tt_config);+ my $tt = Template::AutoFilter->new(%tt_config);
$Template::Stash::PRIVATE = undef if $self->config->{show_private_variables};
return $tt;
}
The text was updated successfully, but these errors were encountered:
I would very much like to see this released as a plugin for Dancer2. I am not, however, supportive of seeing another template engine added to the core of Dancer2. Having another template engine adds another prereq for Dancer2, and one that not everyone will want to use. On a side note, we're actually on the verge of removing another template engine from core altogether (one we wrote, in fact!).
Is there something we can do to assist you in releasing this as a plugin? Let me know and I'd be happy to help!
Would it be possible to add Template::AutoFilter as Template engine?
I've amateurishly hacked together a working module (template: "template_autoFilter"), attached below but as AutoFilter itself just abstracts from Template::Toolkit that's probably overkill. Maybe TemplateToolkit.pm could detect
$tt_config{'AUTO_FILTER'}
, and if it exists just require Template::AutoFilter and use that one if installed.For just HTML entity encoding Template::AutoFilter has a few advantages over the Template::Stash::AutoEscaping example in the pod, for example it allows the "none" filter plus a few other things. It was also mentioned in #1368
Looking forward to see this officially supported in one way or another.
The text was updated successfully, but these errors were encountered: