Closed mdelbuono closed 2 months ago
I fixed it as follows:
registerPartials(path.resolve(escapeGlob(__dirname), './partials/**/*.hbs'))
Where the escapeGlob
function is defined below:
function escapeGlob (glob) {
return glob
.replace(/\\/g, '\\\\')
.replace(/\*/g, '\\*')
.replace(/\?/g, '\\?')
.replace(/\[/g, '\\[')
.replace(/\]/g, '\\]')
.replace(/\{/g, '\\{')
.replace(/\}/g, '\\}')
.replace(/\)/g, '\\)')
.replace(/\(/g, '\\(')
.replace(/\!/g, '\\!');
}
A fix for this has been implemented and will be in the next version of dmd & jsdoc2md.. All internal partials are now cached and imported as a module at run time, removing the requirement to load each partial file on every invocation..
Closing for now, watch this space for the new version..
In
index.js
, line 92 loads the default partials as follows:The glob path gests unfolded usign
FileSet
which in turns usesglob
. The problem is that, if__dirname
contains special glob characters (e.g.[ ]
like in my case),FileSet
will fail listing all the .hbs files and no partial will be registered.Bottomline is:
__dirname
should be escaped.