From 73f811203200ec96b7a396151327089c39fe37a3 Mon Sep 17 00:00:00 2001 From: Pete Bacon Darwin Date: Tue, 25 Jun 2013 21:17:36 +0100 Subject: fix(doc-gen): correctly transform index files Closes #3021 --- docs/src/writer.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'docs/src') diff --git a/docs/src/writer.js b/docs/src/writer.js index c9089be0..cdfa12d6 100644 --- a/docs/src/writer.js +++ b/docs/src/writer.js @@ -51,13 +51,19 @@ exports.copyTemplate = function(filename) { * @param transform{function=} transfromation function to be applied before return */ exports.copy = function(from, to, transform) { + var transformArgs = Array.prototype.slice.call(arguments, 3); + from = pathUtils.normalize(from); to = pathUtils.normalize(to); // We have to use binary reading, Since some characters are unicode. return qfs.read(from, 'b').then(function(content) { if (transform) { - content = transform.call(null, content.toString(), from, to, transform); + // Pass any extra arguments, e.g. + // `copy(from, to, transform, extra1, extra2, ...)` + // to the transform function + transformArgs.unshift(content.toString()); + content = transform.apply(null, transformArgs); } return output(to, content); }); -- cgit v1.2.3