[Pkg-javascript-commits] [node-jade] 65/72: Add a filename property if one is available but not included

Jelmer Vernooij jelmer at moszumanska.debian.org
Sun Jul 3 18:03:32 UTC 2016


This is an automated email from the git hooks/post-receive script.

jelmer pushed a commit to annotated tag upstream/1.0.0
in repository node-jade.

commit bbb76e8b7f8fd35367b6ee4e5e9eb0ae2e81123f
Author: Timothy Gu <timothygu99 at gmail.com>
Date:   Thu Nov 12 17:18:12 2015 -0800

    Add a filename property if one is available but not included
---
 index.js | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/index.js b/index.js
index e35376d..0b3e9e4 100644
--- a/index.js
+++ b/index.js
@@ -173,6 +173,8 @@ Transformer.prototype.compileFile = function (filename, options) {
       return tr.normalize(this._tr.renderFile(filename, options, locals)).body;
     }.bind(this));
   } else { // render || compile
+    if (!options) options = {};
+    if (options.filename === undefined) options.filename = filename;
     return this.compile(tr.readFileSync(filename, 'utf8'), options);
   }
 };
@@ -185,6 +187,8 @@ Transformer.prototype.compileFileAsync = function (filename, options, cb) {
   } else if (this._hasMethod('compileFile') || this._hasMethod('renderFile')) {
     return tr.normalizeFnAsync(this.compileFile(filename, options), cb);
   } else { // compileAsync || compile || render
+    if (!options) options = {};
+    if (options.filename === undefined) options.filename = filename;
     return tr.normalizeFnAsync(tr.readFile(filename, 'utf8').then(function (str) {
       if (this._hasMethod('compileAsync')) {
         return this._tr.compileAsync(str, options);
@@ -235,6 +239,8 @@ Transformer.prototype.compileFileClient = function (filename, options) {
   if (this._hasMethod('compileFileClient')) {
     return tr.normalize(this._tr.compileFileClient(filename, options));
   } else {
+    if (!options) options = {};
+    if (options.filename === undefined) options.filename = filename;
     return tr.normalize(this._tr.compileClient(tr.readFileSync(filename, 'utf8'), options));
   }
 };
@@ -247,6 +253,8 @@ Transformer.prototype.compileFileClientAsync = function (filename, options, cb)
   } else if (this._hasMethod('compileFileClient')) {
     return tr.normalizeAsync(this._tr.compileFileClient(filename, options), cb);
   } else {
+    if (!options) options = {};
+    if (options.filename === undefined) options.filename = filename;
     return tr.normalizeAsync(tr.readFile(filename, 'utf8').then(function (str) {
       if (this._hasMethod('compileClientAsync')) {
         return this._tr.compileClientAsync(str, options);
@@ -310,6 +318,8 @@ Transformer.prototype.renderFile = function (filename, options, locals) {
   if (this._hasMethod('renderFile')) {
     return tr.normalize(this._tr.renderFile(filename, options, locals));
   } else if (this._hasMethod('render')) {
+    if (!options) options = {};
+    if (options.filename === undefined) options.filename = filename;
     return tr.normalize(this._tr.render(tr.readFileSync(filename, 'utf8'), options, locals));
   } else { // compile || compileFile
     var compiled = this.compileFile(filename, options);
@@ -335,6 +345,8 @@ Transformer.prototype.renderFileAsync = function (filename, options, locals, cb)
       return {body: compiled.fn(locals || options), dependencies: compiled.dependencies};
     }), cb);
   } else { // render || renderAsync
+    if (!options) options = {};
+    if (options.filename === undefined) options.filename = filename;
     return tr.normalizeAsync(tr.readFile(filename, 'utf8').then(function (str) {
       return this.renderAsync(str, options, locals);
     }.bind(this)), cb);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-jade.git



More information about the Pkg-javascript-commits mailing list