Permalink
Browse files

Fixed code following tag

Previously:

p foo
= "bar"

would be: <p>foobar</p>

now it is: <p>foo</p>bar
  • Loading branch information...
1 parent 3a6af00 commit 20cc34f64ff9813b5db5c6ab1680e6ff9e09cae5 @tj tj committed Aug 4, 2010
Showing with 16 additions and 16 deletions.
  1. +16 −16 lib/jade.js
View
@@ -495,7 +495,7 @@ Parser.prototype = {
},
/**
- * tag (attrs | class | id)* text? newline* (code | block)
+ * tag (attrs | class | id)* text? code? newline* block?
*/
parseTag: function(){
@@ -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

0 comments on commit 20cc34f

Please sign in to comment.