Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'fix-newlines'

  • Loading branch information...
commit 14b2052b64f224504a93ef98f31f32d226748243 2 parents dcbc04f + 5fe72ae
TJ Holowaychuk tj authored
Showing with 12 additions and 7 deletions.
  1. +6 −3 lib/jade.js
  2. +6 −4 test/jade.test.js
9 lib/jade.js
View
@@ -495,7 +495,7 @@ Parser.prototype = {
},
/**
- * tag (attrs | class | id)* text? (code | block)
+ * tag (attrs | class | id)* text? newline* (code | block)
*/
parseTag: function(){
@@ -541,12 +541,15 @@ Parser.prototype = {
break out;
}
}
-
+
// text?
if (this.peek.type === 'text') {
buf.push("buf.push('" + interpolate(this.advance.val.replace(/^ */, '').replace(/'/g, "\\'")) + "');");
}
-
+
+ // newline*
+ while (this.peek.type === 'newline') this.advance;
+
// (code | block)
switch (this.peek.type) {
case 'code':
10 test/jade.test.js
View
@@ -180,12 +180,14 @@ module.exports = {
'ul',
' li a',
' ',
- ' ',
- ' ',
- ' ',
+ ' ',
+ '',
+ ' ',
' li b',
' li',
' ',
+ ' ',
+ ' ',
' ul',
' ',
' li c',
@@ -202,7 +204,7 @@ module.exports = {
'</ul>'
].join('');
- // assert.equal(html, render(str), 'Test newlines');
+ assert.equal(html, render(str));
},
'test cache': function(assert){
Please sign in to comment.
Something went wrong with that request. Please try again.