Comparing version 1.6.0 to 1.7.0
@@ -37,2 +37,3 @@ #!/usr/bin/env node | ||
.option('--name-after-file', 'Name the template after the last section of the file path (requires --client and overriden by --name)') | ||
.option('--doctype <str>', 'Specify the doctype on the command line (useful if it is not specified by the template)') | ||
@@ -96,2 +97,6 @@ | ||
// --doctype | ||
options.doctype = program.doctype; | ||
// left-over args are file paths | ||
@@ -98,0 +103,0 @@ |
@@ -5,3 +5,3 @@ { | ||
"description": "Jade template runtime", | ||
"version": "1.6.0", | ||
"version": "1.7.0", | ||
"keywords": [ | ||
@@ -8,0 +8,0 @@ "template" |
module.exports = require('./lib/jade'); |
@@ -125,3 +125,3 @@ 'use strict'; | ||
str = JSON.stringify(str); | ||
str = utils.stringify(str); | ||
str = str.substr(1, str.length - 2); | ||
@@ -198,3 +198,3 @@ | ||
+ ', filename: ' + (node.filename | ||
? JSON.stringify(node.filename) | ||
? utils.stringify(node.filename) | ||
: 'jade_debug[0].filename') | ||
@@ -401,4 +401,15 @@ + ' });'); | ||
var mixin_start = this.buf.length; | ||
this.buf.push(name + ' = function(' + args + '){'); | ||
args = args ? args.split(',') : []; | ||
var rest; | ||
if (args.length && /^\.\.\./.test(args[args.length - 1].trim())) { | ||
rest = args.pop().trim().replace(/^\.\.\./, ''); | ||
} | ||
this.buf.push(name + ' = function(' + args.join(',') + '){'); | ||
this.buf.push('var block = (this && this.block), attributes = (this && this.attributes) || {};'); | ||
if (rest) { | ||
this.buf.push('var ' + rest + ' = [];'); | ||
this.buf.push('for (jade_interp = ' + args.length + '; jade_interp < arguments.length; jade_interp++) {'); | ||
this.buf.push(' ' + rest + '.push(arguments[jade_interp]);'); | ||
this.buf.push('}'); | ||
} | ||
this.parentIndents++; | ||
@@ -637,3 +648,3 @@ this.visit(block); | ||
} | ||
this.bufferExpression('jade.attrs(jade.merge([' + attributeBlocks.join(',') + ']), ' + JSON.stringify(this.terse) + ')'); | ||
this.bufferExpression('jade.attrs(jade.merge([' + attributeBlocks.join(',') + ']), ' + utils.stringify(this.terse) + ')'); | ||
} else if (attrs.length) { | ||
@@ -668,7 +679,7 @@ this.attrs(attrs, true); | ||
} | ||
buf.push(JSON.stringify(key) + ': ' + JSON.stringify(val)); | ||
buf.push(utils.stringify(key) + ': ' + utils.stringify(val)); | ||
} | ||
} else { | ||
if (buffer) { | ||
this.bufferExpression('jade.attr("' + key + '", ' + attr.val + ', ' + JSON.stringify(escaped) + ', ' + JSON.stringify(this.terse) + ')'); | ||
this.bufferExpression('jade.attr("' + key + '", ' + attr.val + ', ' + utils.stringify(escaped) + ', ' + utils.stringify(this.terse) + ')'); | ||
} else { | ||
@@ -681,3 +692,3 @@ var val = attr.val; | ||
} | ||
buf.push(JSON.stringify(key) + ': ' + val); | ||
buf.push(utils.stringify(key) + ': ' + val); | ||
} | ||
@@ -690,11 +701,11 @@ } | ||
} else { | ||
this.bufferExpression('jade.cls([' + classes.join(',') + '], ' + JSON.stringify(classEscaping) + ')'); | ||
this.bufferExpression('jade.cls([' + classes.join(',') + '], ' + utils.stringify(classEscaping) + ')'); | ||
} | ||
} else if (classes.length) { | ||
if (classes.every(isConstant)) { | ||
classes = JSON.stringify(runtime.joinClasses(classes.map(toConstant).map(runtime.joinClasses).map(function (cls, i) { | ||
classes = utils.stringify(runtime.joinClasses(classes.map(toConstant).map(runtime.joinClasses).map(function (cls, i) { | ||
return classEscaping[i] ? runtime.escape(cls) : cls; | ||
}))); | ||
} else { | ||
classes = '(jade_interp = ' + JSON.stringify(classEscaping) + ',' + | ||
classes = '(jade_interp = ' + utils.stringify(classEscaping) + ',' + | ||
' jade.joinClasses([' + classes.join(',') + '].map(jade.joinClasses).map(function (cls, i) {' + | ||
@@ -701,0 +712,0 @@ ' return jade_interp[i] ? jade.escape(cls) : cls' + |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -18,3 +18,4 @@ 'use strict'; | ||
, addWith = require('with') | ||
, fs = require('fs'); | ||
, fs = require('fs') | ||
, utils = require('./utils'); | ||
@@ -120,2 +121,6 @@ /** | ||
if (options.globals) { | ||
globals = options.globals.slice(); | ||
} | ||
globals.push('jade'); | ||
@@ -157,3 +162,3 @@ globals.push('jade_mixins'); | ||
, filename = options.filename | ||
? JSON.stringify(options.filename) | ||
? utils.stringify(options.filename) | ||
: 'undefined' | ||
@@ -171,3 +176,3 @@ , fn; | ||
, '} catch (err) {' | ||
, ' jade.rethrow(err, jade_debug[0].filename, jade_debug[0].lineno' + (options.compileDebug === true ? ',' + JSON.stringify(str) : '') + ');' | ||
, ' jade.rethrow(err, jade_debug[0].filename, jade_debug[0].lineno' + (options.compileDebug === true ? ',' + utils.stringify(str) : '') + ');' | ||
, '}' | ||
@@ -211,3 +216,3 @@ ].join('\n'); | ||
var name = options.name || 'template'; | ||
var filename = options.filename ? JSON.stringify(options.filename) : 'undefined'; | ||
var filename = options.filename ? utils.stringify(options.filename) : 'undefined'; | ||
var fn; | ||
@@ -224,3 +229,3 @@ | ||
, '} catch (err) {' | ||
, ' jade.rethrow(err, jade_debug[0].filename, jade_debug[0].lineno, ' + JSON.stringify(str) + ');' | ||
, ' jade.rethrow(err, jade_debug[0].filename, jade_debug[0].lineno, ' + utils.stringify(str) + ');' | ||
, '}' | ||
@@ -227,0 +232,0 @@ ].join('\n'); |
@@ -405,3 +405,3 @@ 'use strict'; | ||
if (!(captures[2] === ' ' || this.input[0] === ' ')) { | ||
throw new Error('expected space after include:filter but got ' + JSON.stringify(this.input[0])); | ||
throw new Error('expected space after include:filter but got ' + utils.stringify(this.input[0])); | ||
} | ||
@@ -408,0 +408,0 @@ captures = /^ *([^\n]+)/.exec(this.input); |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -17,2 +17,8 @@ 'use strict'; | ||
exports.stringify = function(str) { | ||
return JSON.stringify(str) | ||
.replace(/\u2028/g, '\\u2028') | ||
.replace(/\u2029/g, '\\u2029'); | ||
}; | ||
exports.walkAST = function walkAST(ast, before, after) { | ||
@@ -19,0 +25,0 @@ before && before(ast); |
{ | ||
"name": "jade", | ||
"description": "Jade template engine", | ||
"version": "1.6.0", | ||
"version": "1.7.0", | ||
"author": "TJ Holowaychuk <tj@vision-media.ca>", | ||
@@ -6,0 +6,0 @@ "maintainers": [ |
@@ -0,0 +0,0 @@ # Jade - 模板引擎 |
@@ -0,0 +0,0 @@ # [![Jade - template engine ](http://i.imgur.com/5zf2aVt.png)](http://jade-lang.com/) |
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -1,2 +0,2 @@ | ||
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.jade=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | ||
!function(e){if("object"==typeof exports)module.exports=e();else if("function"==typeof define&&define.amd)define(e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.jade=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){ | ||
'use strict'; | ||
@@ -181,3 +181,3 @@ | ||
try { | ||
str = str || require('fs').readFileSync(filename, 'utf8') | ||
str = str || _dereq_('fs').readFileSync(filename, 'utf8') | ||
} catch (ex) { | ||
@@ -207,5 +207,6 @@ rethrow(err, null, lineno) | ||
},{"fs":2}],2:[function(require,module,exports){ | ||
},{"fs":2}],2:[function(_dereq_,module,exports){ | ||
},{}]},{},[1])(1) | ||
},{}]},{},[1]) | ||
(1) | ||
}); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
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
15
640900
39
17124