diff --git a/lib/handlebars/compiler/compiler.js b/lib/handlebars/compiler/compiler.js index 3e83a62e..f823daa6 100644 --- a/lib/handlebars/compiler/compiler.js +++ b/lib/handlebars/compiler/compiler.js @@ -222,7 +222,9 @@ Compiler.prototype = { }, content: function(content) { - this.opcode('appendContent', content.string); + if (!content.omit) { + this.opcode('appendContent', content.string); + } }, mustache: function(mustache) { diff --git a/spec/blocks.js b/spec/blocks.js index 718d3168..c57a67ee 100644 --- a/spec/blocks.js +++ b/spec/blocks.js @@ -83,4 +83,15 @@ describe('blocks', function() { "No people"); }); }); + + describe('standalone sections', function() { + it('block standalone else sections', function() { + shouldCompileTo('{{#people}}\n{{name}}\n{{^}}\n{{none}}\n{{/people}}\n', {none: 'No people'}, + 'No people\n'); + shouldCompileTo('{{#none}}\n{{.}}\n{{^}}\n{{none}}\n{{/none}}\n', {none: 'No people'}, + 'No people\n'); + shouldCompileTo('\n{{#people}}\n{{name}}\n{{^}}\n{{none}}\n{{/people}}\n', {none: 'No people'}, + 'No people\n'); + }); + }); }); diff --git a/spec/regressions.js b/spec/regressions.js index 6a7990ce..dd4eedde 100644 --- a/spec/regressions.js +++ b/spec/regressions.js @@ -24,7 +24,19 @@ describe('Regressions', function() { }); it("bug reported by @fat where lambdas weren't being properly resolved", function() { - var string = "This is a slightly more complicated {{thing}}..\n{{! Just ignore this business. }}\nCheck this out:\n{{#hasThings}}\n