Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: redpie/handlebars.js
...
head fork: redpie/handlebars.js
Checking mergeability… Don't worry, you can still create the pull request.
  • 3 commits
  • 4 files changed
  • 0 commit comments
  • 3 contributors
Commits on Sep 12, 2012
@kiall kiall Update Rakefile to use a locally installed version of jison
The means root access is no longer required to build.
4b73b51
Commits on Sep 13, 2012
@wycats wycats Merge pull request #309 from redpie/use-local-jison
Update Rakefile to use jison from node
f55ca6c
tomhuda Fix repeated delimiter escaping 5a6e4f1
View
1  .gitignore
@@ -6,3 +6,4 @@ lib/handlebars/compiler/parser.js
node_modules
*.sublime-project
*.sublime-workspace
+npm-debug.log
View
6 Rakefile
@@ -2,7 +2,7 @@ require "rubygems"
require "bundler/setup"
def compile_parser
- system "jison src/handlebars.yy src/handlebars.l"
+ system "./node_modules/jison/lib/jison/cli-wrapper.js src/handlebars.yy src/handlebars.l"
if $?.success?
File.open("lib/handlebars/compiler/parser.js", "w") do |file|
file.puts File.read("handlebars.js") + ";"
@@ -15,11 +15,11 @@ def compile_parser
end
file "lib/handlebars/compiler/parser.js" => ["src/handlebars.yy","src/handlebars.l"] do
- if ENV['PATH'].split(':').any? {|folder| File.exists?(folder+'/jison')}
+ if File.exists?('./node_modules/jison/lib/jison/cli-wrapper.js')
compile_parser
else
puts "Jison is not installed. Trying `npm install jison`."
- sh "npm install jison -g"
+ sh "npm install jison"
compile_parser
end
end
View
9 spec/tokenizer_spec.rb
@@ -51,6 +51,15 @@ def tokenize(string)
result[4].should be_token("CONTENT", "{{bar}} ")
end
+ it "supports escaping multiple delimiters" do
+ result = tokenize("{{foo}} \\{{bar}} \\{{baz}}")
+ result.should match_tokens(%w(OPEN ID CLOSE CONTENT CONTENT CONTENT))
+
+ result[3].should be_token("CONTENT", " ")
+ result[4].should be_token("CONTENT", "{{bar}} ")
+ result[5].should be_token("CONTENT", "{{baz}}")
+ end
+
it "supports escaping a triple stash" do
result = tokenize("{{foo}} \\{{{bar}}} {{baz}}")
result.should match_tokens(%w(OPEN ID CLOSE CONTENT CONTENT OPEN ID CLOSE))
View
6 src/handlebars.l
@@ -11,7 +11,11 @@
[^\x00]+ { return 'CONTENT'; }
-<emu>[^\x00]{2,}?/("{{") { this.popState(); return 'CONTENT'; }
+<emu>[^\x00]{2,}?/("{{"|<<EOF>>) {
+ if(yytext.slice(-1) !== "\\") this.popState();
+ if(yytext.slice(-1) === "\\") yytext = yytext.substr(0,yyleng-1);
+ return 'CONTENT';
+ }
<mu>"{{>" { return 'OPEN_PARTIAL'; }
<mu>"{{#" { return 'OPEN_BLOCK'; }

No commit comments for this range

Something went wrong with that request. Please try again.