Skip to content

Commit a2e5010

Browse files
author
Manuel Mujica
committed
Fix generated file warning source path
Closes #5
1 parent 5c1f50c commit a2e5010

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

templates/helpers.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,16 @@ module.exports = function(docMap, config, getCurrent, oldHelpers, OtherHandlebar
7979
}
8080
};
8181

82+
function getSourceFilePath(docObject) {
83+
var source = docObject.src;
84+
85+
if (typeof source === "string") {
86+
return source;
87+
} else {
88+
return source ? source.path : "";
89+
}
90+
}
91+
8292
// GENERIC HELPERS
8393
var helpers = {
8494
makeChildrenContext: function(docObject) {
@@ -156,12 +166,14 @@ module.exports = function(docMap, config, getCurrent, oldHelpers, OtherHandlebar
156166
*/
157167
generatedWarning: function(){
158168
var current = getCurrent();
169+
var source = getSourceFilePath(current);
159170

160171
return (
161172
"<!--####################################################################\n" +
162173
"\tTHIS IS A GENERATED FILE -- ANY CHANGES MADE WILL BE OVERWRITTEN\n\n" +
163174
"\tINSTEAD CHANGE:\n" +
164-
"\tsource: " + current.src + (current.type ? '\n\t@' + current.type + " " + current.name : '') +
175+
"\tsource: " + source +
176+
(current.type ? "\n\t@" + current.type + " " + current.name : "") +
165177
"\n######################################################################## -->"
166178
);
167179
},

0 commit comments

Comments
 (0)