Skip to content

Commit

Permalink
applying fcharlier's patch for fixing Dancer::Template::Simple
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexis Sukrieh committed Dec 10, 2009
1 parent b4efac0 commit 8c44e82
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions lib/Dancer/Template/Simple.pm
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,18 @@ sub parse_branches {
my $should_bufferize = 1;
my $opened_tag = 0;
my $bufferize_if_token = 0;
$content =~ s/${start}(\S)/${start} $1/sg;
$content =~ s/(\S)${stop}/$1 ${stop}/sg;
$content =~ s/\Q${start}\E(\S)/${start} $1/sg;
$content =~ s/(\S)\Q${stop}\E/$1 ${stop}/sg;

foreach my $word (split / /, $content) {
if ($word =~ /(.*)$start/s) {
if ($word =~ /(.*)\Q$start\E/s) {
my $junk = $1;
$opened_tag = 1;
if (defined($junk) && length($junk)) {
$prefix = $junk;
}
}
elsif ($word =~ /$stop(.*)/s) {
elsif ($word =~ /\Q$stop\E(.*)/s) {
my $junk = $1;
if (defined($junk) && length($junk)) {
if (@buffer) {
Expand Down
8 changes: 4 additions & 4 deletions script/dancer
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,8 @@ sub write_file {
sub process_template {
my ($template, $tokens) = @_;
my $engine = Dancer::Template::Simple->new;
$engine->{start_tag} = '__';
$engine->{stop_tag} = '__';
$engine->{start_tag} = '[%';
$engine->{stop_tag} = '%]';
return $engine->render(\$template, $tokens);
}

Expand All @@ -155,7 +155,7 @@ sub templates($) {

"# This is a PSGI application file for Apache+Plack support
use CGI::PSGI;
use lib '__appdir__';
use lib '[%appdir%]';
use $appname;
use Dancer::Config 'setting';
Expand All @@ -170,7 +170,7 @@ my \$handler = sub {
'index.tt' => '<h2>It Works!</h2>
<p>
I\'m in <code>__appdir__/views/index.tt</code>
I\'m in <code>[%appdir%]/views/index.tt</code>
</p>
',

Expand Down

0 comments on commit 8c44e82

Please sign in to comment.