Skip to content

Split Dancer2::Template::Simple from core #1732

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cpanfile
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ requires 'Ref::Util';
requires 'Safe::Isa';
requires 'Sub::Quote';
requires 'Template';
requires 'Template::Tiny';
requires 'Template::Tiny', '1.16';
requires 'Test::Builder';
requires 'Test::More';
requires 'Types::Standard';
Expand Down
14 changes: 9 additions & 5 deletions lib/Dancer2/CLI/Gen.pm
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use URI;
use HTTP::Tiny;
use Path::Tiny;
use JSON::MaybeXS;
use Dancer2::Template::Simple;
use Dancer2::Template::Tiny;
use Module::Runtime qw( use_module is_module_name );
use CLI::Osprey
desc => 'Helper script to create new Dancer2 applications';
Expand Down Expand Up @@ -111,6 +111,13 @@ option no_package_files => (
default => 0,
);

has _engine => (
is => 'ro',
default => sub {
return Dancer2::Template::Tiny->new( config => { start_tag => '[d2%', end_tag => '%2d]' } );
},
);

# Last chance to validate args before we attempt to do something with them
sub BUILD {
my ( $self, $args ) = @_;
Expand Down Expand Up @@ -384,10 +391,7 @@ sub _add_to_manifest_skip {
sub _process_template {
my ( $self, $template, $tokens ) = @_;

my $engine = Dancer2::Template::Simple->new;
$engine->{ start_tag } = '[d2%';
$engine->{ stop_tag } = '%2d]';
return $engine->render( \$template, $tokens );
return $self->_engine->render( \$template, $tokens );
}

# These are good candidates to move to Dancer2::CLI if other commands
Expand Down
Loading
Loading