diff options
author | Egil Moeller <egil.moller@freecode.no> | 2012-03-21 19:27:06 +0100 |
---|---|---|
committer | Egil Moeller <egil.moller@freecode.no> | 2012-03-21 19:27:06 +0100 |
commit | 37c0d279c1345a87413054ddb07838635110eb93 (patch) | |
tree | c4899bcc35f08aab857e430a84ee8e0dbca555a1 /src/node/eejs/index.js | |
parent | c591efb352030d2e348b2fa63fba78e722c75a62 (diff) | |
download | etherpad-lite-37c0d279c1345a87413054ddb07838635110eb93.zip |
Bugfix for when a block hook calls eejs.require recursively
Diffstat (limited to 'src/node/eejs/index.js')
-rw-r--r-- | src/node/eejs/index.js | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/node/eejs/index.js b/src/node/eejs/index.js index a16ddc80..828ab103 100644 --- a/src/node/eejs/index.js +++ b/src/node/eejs/index.js @@ -38,7 +38,7 @@ exports._init = function (b, recursive) { exports._exit = function (b, recursive) { exports.info.file_stack[exports.info.file_stack.length-1].inherit.forEach(function (item) { - exports.require(item.name, item.args); + exports._require(item.name, item.args); }); exports.info.buf = exports.info.buf_stack.pop(); } @@ -93,8 +93,6 @@ exports.inherit = function (name, args) { exports.require = function (name, args) { if (args == undefined) args = {}; - if (!exports.info) - exports.init(null); if ((name.indexOf("./") == 0 || name.indexOf("../") == 0) && exports.info.file_stack.length) { name = path.join(path.dirname(exports.info.file_stack[exports.info.file_stack.length-1].path), name); @@ -108,7 +106,9 @@ exports.require = function (name, args) { var res = ejs.render(template, args); exports.info.file_stack.pop(); - if (exports.info.buf) - exports.info.buf.push(res); return res; } + +exports._require = function (name, args) { + exports.info.buf.push(exports.require(name, args)); +} |