Permalink
Browse files

Removed `inline` support

  • Loading branch information...
1 parent 74583ae commit a29568cec438dac4cc82f5f977af94a9f57e5490 @tj tj committed Aug 26, 2011
Showing with 6 additions and 23 deletions.
  1. +6 −23 lib/jade.js
View
@@ -86,16 +86,7 @@ exports.runtime = runtime;
*/
function parse(str, options){
- var filename = options.filename
- , inline = false !== options.inline
- , inlined = '';
-
- if (inline) {
- inlined += runtime.attrs.toString() + '\n';
- inlined += runtime.escape.toString() + '\n';
- } else {
- inlined = 'var attrs = jade.attrs, escape = jade.escape;\n';
- }
+ var filename = options.filename;
try {
// Parse
@@ -113,7 +104,6 @@ function parse(str, options){
try {
return ''
- + inlined
+ 'var buf = [];\n'
+ (options.self
? 'var self = locals || {}, __ = __ || locals.__;\n' + js
@@ -135,7 +125,6 @@ function parse(str, options){
* Options:
*
* - `compileDebug` when `false` debugging code is stripped from the compiled template
- * - `inline` when `false` helpers are not inlined, and `jade.<helper>` is used
*
* @param {String} str
* @param {Options} options
@@ -146,24 +135,15 @@ function parse(str, options){
exports.compile = function(str, options){
var options = options || {}
, input = JSON.stringify(str)
- , inline = false !== options.inline
, filename = options.filename
? JSON.stringify(options.filename)
: 'undefined'
- , inlined = ''
, fn;
-
- if (inline) {
- inlined = runtime.rethrow.toString();
- } else {
- inlined = 'var rethrow = jade.rethrow;';
- }
if (options.compileDebug !== false) {
// Reduce closure madness by injecting some locals
fn = [
'var __ = { lineno: 1, input: ' + input + ', filename: ' + filename + ' };'
- , inlined
, 'try {'
, parse(String(str), options || {})
, '} catch (err) {'
@@ -173,8 +153,11 @@ exports.compile = function(str, options){
} else {
fn = parse(String(str), options || {});
}
-
- return new Function('locals', fn);
+
+ fn = new Function('locals, attrs, escape, rethrow', fn);
+ return function(locals){
+ return fn(locals, runtime.attrs, runtime.escape, runtime.rethrow);
+ };
};
/**

0 comments on commit a29568c

Please sign in to comment.