Skip to content

Instantly share code, notes, and snippets.

/optimize.diff Secret

Created August 31, 2014 23:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/60ce67f9b496e3b0b5b9 to your computer and use it in GitHub Desktop.
Save anonymous/60ce67f9b496e3b0b5b9 to your computer and use it in GitHub Desktop.
diff --git a/lib/Mojo/Template.pm b/lib/Mojo/Template.pm
index e9d1780..551e0f4 100644
--- a/lib/Mojo/Template.pm
+++ b/lib/Mojo/Template.pm
@@ -219,7 +219,9 @@ sub parse {
}
}
- push @tree, \@token;
+ push @tree, \@token and next
+ if !@tree || grep { @$_ != 2 || $_->[0] ne 'text' } $tree[-1], \@token;
+ $tree[-1][1] .= $token[1];
}
return $self;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment