Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function generate(title, docs, filename, resolveLinks) {
resolveLinks = resolveLinks === false ? false : true;
var docData = {
filename: filename,
title: title,
docs: docs
};
var outpath = path.join(outdir, filename),
html = view.render('container.tmpl', docData);
if (resolveLinks) {
html = helper.resolveLinks(html); // turn {@link foo} into <a href="foodoc.html">foo</a>
// Add a link target for external links @davidshimjs
html = html.toString().replace(/]*href\s*=\s*['"]*[^\s'"]*:\/\/)/ig, '
if (doclet.meta) {
sourcePath = getPathFromDoclet(doclet);
sourceFiles[sourcePath] = {
resolved: sourcePath,
shortened: null
};
if (sourceFilePaths.indexOf(sourcePath) === -1) {
sourceFilePaths.push(sourcePath);
}
}
});
// update outdir if necessary, then create outdir
var packageInfo = ( find({kind: 'package'}) || [] ) [0];
if (packageInfo && packageInfo.name) {
outdir = path.join( outdir, packageInfo.name, (packageInfo.version || '') );
}
fs.mkPath(outdir);
// copy the template's static files to outdir
var fromDir = path.join(templatePath, 'static');
var staticFiles = fs.ls(fromDir, 3);
staticFiles.forEach(function(fileName) {
var toDir = fs.toDir( fileName.replace(fromDir, outdir) );
fs.mkPath(toDir);
fs.copyFileSync(fileName, toDir);
});
// copy user-specified static files to outdir
var staticFilePaths;
var staticFileFilter;
function generate( docType, title, docs, filename, resolveLinks ) {
resolveLinks = resolveLinks === false ? false : true;
var docData = {
title : title,
docs : docs,
docType : docType
};
var outpath = path.join( outdir, filename ),
html = view.render( 'container.tmpl', docData );//+JSON.stringify(docData);
if ( resolveLinks ) {
html = helper.resolveLinks( html ); // turn {@link foo} into <a href="foodoc.html">foo</a>
}
fs.writeFileSync( outpath, html, 'utf8' );
}
function getPathFromDoclet(doclet) {
if (!doclet.meta) {
return null;
}
return doclet.meta.path && doclet.meta.path !== 'null' ?
path.join(doclet.meta.path, doclet.meta.filename) :
doclet.meta.filename;
}
function getPathFromDoclet(doclet) {
if (!doclet.meta) {
return null
}
return doclet.meta.path && doclet.meta.path !== "null"
? path.join(doclet.meta.path, doclet.meta.filename)
: doclet.meta.filename
}
function getPathFromDoclet(doclet) {
if (!doclet.meta) {
return null;
}
return doclet.meta.path && doclet.meta.path !== 'null' ?
path.join(doclet.meta.path, doclet.meta.filename) :
doclet.meta.filename;
}
files.forEach(function(localFileName) {
var file = path.join(templateConf.apiJsonFolder, localFileName);
try {
var sJSON = fs.readFileSync(file, 'UTF-8');
var data = JSON.parse(sJSON);
if ( !Array.isArray(data.symbols) ) {
throw new TypeError("api.json does not contain a 'symbols' array");
}
data.symbols.forEach(function(symbol) {
debug(" adding external symbol " + symbol.name);
externalSymbols[symbol.name] = symbol;
});
} catch (e) {
error("failed to load symbols from " + file + ": " + (e.message || e));
}
});
}
function getPathFromDoclet(doclet) {
if (!doclet.meta) {
return;
}
return doclet.meta.path && doclet.meta.path !== 'null' ?
path.join(doclet.meta.path, doclet.meta.filename) :
doclet.meta.filename;
}
function getPathFromDoclet(doclet) {
if (!doclet.meta) {
return null;
}
return doclet.meta.path && doclet.meta.path !== 'null' ?
path.join(doclet.meta.path, doclet.meta.filename) :
doclet.meta.filename;
}
function getPathFromDoclet(doclet) {
if (!doclet.meta) {
return;
}
return doclet.meta.path && doclet.meta.path !== 'null' ?
path.join(doclet.meta.path, doclet.meta.filename) :
doclet.meta.filename;
}