Skip to content

Commit

Permalink
Fixed code following tag
Browse files Browse the repository at this point in the history
Previously:

p foo
= "bar"

would be: <p>foobar</p>

now it is: <p>foo</p>bar
  • Loading branch information
tj committed Aug 4, 2010
1 parent 3a6af00 commit 20cc34f
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions lib/jade.js
Expand Up @@ -495,7 +495,7 @@ Parser.prototype = {
},

/**
* tag (attrs | class | id)* text? newline* (code | block)
* tag (attrs | class | id)* text? code? newline* block?
*/

parseTag: function(){
Expand Down Expand Up @@ -551,24 +551,24 @@ Parser.prototype = {
+ "');");
}

// code?
if (this.peek.type === 'code') {
var tok = this.advance;
if (tok.buffer) {
buf.push('buf.push(' + (tok.escape
? 'escape(' + tok.val + ')'
: tok.val) + ');');
} else {
buf.push(tok.val + ';');
}
}

// newline*
while (this.peek.type === 'newline') this.advance;

// (code | block)
switch (this.peek.type) {
case 'code':
var tok = this.advance;
if (tok.buffer) {
buf.push('buf.push(' + (tok.escape
? 'escape(' + tok.val + ')'
: tok.val) + ');');
} else {
buf.push(tok.val + ';');
}
break;
case 'indent':
buf.push(this.parseBlock());
break;
// block?
if (this.peek.type === 'indent') {
buf.push(this.parseBlock());
}

// Build attrs
Expand Down

0 comments on commit 20cc34f

Please sign in to comment.