Socket
Socket
Sign inDemoInstall

jade

Package Overview
Dependencies
Maintainers
0
Versions
131
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jade - npm Package Compare versions

Comparing version 0.7.1 to 0.8.0

6

History.md
0.8.0 / 2011-03-04
==================
* Added block-expansion support. Closes #74
* Added support for multi-line attrs without commas. Closes #65
0.7.1 / 2011-03-04

@@ -3,0 +9,0 @@ ==================

2

lib/jade.js

@@ -20,3 +20,3 @@

exports.version = '0.7.1';
exports.version = '0.8.0';

@@ -23,0 +23,0 @@ /**

@@ -193,3 +193,16 @@

get tag() {
return this.scan(/^(\w[-:\w]*)/, 'tag');
var captures;
if (captures = /^(\w[-:\w]*)/.exec(this.input)) {
this.consume(captures[0].length);
var tok, name = captures[1];
if (':' == name[name.length - 1]) {
name = name.slice(0, -1);
tok = this.tok('tag', name);
this.deferredTokens.push(this.tok(':'));
while (' ' == this.input[0]) this.input = this.input.substr(1);
} else {
tok = this.tok('tag', name);
}
return tok;
}
},

@@ -290,2 +303,3 @@

case ',':
case '\n':
if ('string' == state) {

@@ -296,3 +310,5 @@ val += c;

val = val.trim();
tok.attrs[key.trim().replace(/^['"]|['"]$/g, '')] = '' == val
key = key.trim();
if ('' == key) return;
tok.attrs[key.replace(/^['"]|['"]$/g, '')] = '' == val
? true

@@ -415,2 +431,10 @@ : val;

/**
* ':'
*/
get colon() {
return this.scan(/^: */, ':');
},
/**
* Return the next token object, or those

@@ -450,4 +474,5 @@ * previously stashed by lookahead.

|| this.blockComment
|| this.colon
|| this.text;
}
};

@@ -330,3 +330,3 @@

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

@@ -363,3 +363,3 @@

// (text | code)?
// (text | code | ':')?
switch (this.peek.type) {

@@ -372,2 +372,7 @@ case 'text':

break;
case ':':
this.advance;
tag.block = new nodes.Block;
tag.block.push(this.parseTag());
break;
}

@@ -374,0 +379,0 @@

{
"name": "jade",
"description": "Jade template engine",
"version": "0.7.1",
"version": "0.8.0",
"author": "TJ Holowaychuk <tj@vision-media.ca>",

@@ -6,0 +6,0 @@ "main": "./index.js",

@@ -12,2 +12,3 @@

- flexible indentation
- block-expansion
- code is escaped by default for security

@@ -251,22 +252,23 @@ - contextual error reporting at compile &amp; run time

Jade supports nesting to define the tags in a natural way:
ul
li one
li two
li three
li.first
a(href='#') foo
li
a(href='#') bar
li.last
a(href='#') baz
Messed up your whitespace? no worries, jade's error reporting should help you out.
Jade instruments the compiled JavaScript to provide meaningful context for runtime exceptions.
### Block Expansion
ul
li one
li two
Block expansion allows you to create terse single-line nested tags,
the following example is equivalent to the nesting example above.
Error: /Users/tj/Projects/jade/examples/layout.jade:2
1. 'ul'
2. ' li one'
ul
li.first: a(href='#') foo
li: a(href='#') bar
li.last: a(href='#') baz
Invalid indentation, got 2 expected 1.
Note: Trailing outdents are generated on **EOS** (end-of-source) if not present.
### Attributes

@@ -290,4 +292,8 @@

Note: Leading / trailing whitespace is _ignored_ for attr pairs.
Multiple lines work too:
input(type='checkbox',
name='agreement',
checked)
### Doctypes

@@ -294,0 +300,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc