Comparing version 0.8.4 to 0.8.5
0.8.5 / 2011-03-09 | ||
================== | ||
* Added pipe-less text support with immediate ".". Closes #157 | ||
* Fixed object support in attrs | ||
* Fixed array support for attrs | ||
0.8.4 / 2011-03-08 | ||
@@ -3,0 +10,0 @@ ================== |
@@ -20,3 +20,3 @@ | ||
exports.version = '0.8.4'; | ||
exports.version = '0.8.5'; | ||
@@ -23,0 +23,0 @@ /** |
@@ -291,3 +291,3 @@ | ||
, len = str.length | ||
, state = 'key' | ||
, states = ['key'] | ||
, key = '' | ||
@@ -297,2 +297,6 @@ , val = '' | ||
function state(){ | ||
return states[states.length - 1]; | ||
} | ||
this.consume(index + 1); | ||
@@ -305,13 +309,17 @@ tok.attrs = {}; | ||
case '\n': | ||
if ('string' == state) { | ||
val += c; | ||
} else { | ||
state = 'key'; | ||
val = val.trim(); | ||
key = key.trim(); | ||
if ('' == key) return; | ||
tok.attrs[key.replace(/^['"]|['"]$/g, '')] = '' == val | ||
? true | ||
: val; | ||
key = val = ''; | ||
switch (state()) { | ||
case 'array': | ||
case 'string': | ||
case 'object': | ||
val += c; | ||
break; | ||
default: | ||
states.push('key'); | ||
val = val.trim(); | ||
key = key.trim(); | ||
if ('' == key) return; | ||
tok.attrs[key.replace(/^['"]|['"]$/g, '')] = '' == val | ||
? true | ||
: val; | ||
key = val = ''; | ||
} | ||
@@ -321,21 +329,44 @@ break; | ||
case '=': | ||
if ('string' == state || 'val' == state) { | ||
val += c; | ||
} else { | ||
state = 'val'; | ||
switch (state()) { | ||
case 'val': | ||
case 'array': | ||
case 'string': | ||
case 'object': | ||
val += c; | ||
break; | ||
default: | ||
states.push('val'); | ||
} | ||
break; | ||
case '{': | ||
states.push('object'); | ||
val += c; | ||
break; | ||
case '}': | ||
states.pop(); | ||
val += c; | ||
break; | ||
case '[': | ||
states.push('array'); | ||
val += c; | ||
break; | ||
case ']': | ||
states.pop(); | ||
val += c; | ||
break; | ||
case '"': | ||
case "'": | ||
if ('key' == state) break; | ||
state = 'string' == state | ||
? 'val' | ||
: 'string'; | ||
if ('key' == state()) break; | ||
'string' == state() | ||
? states.pop() | ||
: states.push('string'); | ||
val += c; | ||
break; | ||
case '': | ||
break; | ||
default: | ||
switch (state) { | ||
case 'key': key += c; break; | ||
case 'val': val += c; break; | ||
case 'string': val += c; break; | ||
if ('key' == state()) { | ||
key += c; | ||
} else { | ||
val += c; | ||
} | ||
@@ -342,0 +373,0 @@ } |
@@ -362,2 +362,8 @@ | ||
// check immediate '.' | ||
if ('.' == this.peek.val) { | ||
tag.textOnly = true; | ||
this.advance; | ||
} | ||
// (text | code | ':')? | ||
@@ -387,3 +393,3 @@ switch (this.peek.type) { | ||
tag.textOnly = ~textOnly.indexOf(tag.name); | ||
tag.textOnly = tag.textOnly || ~textOnly.indexOf(tag.name); | ||
@@ -390,0 +396,0 @@ // script special-case |
{ | ||
"name": "jade", | ||
"description": "Jade template engine", | ||
"version": "0.8.4", | ||
"version": "0.8.5", | ||
"author": "TJ Holowaychuk <tj@vision-media.ca>", | ||
@@ -6,0 +6,0 @@ "main": "./index.js", |
@@ -29,3 +29,3 @@ | ||
- :cdata | ||
- :javascript | ||
- :text | ||
- :coffeescript must have [coffee-script](http://jashkenas.github.com/coffee-script/) installed | ||
@@ -190,2 +190,29 @@ - [Vim Syntax](https://github.com/digitaltoad/vim-jade) | ||
Once again as an alternative, we may use a leading '.' to indicate a text block, for example: | ||
p. | ||
foo asdf | ||
asdf | ||
asdfasdfaf | ||
asdf | ||
asd. | ||
outputs: | ||
<p>foo asdf | ||
asdf | ||
asdfasdfaf | ||
asdf | ||
asd | ||
. | ||
</p> | ||
This however differs from a leading '.' followed by a space, which although is ignored by the Jade parser, tells Jade that this period is a literal: | ||
p . | ||
outputs: | ||
<p>.</p> | ||
### Comments | ||
@@ -192,0 +219,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
67660
1787
511