angular-jsdoc
Advanced tools
Comparing version 1.2.0 to 1.2.1
@@ -12,2 +12,4 @@ /*global env: true */ | ||
var outdir = env.opts.destination; | ||
var defaultModuleName = env.opts.query && env.opts.query.module; | ||
var docFiles = env.opts.query && env.opts.query.docs.split(","); | ||
var conf = env.conf.templates || {}; //jshint ignore:line | ||
@@ -32,16 +34,2 @@ | ||
// copy the template's static files to outdir | ||
var copyStaticFiles = function() { | ||
['css', 'js', 'fonts'].forEach(function(dirName) { | ||
var fromDir = path.join(templatePath, dirName); | ||
var staticFiles = fs.ls(fromDir, 3); | ||
staticFiles.forEach(function(fileName) { | ||
var toDir = fs.toDir( fileName.replace(fromDir, path.join(outdir, dirName)) ); | ||
fs.mkPath(toDir); | ||
fs.copyFileSync(fileName, toDir); | ||
}); | ||
}); | ||
}; | ||
// get children doclets that has member of current doclet longname | ||
@@ -72,3 +60,3 @@ var getChildren = function(data, doclet) { | ||
var generate = function(filepath, data) { | ||
data.title = data.ngdoc + ":" + data.name; | ||
data.title = data.name; | ||
data.prettyJson = JSON.stringify(data,null,' '); | ||
@@ -83,2 +71,16 @@ data.basePath = __dirname; | ||
// copy the template's static files to outdir | ||
var copyStaticFiles = function() { | ||
['css', 'js', 'fonts'].forEach(function(dirName) { | ||
var fromDir = path.join(templatePath, dirName); | ||
var staticFiles = fs.ls(fromDir, 3); | ||
staticFiles.forEach(function(fileName) { | ||
var toDir = fs.toDir( fileName.replace(fromDir, path.join(outdir, dirName)) ); | ||
fs.mkPath(toDir); | ||
fs.copyFileSync(fileName, toDir); | ||
}); | ||
}); | ||
}; | ||
var generateSourceFiles = function(sourceCodes, nav) { | ||
@@ -100,3 +102,3 @@ fs.mkPath(path.join(outdir, "source")); | ||
basePath: __dirname, | ||
title: "Source:"+el.filename | ||
title: "source : "+el.filename | ||
}; | ||
@@ -123,3 +125,3 @@ var html = angularTemplate(layoutPath, data); | ||
basePath: __dirname, | ||
title: "Template: "+el.templateUrl | ||
title: "template : "+el.templateUrl | ||
}; | ||
@@ -134,2 +136,21 @@ | ||
var generateStaticDocuments = function(docs, nav) { | ||
fs.mkPath(path.join(outdir, "docs")); | ||
(docs||[]).forEach(function(el) { | ||
var outputPath = path.join(outdir, el+".html"); | ||
var markdown = require('fs').readFileSync(el, 'utf8'); | ||
var documentData = { | ||
nav: nav, | ||
readme: marked(markdown), | ||
basePath: __dirname, | ||
title: el, | ||
}; | ||
var layoutPath = path.join(templatePath, 'html', 'layout.html'); | ||
var html = angularTemplate(layoutPath, documentData); | ||
fs.writeFileSync(outputPath, html, 'utf8'); | ||
}); | ||
}; | ||
/** | ||
@@ -208,15 +229,19 @@ @param {TAFFY} taffyData See <http://taffydb.com/>. | ||
// build navigation | ||
var nav = {}; | ||
var nav = { | ||
docs: docFiles || [], | ||
module: {} | ||
}; | ||
classes.forEach(function(doclet) { | ||
var module = doclet.memberof || 'undefined'; | ||
var module = doclet.memberof || defaultModuleName; | ||
var group = doclet.ngdoc || 'undefined'; | ||
nav[module] = nav[module] || {}; | ||
nav[module][group] = nav[module][group] || {}; | ||
nav[module][group][doclet.name] = {jsDocUrl: doclet.jsDocUrl}; | ||
nav.module[module] = nav.module[module] || {}; | ||
nav.module[module][group] = nav.module[module][group] || {}; | ||
nav.module[module][group][doclet.name] = {jsDocUrl: doclet.jsDocUrl}; | ||
}); | ||
// generate source html files | ||
copyStaticFiles(); //copy static files e.g., css, js | ||
generateSourceFiles(sourceCodes, nav); //generate source file as html | ||
generateTemplateFiles(templateCodes, nav); //generate template file as html | ||
copyStaticFiles(); // copy static files e.g., css, js | ||
generateSourceFiles(sourceCodes, nav); // generate source file as html | ||
generateTemplateFiles(templateCodes, nav); // generate template file for directives | ||
generateStaticDocuments(docFiles, nav); // generate static documents | ||
@@ -223,0 +248,0 @@ // generate jsdoc html files |
{ | ||
"name": "angular-jsdoc", | ||
"version": "1.2.0", | ||
"version": "1.2.1", | ||
"description": "JsDoc Plugin and Template for AngularJs", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4732935
151
10163
7