diff options
author | kpdecker <kpdecker@gmail.com> | 2014-11-02 11:55:52 -0600 |
---|---|---|
committer | kpdecker <kpdecker@gmail.com> | 2014-11-02 11:55:52 -0600 |
commit | f30b3ea3293ad28bad8167e40b8372c48cb2419e (patch) | |
tree | f668b1950bc532b35cbbab3e78ea0e50f9e9577e /lib/handlebars/compiler/helpers.js | |
parent | 9fbf7aa753f5d48951c3f373c40f787739489962 (diff) | |
download | handlebars.js-f30b3ea3293ad28bad8167e40b8372c48cb2419e.zip handlebars.js-f30b3ea3293ad28bad8167e40b8372c48cb2419e.tar.gz handlebars.js-f30b3ea3293ad28bad8167e40b8372c48cb2419e.tar.bz2 |
Allow whitespace control on comments
This changes the call signature for the CommentNode constructor, which is a potentially breaking change for AST users.
Fixes #866
Diffstat (limited to 'lib/handlebars/compiler/helpers.js')
-rw-r--r-- | lib/handlebars/compiler/helpers.js | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/handlebars/compiler/helpers.js b/lib/handlebars/compiler/helpers.js index 758c740..20f13d6 100644 --- a/lib/handlebars/compiler/helpers.js +++ b/lib/handlebars/compiler/helpers.js @@ -7,6 +7,11 @@ export function stripFlags(open, close) { }; } +export function stripComment(comment) { + return comment.replace(/^\{\{~?\!-?-?/, '') + .replace(/-?-?~?\}\}$/, ''); +} + export function prepareBlock(mustache, program, inverseAndProgram, close, inverted, locInfo) { /*jshint -W040 */ |