jaguarjs-jsdoc
jaguarjs-jsdoc copied to clipboard
using tutorial (jsdoc -u) fails because tutorial's render object data is missing 'filename' property
Ever stumbled over something like this:
undefined:55
((__t=( filename ))==null?'':__t)+
^
ReferenceError: filename is not defined
at eval (eval at <anonymous> (/usr/lib/node_modules/jsdoc/node_modules/underscore/underscore.js:1262:16), <anonymous>:55:9)
at template (/usr/lib/node_modules/jsdoc/node_modules/underscore/underscore.js:1270:21)
at exports.Template.partial (/usr/lib/node_modules/jsdoc/lib/jsdoc/template.js:62:29)
at exports.Template.render (/usr/lib/node_modules/jsdoc/lib/jsdoc/template.js:81:24)
.....
Well, then you've been using the -u switch, eh? Problem is that the template in tmpl/layout.tmpl uses the unbound javascript variable filename, which then, per underscore.js's template documentation, requires an object passed in with a property named filename as well.
You're doing this well for the other kinds of renderings, but not for the tutorials.
I fixed the problem locally by defining a property filename with value filename (the parameter for the function generateTutorial) on the tutorialData object, in publish.js around line 490.
So, is it fixed in the newest version?
It doesn't appear this project is being maintained, however, there is a solution on SO for anyone looking.