Fix a number of outstanding issues:
* {{}} escape their contents, {{{}}} and {{& }} do not
* Add support in the parser, tokenizer and AST for partials
with context (support is still not there in the runtime)
* Fix some inconsistencies with the old behavior involving
the correct printing of null and undefined
* Add Handlebars.Exception
* Fixed an issue involving ./foo and this/foo
* Fleshed out helperMissing in the specs (this will be
moved out into handlebars proper once registerHelper
and registerPartial are added)
This commit is contained in:
+12
-2
@@ -64,8 +64,10 @@ describe "Parser" do
|
||||
pad("{{ #{id} [#{params.join(", ")}] }}")
|
||||
end
|
||||
|
||||
def partial(id)
|
||||
pad("{{> #{id} }}")
|
||||
def partial(id, context = nil)
|
||||
content = id.dup
|
||||
content << " #{context}" if context
|
||||
pad("{{> #{content} }}")
|
||||
end
|
||||
|
||||
def comment(comment)
|
||||
@@ -97,6 +99,10 @@ describe "Parser" do
|
||||
ast_for("{{foo/bar}}").should == program { mustache path("foo", "bar") }
|
||||
end
|
||||
|
||||
it "parses mustaches with this/foo" do
|
||||
ast_for("{{this/foo}}").should == program { mustache id("foo") }
|
||||
end
|
||||
|
||||
it "parses mustaches with parameters" do
|
||||
ast_for("{{foo bar}}").should == program { mustache id("foo"), id("bar") }
|
||||
end
|
||||
@@ -116,6 +122,10 @@ describe "Parser" do
|
||||
ast_for("{{> foo }}").should == program { partial id("foo") }
|
||||
end
|
||||
|
||||
it "parses a partial with context" do
|
||||
ast_for("{{> foo bar}}").should == program { partial id("foo"), id("bar") }
|
||||
end
|
||||
|
||||
it "parses a comment" do
|
||||
ast_for("{{! this is a comment }}").should == program do
|
||||
comment " this is a comment "
|
||||
|
||||
Reference in New Issue
Block a user