Comparing version 1.4.2 to 1.5.0
@@ -5,3 +5,3 @@ { | ||
"description": "Jade template runtime", | ||
"version": "1.4.2", | ||
"version": "1.5.0", | ||
"keywords": [ | ||
@@ -8,0 +8,0 @@ "template" |
@@ -230,4 +230,31 @@ 'use strict'; | ||
/** | ||
* Compile a `Function` representation of the given jade file. | ||
* | ||
* Options: | ||
* | ||
* - `compileDebug` when `false` debugging code is stripped from the compiled | ||
template, when it is explicitly `true`, the source code is included in | ||
the compiled template for better accuracy. | ||
* | ||
* @param {String} path | ||
* @param {Options} options | ||
* @return {Function} | ||
* @api public | ||
*/ | ||
exports.compileFile = function (path, options) { | ||
options = options || {}; | ||
var key = path + ':string'; | ||
options.filename = path; | ||
var str = options.cache | ||
? exports.cache[key] || (exports.cache[key] = fs.readFileSync(path, 'utf8')) | ||
: fs.readFileSync(path, 'utf8'); | ||
return options.cache | ||
? exports.cache[path] || (exports.cache[path] = exports.compile(str, options)) | ||
: exports.compile(str, options); | ||
}; | ||
/** | ||
@@ -234,0 +261,0 @@ * Render the given `str` of jade. |
@@ -32,2 +32,3 @@ 'use strict'; | ||
this.dependencies = []; | ||
this.inBlock = 0; | ||
}; | ||
@@ -148,3 +149,3 @@ | ||
Object.keys(this.blocks).forEach(function (name) { | ||
if (blocks.indexOf(name) === -1) { | ||
if (blocks.indexOf(name) === -1 && !this.blocks[name].isSubBlock) { | ||
console.warn('Warning: Unexpected block "' | ||
@@ -509,6 +510,11 @@ + name | ||
var line = block.line; | ||
this.inBlock++; | ||
block = 'indent' == this.peek().type | ||
? this.block() | ||
: new nodes.Block(new nodes.Literal('')); | ||
this.inBlock--; | ||
block.name = name; | ||
block.line = line; | ||
@@ -538,2 +544,4 @@ var prev = this.blocks[name] || {prepended: [], appended: []} | ||
block.isSubBlock = this.inBlock > 0; | ||
return this.blocks[name] = block; | ||
@@ -540,0 +548,0 @@ }, |
{ | ||
"name": "jade", | ||
"description": "Jade template engine", | ||
"version": "1.4.2", | ||
"version": "1.5.0", | ||
"author": "TJ Holowaychuk <tj@vision-media.ca>", | ||
@@ -6,0 +6,0 @@ "maintainers": [ |
Sorry, the diff of this file is too big to display
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
666797
17243