From 463dd0a05b8a78dc5ed8fed94416c512dea80353 Mon Sep 17 00:00:00 2001 From: Jeff Williams Date: Tue, 1 Oct 2013 09:29:08 -0700 Subject: [PATCH] generate valid filenames for incorrectly tagged modules (#458) --- lib/jsdoc/util/templateHelper.js | 29 +++++++++++++++++++------ test/specs/jsdoc/util/templateHelper.js | 19 ++++++++++++++++ 2 files changed, 41 insertions(+), 7 deletions(-) diff --git a/lib/jsdoc/util/templateHelper.js b/lib/jsdoc/util/templateHelper.js index 35a47fce..c85a5665 100644 --- a/lib/jsdoc/util/templateHelper.js +++ b/lib/jsdoc/util/templateHelper.js @@ -51,8 +51,16 @@ function makeFilenameUnique(filename, str) { return filename; } -// compute it here just once -var nsprefix = /^(event|module|external):/; +function cleanseFilename(str) { + // allow for namespace prefix + return str.replace(/^(event|module|external|package):/, '$1-') + // use - instead of ~ to denote 'inner' + .replace(/~/g, '-') + // use _ instead of # to denote 'instance' + .replace(/\#/g, '_') + // remove the variation, if any + .replace(/\([\s\S]*\)$/, ''); +} var htmlsafe = exports.htmlsafe = function(str) { return str.replace(/