diff options
Diffstat (limited to 'tests/lib/jsdoc-toolkit/templates/jsdoc/publish.js')
-rw-r--r-- | tests/lib/jsdoc-toolkit/templates/jsdoc/publish.js | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/tests/lib/jsdoc-toolkit/templates/jsdoc/publish.js b/tests/lib/jsdoc-toolkit/templates/jsdoc/publish.js index 42300f4b4f..f716f1abc8 100644 --- a/tests/lib/jsdoc-toolkit/templates/jsdoc/publish.js +++ b/tests/lib/jsdoc-toolkit/templates/jsdoc/publish.js @@ -7,17 +7,17 @@ function publish(symbolSet) { symbolsDir: "symbols/", srcDir: "symbols/src/" }; - + // is source output is suppressed, just display the links to the source file if (JSDOC.opt.s && defined(Link) && Link.prototype._makeSrcLink) { Link.prototype._makeSrcLink = function(srcFilePath) { return "<"+srcFilePath+">"; } } - + // create the folders and subfolders to hold the output IO.mkPath((publish.conf.outDir+"symbols/src").split("/")); - + // used to allow Link to check the details of things being linked to Link.symbolSet = symbolSet; @@ -30,15 +30,15 @@ function publish(symbolSet) { print("Couldn't create the required templates: "+e); quit(); } - + // some ustility filters function hasNoParent($) {return ($.memberOf == "")} function isaFile($) {return ($.is("FILE"))} function isaClass($) {return ($.is("CONSTRUCTOR") || $.isNamespace)} - + // get an array version of the symbolset, useful for filtering var symbols = symbolSet.toArray(); - + // create the hilited source code files var files = JSDOC.opt.srcFiles; for (var i = 0, l = files.length; i < l; i++) { @@ -46,76 +46,76 @@ function publish(symbolSet) { var srcDir = publish.conf.outDir + "symbols/src/"; makeSrcFile(file, srcDir); } - + // get a list of all the classes in the symbolset var classes = symbols.filter(isaClass).sort(makeSortby("alias")); - + // create a filemap in which outfiles must be to be named uniquely, ignoring case if (JSDOC.opt.u) { var filemapCounts = {}; Link.filemap = {}; for (var i = 0, l = classes.length; i < l; i++) { var lcAlias = classes[i].alias.toLowerCase(); - + if (!filemapCounts[lcAlias]) filemapCounts[lcAlias] = 1; else filemapCounts[lcAlias]++; - - Link.filemap[classes[i].alias] = + + Link.filemap[classes[i].alias] = (filemapCounts[lcAlias] > 1)? lcAlias+"_"+filemapCounts[lcAlias] : lcAlias; } } - + // create a class index, displayed in the left-hand column of every class page Link.base = "../"; publish.classesIndex = classesTemplate.process(classes); // kept in memory - + // create each of the class pages for (var i = 0, l = classes.length; i < l; i++) { var symbol = classes[i]; - + symbol.events = symbol.getEvents(); // 1 order matters symbol.methods = symbol.getMethods(); // 2 - + Link.currentSymbol= symbol; var output = ""; output = classTemplate.process(symbol); - + IO.saveFile(publish.conf.outDir+"symbols/", ((JSDOC.opt.u)? Link.filemap[symbol.alias] : symbol.alias) + publish.conf.ext, output); } - + // regenerate the index with different relative links, used in the index pages Link.base = ""; publish.classesIndex = classesTemplate.process(classes); - + // create the class index page try { var classesindexTemplate = new JSDOC.JsPlate(publish.conf.templatesDir+"index.tmpl"); } catch(e) { print(e.message); quit(); } - + var classesIndex = classesindexTemplate.process(classes); IO.saveFile(publish.conf.outDir, "index"+publish.conf.ext, classesIndex); classesindexTemplate = classesIndex = classes = null; - + // create the file index page try { var fileindexTemplate = new JSDOC.JsPlate(publish.conf.templatesDir+"allfiles.tmpl"); } catch(e) { print(e.message); quit(); } - + var documentedFiles = symbols.filter(isaFile); // files that have file-level docs var allFiles = []; // not all files have file-level docs, but we need to list every one - + for (var i = 0; i < files.length; i++) { allFiles.push(new JSDOC.Symbol(files[i], [], "FILE", new JSDOC.DocComment("/** */"))); } - + for (var i = 0; i < documentedFiles.length; i++) { var offset = files.indexOf(documentedFiles[i].alias); allFiles[offset] = documentedFiles[i]; } - + allFiles = allFiles.sort(makeSortby("name")); // output the file index page @@ -153,14 +153,14 @@ function include(path) { /** Turn a raw source file into a code-hilited page in the docs. */ function makeSrcFile(path, srcDir, name) { if (JSDOC.opt.s) return; - + if (!name) { name = path.replace(/\.\.?[\\\/]/g, "").replace(/[\\\/]/g, "_"); name = name.replace(/\:/g, "_"); } - + var src = {path: path, name:name, charset: IO.encoding, hilited: ""}; - + if (defined(JSDOC.PluginManager)) { JSDOC.PluginManager.run("onPublishSrc", src); } @@ -196,6 +196,6 @@ function resolveLinks(str, from) { return new Link().toSymbol(symbolName); } ); - + return str; } |