Skip to content

Commit

Permalink
Made comments work without a space
Browse files Browse the repository at this point in the history
  • Loading branch information
zerious committed Jun 20, 2014
1 parent 4a7595f commit 5845d7c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
5 changes: 3 additions & 2 deletions ltl.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
var ltl = {

// Allow users to see what version of ltl they're using.
version: '0.1.10',
version: '0.1.11',

// Store all of the templates that have been compiled.
cache: {},
Expand Down Expand Up @@ -592,7 +592,8 @@
}

// If it's a comment, set a boolean so we can ignore its contents.
if (tag == '//') {
if (tag.indexOf('//') === 0) {
tag = '//';
inComment = true;
}
// If it's not a comment, we'll add some HTML.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"jade",
"dot"
],
"version": "0.1.10",
"version": "0.1.11",
"main": "ltl",
"homepage": "http://lighter.io/ltl",
"repository": "git://github.com/zerious/ltl.git",
Expand Down
8 changes: 6 additions & 2 deletions test/commentsTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,17 @@ describe('Ltl comments', function () {
it('should be omitted', function () {
var result = ltl.compile('// Comment')();
assert.equal(result, '');
var result = ltl.compile('p before\n// Comment\np after')();
result = ltl.compile('p before\n// Comment\np after')();
assert.equal(result, '<p>before</p><p>after</p>');
});
it('should be omitted as a block', function () {
var result = ltl.compile('//\n Comment')();
assert.equal(result, '');
});
it('should work without a space', function () {
var result = ltl.compile('//Comment')();
assert.equal(result, '');
});
it('should be omitted as a block with indentation', function () {
var result = ltl.compile('//\n List\n * Item 1\n * Item 2\n\n Blah\n Blah')();
assert.equal(result, '');
Expand All @@ -31,4 +35,4 @@ describe('HTML comments', function () {
var result = ltl.compile('-\n p Hide')();
assert.equal(result, '<!--<p>Hide</p>-->');
});
});
});

0 comments on commit 5845d7c

Please sign in to comment.