From 052655a523048d1d08c4029f0d18b3c9a6c92b9d Mon Sep 17 00:00:00 2001 From: Taka Kojima Date: Wed, 14 Dec 2011 19:02:35 -0800 Subject: [PATCH 01/20] Update README.txt --- README.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.txt b/README.txt index 883d863..d8e82ff 100644 --- a/README.txt +++ b/README.txt @@ -1,3 +1,6 @@ + +This fork just updates package.json to use node >= 04.10, publishes as a new npm package "json-toolkit" + ====================================================================== DESCRIPTION: From bf00d849c2ffba4e2385f833b22a4b82bd079b41 Mon Sep 17 00:00:00 2001 From: Taka Kojima Date: Wed, 14 Dec 2011 19:04:01 -0800 Subject: [PATCH 02/20] Update package.json --- package.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index bb0cb45..68d861f 100644 --- a/package.json +++ b/package.json @@ -1,12 +1,12 @@ { - "author": "Kaleb Hornsby (kaleb.hornsby.ws)", - "name": "jsdoc", + "author": "Taka Kojima (taka@gigafied.com)", + "name": "jsdoc-toolkit", "description": "JSDoc Toolkit", "version": "0.0.1", "homepage": "kaleb.hornsby.ws/jsdoc", "repository": { "type": "git", - "url": "git://github.com/kaleb/node-jsdoc-toolkit.git" + "url": "git://github.com/gigafied/node-jsdoc-toolkit.git" }, "main": "app/run.js", "scripts": { From bfdae5095560bb630c16ccfe0c910e0f9afa4145 Mon Sep 17 00:00:00 2001 From: Taka Kojima Date: Fri, 16 Dec 2011 15:01:01 -0800 Subject: [PATCH 03/20] Update README.txt --- README.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.txt b/README.txt index d8e82ff..859f7b0 100644 --- a/README.txt +++ b/README.txt @@ -1,5 +1,4 @@ - -This fork just updates package.json to use node >= 04.10, publishes as a new npm package "json-toolkit" +This fork just updates package.json to use node >= 04.10, publishes as a new npm package "jsdoc-toolkit" ====================================================================== From 57b571e51fc3697378bbc6cb50d2ede460d1ab33 Mon Sep 17 00:00:00 2001 From: Taka Kojima Date: Fri, 6 Jan 2012 10:58:38 -0800 Subject: [PATCH 04/20] oopsies, published to npm without actual committing to github --- app/run.js | 2 +- package.json | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/run.js b/app/run.js index fe0a3e2..2f59149 100755 --- a/app/run.js +++ b/app/run.js @@ -10,7 +10,7 @@ // load the node.js libraries to be abstracted var fs = require('fs'); var path = require('path'); -var Script = process.binding('evals').Script; +var Script = require('vm').Script; // define a few globals to be compatible with jsrun.jar global.arguments = global.internal_args || process.argv.slice(2); diff --git a/package.json b/package.json index 68d861f..03e0372 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "author": "Taka Kojima (taka@gigafied.com)", "name": "jsdoc-toolkit", "description": "JSDoc Toolkit", - "version": "0.0.1", + "version": "0.0.2", "homepage": "kaleb.hornsby.ws/jsdoc", "repository": { "type": "git", @@ -13,8 +13,8 @@ "test": "app/test.js" }, "engines": { - "node": "0.4" + "node": ">= 0.4" }, "dependencies": {}, "devDependencies": {} -} \ No newline at end of file +} From ae83cb529a736537454606df30545bd4fabe8087 Mon Sep 17 00:00:00 2001 From: Matthew Kastor Date: Sat, 14 Sep 2013 20:37:54 -0400 Subject: [PATCH 05/20] fixes -o (output logs), bin, and module usage requiring this as a module did nothing because there was no way to specify args, that is fixed now. node modules with a command line interface should have a bin field in the package.json file so node can create a shortcut in the node_modules/.bin directory for end user ease of use. That happens now. when specifying -o option on the command line node-jsdoc-toolkit would not output a log file, it would throw an error. Fixing this required a shim for java.io.FileWriter class whose instance would be returned from IO.open. That is done and the output log works now. --- README.txt | 65 ++++++++++++++++++++++++++++++++++++----------- app/noderun.js | 2 +- app/run.js | 69 +++++++++++++++++++++++++++++++++++++++++++++++--- changes.txt | 5 ++++ package.json | 14 +++++++--- 5 files changed, 132 insertions(+), 23 deletions(-) diff --git a/README.txt b/README.txt index 859f7b0..491dabc 100644 --- a/README.txt +++ b/README.txt @@ -28,28 +28,63 @@ Node.JS interpreter http://nodejs.org ====================================================================== +INSTALLATION: + +`npm install jsdoc-toolkit` + +or, you can install it globally and have it available for all your projects. + +`npm install jsdoc-toolkit -g` + +Make sure to add your global `node_modules/.bin` directory to your path for +convenient access to your global packages from the command line. + +====================================================================== + USAGE: -Before running the JsDoc Toolkit app you should change your current -working directory to the jsdoc-toolkit folder. Then follow the -examples below, or as shown on the project wiki. +From Scripts: + +This module exports jsdoctoolkit, it has a run method that accepts a single +argument: an array of strings corresponding to the exact command line arguments +you would use, in the same order as you would give them on the command line. + +``` +var jsdocToolkit = require('jsdoc-toolkit').jsdoctoolkit; + +jsdocToolkit.run(['--help']); +``` + +``` +var jsdocToolkit = require('jsdoc-toolkit').jsdoctoolkit; +var argz = [ + "-d=./docs/", // output directory for documentation. + "-o=./jsdoc-toolkit-log.txt" // file for logging messages like warnings. + "cli.js" // the file or directory to generate documentation for. +]; +jsdocToolkit.run(argz); +``` + +Command line: + +Given a file named mycode.js that you want documented: + +if you've installed this package globally it's as easy as running -On Mac OS X or Linux the command would look like this: +`jsdoc-toolkit -a mycode.js` -$ app/run.js -a -t=templates/jsdoc mycode.js +If you have installed jsdoc-toolkit into your package instead, from the package +root run -The above assumes your current working directory contains the "app" -and "templates" subdirectories from the standard JsDoc Toolkit -distribution and that the relative path to the code you wish to -document is "mycode.js". +`node_modules/.bin/jsdoc-toolkit -a mycode.js` -The output documentation files will be saved to a new directory named -"out" (by default) in the current directory, or if you specify a --d=somewhere_else option, to the somewhere_else directory. +In both cases the output documentation files will be saved to a new directory +named "out" (by default) in the current directory, or if you specify a +`-d=somewhere_else` option, to the somewhere_else directory. For help (usage notes) enter this on the command line: -$ app/run.js --help +`jsdoc-toolkit --help` More information about the various command line options used by JsDoc Toolkit are available on the project wiki. @@ -61,12 +96,12 @@ TESTING: To run the suite of unit tests included with JsDoc Toolkit enter this on the command line: -$ app/run.js -T +jsdoc-toolkit -T To see a dump of the internal data structure that JsDoc Toolkit has built from your source files use this command: -$ app/run.js mycode.js -Z +jsdoc-toolkit mycode.js -Z ====================================================================== diff --git a/app/noderun.js b/app/noderun.js index ae070fb..2f017a7 100755 --- a/app/noderun.js +++ b/app/noderun.js @@ -1,4 +1,4 @@ #!/usr/bin/env node var toolkit = require("./nodemodule").jsdoctoolkit; -toolkit.run(process.argv); +toolkit.run(process.argv.slice(2)); diff --git a/app/run.js b/app/run.js index 2f59149..6e5965e 100755 --- a/app/run.js +++ b/app/run.js @@ -133,7 +133,68 @@ SYS.slash = "/"; */ SYS.pwd = __dirname+SYS.slash; - +/** + * Shims java.io.FileWriter + */ +FileWriter = function () { + this.lock = undefined; + this.writeStream = undefined; +}; +/** + * Opens a file for writing only. + * @param {String} path The path to the file to write. + * @param {Boolean} [append = true] If set to false the file will be overwritten. + * @returns {FileWriter} returns a new FileWriter instance whose writeStream is + * set to the file at the given path. + * @see + * fs.WriteStream + */ +FileWriter.prototype.open = function(/**string*/ path, /**boolean*/ append) { + if(append == null) append = true; + this.writeStream = fs.createWriteStream(path, {flags: (append ? "a" : "w")}); + return this; +}; +/** + * Closes the write stream. + */ +FileWriter.prototype.close = function () { + this.writeStream.end(); +}; +/** + * No op. The data is flushed when close is called. + */ +FileWriter.prototype.flush = function () { + // no op, data is flushed when the writeStream's end + // method is called. +}; +/** + * Write stream is created with default encoding (utf8). If the open method is + * changed to allow specifying an encoding then it will need to be tracked and + * returned by this method. + * @returns "utf8" + */ +FileWriter.prototype.getEncoding = function () { + return "utf8"; +}; +/** + * Appends a substring of the given string to the file. + * @param {String} str The string to write. + * @param {Number} [from = 0] The beginning of the substring of str. + * @param {Number} [to = str.length] The end of the substring of str. + */ +FileWriter.prototype.append = function (str, from, to) { + from = from || 0; + to = to || str.length; + str = str.substr(from, to); + this.write(str, 'utf8'); +}; +/** + * Writes the given data to the file. + * @param {String} str The string to write. + */ +FileWriter.prototype.write = function (str) { + this.writeStream.write(str, 'utf8'); +}; /** * @namespace A collection of functions that deal with reading a writing to disk. */ @@ -239,11 +300,11 @@ IO = { }, /** - * + * Opens a file for writing */ open: function(/**string*/ path, /**boolean*/ append) { - if(append == null) append = true; - return fs.createWriteStream(path, {flags: (append ? "a" : "w")}); + var file = new FileWriter(); + return file.open(path, append); }, /** diff --git a/changes.txt b/changes.txt index 38361af..bcc8650 100644 --- a/changes.txt +++ b/changes.txt @@ -1,3 +1,8 @@ +== 2.4.0n1 == + * Fixes logging to files. It works now. + * Creates files in `node_modules/.bin` so global installs just work. + * Now wrapped properly so jsdoc-toolkit can be called from scripts in node. + == 2.4.0n == * Ported to run on Node.JS diff --git a/package.json b/package.json index 03e0372..7fb890d 100644 --- a/package.json +++ b/package.json @@ -1,16 +1,24 @@ { "author": "Taka Kojima (taka@gigafied.com)", + "contributors" : [ + { + "name" : "Matthew Kastor", + "email" : "matthewkastor@gmail.com", + "url" : "http://matthewkastor.blogspot.com" + } + ], "name": "jsdoc-toolkit", "description": "JSDoc Toolkit", - "version": "0.0.2", + "version": "2.4.0n1", "homepage": "kaleb.hornsby.ws/jsdoc", "repository": { "type": "git", "url": "git://github.com/gigafied/node-jsdoc-toolkit.git" }, - "main": "app/run.js", + "main": "app/nodemodule.js", + "bin": "app/noderun.js", "scripts": { - "test": "app/test.js" + "test": "node app/test.js" }, "engines": { "node": ">= 0.4" From 0c494c47d9fe74e7d67a565fedb6e921022b02e3 Mon Sep 17 00:00:00 2001 From: Matthew Kastor Date: Sat, 14 Sep 2013 20:39:50 -0400 Subject: [PATCH 06/20] signing my work --- app/run.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/run.js b/app/run.js index 6e5965e..8c5e624 100755 --- a/app/run.js +++ b/app/run.js @@ -135,6 +135,8 @@ SYS.pwd = __dirname+SYS.slash; /** * Shims java.io.FileWriter + * @class Shims java.io.FileWriter + * @author Matthew Kastor */ FileWriter = function () { this.lock = undefined; From 73adf864a07f2abff34006e1853889bfbd0034c8 Mon Sep 17 00:00:00 2001 From: Matthew Kastor Date: Sat, 14 Sep 2013 20:52:22 -0400 Subject: [PATCH 07/20] fixes tests node modules with tests should include a scripts.test field that will execute their test suite. This will allow users to run the tests with npm by running npm test. This fixes that. --- README.txt | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.txt b/README.txt index 491dabc..acb480d 100644 --- a/README.txt +++ b/README.txt @@ -96,7 +96,7 @@ TESTING: To run the suite of unit tests included with JsDoc Toolkit enter this on the command line: -jsdoc-toolkit -T +npm test To see a dump of the internal data structure that JsDoc Toolkit has built from your source files use this command: diff --git a/package.json b/package.json index 7fb890d..21a936d 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ "main": "app/nodemodule.js", "bin": "app/noderun.js", "scripts": { - "test": "node app/test.js" + "test": "node app/run.js -T" }, "engines": { "node": ">= 0.4" From bbd343477035981bec22f9313c231058fd14f75d Mon Sep 17 00:00:00 2001 From: Matthew Kastor Date: Sat, 14 Sep 2013 21:04:38 -0400 Subject: [PATCH 08/20] added note to changes.txt --- changes.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/changes.txt b/changes.txt index bcc8650..abc9b8a 100644 --- a/changes.txt +++ b/changes.txt @@ -2,6 +2,7 @@ * Fixes logging to files. It works now. * Creates files in `node_modules/.bin` so global installs just work. * Now wrapped properly so jsdoc-toolkit can be called from scripts in node. + * Fixed scripts.test field so npm test works. == 2.4.0n == * Ported to run on Node.JS From c86536949fc61a5d9b47fd0e2bb1e63f4b4574c6 Mon Sep 17 00:00:00 2001 From: Matthew Kastor Date: Sat, 14 Sep 2013 21:15:19 -0400 Subject: [PATCH 09/20] fixes usage message runs on node, no java required --- app/lib/JSDOC.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/lib/JSDOC.js b/app/lib/JSDOC.js index 5de7b9e..65ae925 100644 --- a/app/lib/JSDOC.js +++ b/app/lib/JSDOC.js @@ -48,7 +48,7 @@ JSDOC.VERSION = "2.4.0"; /** Print out usage information and quit. */ JSDOC.usage = function() { - print("USAGE: java -jar jsrun.jar app/run.js [OPTIONS] ..."); + print("USAGE: node app/run.js [OPTIONS] ..."); print(""); print("OPTIONS:"); print(" -a or --allfunctions\n Include all functions, even undocumented ones.\n"); From 6de63d8a0d05be92c54f6bf852750ab3fceb9ddf Mon Sep 17 00:00:00 2001 From: Matthew Kastor Date: Sat, 14 Sep 2013 21:20:55 -0400 Subject: [PATCH 10/20] path.existsSync now fs.existsSync --- app/run.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/run.js b/app/run.js index 8c5e624..af6c9aa 100755 --- a/app/run.js +++ b/app/run.js @@ -225,7 +225,7 @@ IO = { if (fileName == null) fileName = FilePath.fileName(inFile); inFile = path.normalize(inFile); outFile = path.normalize(outDir + "/" + fileName); - if (!path.existsSync(inFile)) { + if (!fs.existsSync(inFile)) { // Could not find file to copy, ignoring: ' + inFile // Should we log or safe to ignore? return; From c68a9207c334fb4cecdf4f93051eba1534e43f81 Mon Sep 17 00:00:00 2001 From: Matthew Kastor Date: Sat, 14 Sep 2013 23:25:07 -0400 Subject: [PATCH 11/20] simplifying --- app/main.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/main.js b/app/main.js index 475e2b7..d71af4d 100644 --- a/app/main.js +++ b/app/main.js @@ -44,9 +44,8 @@ function main() { } else { // a template must be defined and must be a directory path - if (!JSDOC.opt.t && process.env.JSDOCTEMPLATEDIR) { - JSDOC.opt.t = process.env.JSDOCTEMPLATEDIR; - } + JSDOC.opt.t = JSDOC.opt.t || process.env.JSDOCTEMPLATEDIR; + // adds trailing slash to template dir if not present if (JSDOC.opt.t && SYS.slash != JSDOC.opt.t.slice(-1)) { JSDOC.opt.t += SYS.slash; } From c4f5b9eb27ecb6fb0cdba34c17706b3b7266bcaf Mon Sep 17 00:00:00 2001 From: Matthew Kastor Date: Sat, 14 Sep 2013 23:26:38 -0400 Subject: [PATCH 12/20] jsdoc template is default if none specified. It's just silly not to have a default template. --- app/run.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/run.js b/app/run.js index af6c9aa..6f1281f 100755 --- a/app/run.js +++ b/app/run.js @@ -12,6 +12,9 @@ var fs = require('fs'); var path = require('path'); var Script = require('vm').Script; +// default template directory. +process.env.JSDOCTEMPLATEDIR = path.resolve(__dirname, '../templates/jsdoc/'); + // define a few globals to be compatible with jsrun.jar global.arguments = global.internal_args || process.argv.slice(2); load = function(file) { From 58b994d6396306de1f8e9c7375988ebfdb4dbd70 Mon Sep 17 00:00:00 2001 From: Matthew Kastor Date: Sat, 14 Sep 2013 23:28:27 -0400 Subject: [PATCH 13/20] added note to changes.txt --- changes.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/changes.txt b/changes.txt index abc9b8a..1c224d1 100644 --- a/changes.txt +++ b/changes.txt @@ -3,6 +3,7 @@ * Creates files in `node_modules/.bin` so global installs just work. * Now wrapped properly so jsdoc-toolkit can be called from scripts in node. * Fixed scripts.test field so npm test works. + * jsdoc template is now the default so you don't have to specify it every time you use it. == 2.4.0n == * Ported to run on Node.JS From 7f6dff6769b368a593c8679ff94625f8b53b1694 Mon Sep 17 00:00:00 2001 From: Matthew Kastor Date: Sun, 2 Feb 2014 18:11:46 -0500 Subject: [PATCH 14/20] adds vsdoc template --- templates/vsdoc/allclasses.tmpl | 17 + templates/vsdoc/allfiles.tmpl | 56 +++ templates/vsdoc/class.tmpl | 649 ++++++++++++++++++++++++++ templates/vsdoc/index.tmpl | 39 ++ templates/vsdoc/publish.js | 258 ++++++++++ templates/vsdoc/static/default.css | 162 +++++++ templates/vsdoc/static/header.html | 2 + templates/vsdoc/static/index.html | 19 + templates/vsdoc/symbol.tmpl | 51 ++ templates/vsdoc/vsdoc-all.tmpl | 4 + templates/vsdoc/vsdoc-class.tmpl | 31 ++ templates/vsdoc/vsdoc-methods.tmpl | 10 + templates/vsdoc/vsdoc-ns.tmpl | 27 ++ templates/vsdoc/vsdoc-references.tmpl | 2 + 14 files changed, 1327 insertions(+) create mode 100644 templates/vsdoc/allclasses.tmpl create mode 100644 templates/vsdoc/allfiles.tmpl create mode 100644 templates/vsdoc/class.tmpl create mode 100644 templates/vsdoc/index.tmpl create mode 100644 templates/vsdoc/publish.js create mode 100644 templates/vsdoc/static/default.css create mode 100644 templates/vsdoc/static/header.html create mode 100644 templates/vsdoc/static/index.html create mode 100644 templates/vsdoc/symbol.tmpl create mode 100644 templates/vsdoc/vsdoc-all.tmpl create mode 100644 templates/vsdoc/vsdoc-class.tmpl create mode 100644 templates/vsdoc/vsdoc-methods.tmpl create mode 100644 templates/vsdoc/vsdoc-ns.tmpl create mode 100644 templates/vsdoc/vsdoc-references.tmpl diff --git a/templates/vsdoc/allclasses.tmpl b/templates/vsdoc/allclasses.tmpl new file mode 100644 index 0000000..32f4358 --- /dev/null +++ b/templates/vsdoc/allclasses.tmpl @@ -0,0 +1,17 @@ +
{+new Link().toFile("index.html").withText("Class Index")+} +| {+new Link().toFile("files.html").withText("File Index")+}
+
+

Classes

+
    + +
  • {! + if (thisClass.alias == "_global_") { + output += ""+new Link().toClass(thisClass.alias)+""; + } + else { + output += new Link().toClass(thisClass.alias); + } + !}
  • +
    +
+
\ No newline at end of file diff --git a/templates/vsdoc/allfiles.tmpl b/templates/vsdoc/allfiles.tmpl new file mode 100644 index 0000000..4c7de1c --- /dev/null +++ b/templates/vsdoc/allfiles.tmpl @@ -0,0 +1,56 @@ + + + + + {! Link.base = ""; /* all generated links will be relative to this */ !} + JsDoc Reference - File Index + + + + + + + {+include("static/header.html")+} + +
+ {+publish.classesIndex+} +
+ +
+

File Index

+ + +
+

{+new Link().toSrc(item.alias).withText(item.name)+}

+ {+resolveLinks(item.desc)+} +
+ +
Author:
+
{+item.author+}
+
+ +
Version:
+
{+item.version+}
+
+ {! var locations = item.comment.getTag('location').map(function($){return $.toString().replace(/(^\$ ?| ?\$$)/g, '').replace(/^HeadURL: https:/g, 'http:');}) !} + +
Location:
+ +
{+location+}
+
+
+
+
+
+
+ +
+
+ ©{+JSDOC.opt.D.copyright+}
+ Documentation generated by JsDoc Toolkit {+JSDOC.VERSION+} on {+new Date()+} +
+ + \ No newline at end of file diff --git a/templates/vsdoc/class.tmpl b/templates/vsdoc/class.tmpl new file mode 100644 index 0000000..0507bba --- /dev/null +++ b/templates/vsdoc/class.tmpl @@ -0,0 +1,649 @@ + + + + + + {! Link.base = "../"; /* all generated links will be relative to this */ !} + JsDoc Reference - {+data.alias+} + + + + + + + + {+include("static/header.html")+} + + + +
+ + {+publish.classesIndex+} + +
+ +
+ +

+ {! + var classType = ""; + + if (data.isBuiltin()) { + classType += "Built-In "; + } + + if (data.isNamespace) { + if (data.is('FUNCTION')) { + classType += "Function "; + } + classType += "Namespace "; + } + else { + classType += "Class "; + } + !} + {+classType+}{+data.alias+} +

+ + +

+
Version + {+ data.version +}.
+
+
Extends + {+ + data.augments + .sort() + .map( + function($) { return new Link().toSymbol($); } + ) + .join(", ") + +}.
+
+ + {+resolveLinks(data.classDesc)+} + + {# isn't defined in any file #} +
Defined in: {+new Link().toSrc(data.srcFile)+}. +
+

+ + + + + + + + + + + + + + + + + +
{+classType+}Summary
Constructor AttributesConstructor Name and Description
{! + if (data.isPrivate) output += "<private> "; + if (data.isInner) output += "<inner> "; + !}  +
+ {+ new Link().toSymbol(data.alias).inner('constructor')+}{+ makeSignature(data.params) +} +
+
{+resolveLinks(summarize(data.comment.getTag("constructs").toString()))+}
+
+
+ + + + {! var ownProperties = data.properties.filter(function($){return $.memberOf == data.alias && !$.isNamespace}).sort(makeSortby("name")); !} + + + + + + + + + + + + + + + + + +
Field Summary
Field AttributesField Name and Description
{! + if (member.isPrivate) output += "<private> "; + if (member.isInner) output += "<inner> "; + if (member.isStatic) output += "<static> "; + if (member.isConstant) output += "<constant> "; + !}  +
+ {+member.memberOf+}.{+new Link().toSymbol(member.alias).withText(member.name)+} +
+
{+resolveLinks(summarize(xmlEncode(member.desc)))+}
+
+
+ + +
+ {! + var borrowedMembers = data.properties.filter(function($) {return $.memberOf != data.alias}); + + var contributers = []; + borrowedMembers.map(function($) {if (contributers.indexOf($.memberOf) < 0) contributers.push($.memberOf)}); + for (var i = 0, l = contributers.length; i < l; i++) { + output += + "
Fields borrowed from class "+new Link().toSymbol(contributers[i])+":
" + + + "
" + + borrowedMembers + .filter( + function($) { return $.memberOf == contributers[i] } + ) + .sort(makeSortby("name")) + .map( + function($) { return new Link().toSymbol($.alias).withText($.name) } + ) + .join(", ") + + + "
"; + } + !} +
+
+
+ + + + {! var ownMethods = data.methods.filter(function($){return $.memberOf == data.alias && !$.isNamespace}).sort(makeSortby("name")); !} + + + + + + + + + + + + + + + + + +
Method Summary
Method AttributesMethod Name and Description
{! + if (member.isPrivate) output += "<private> "; + if (member.isInner) output += "<inner> "; + if (member.isStatic) output += "<static> "; + !}  +
{+member.memberOf+}.{+new Link().toSymbol(member.alias).withText(member.name.replace(/\^\d+$/, ''))+}{+makeSignature(member.params)+} +
+
{+resolveLinks(summarize(xmlEncode(member.desc)))+}
+
+
+ + +
+ {! + var borrowedMembers = data.methods.filter(function($) {return $.memberOf != data.alias}); + var contributers = []; + borrowedMembers.map(function($) {if (contributers.indexOf($.memberOf) < 0) contributers.push($.memberOf)}); + for (var i = 0, l = contributers.length; i < l; i++) { + output += + "
Methods borrowed from class "+new Link().toSymbol(contributers[i])+":
" + + + "
" + + borrowedMembers + .filter( + function($) { return $.memberOf == contributers[i] } + ) + .sort(makeSortby("name")) + .map( + function($) { return new Link().toSymbol($.alias).withText($.name) } + ) + .join(", ") + + + "
"; + } + + !} +
+
+
+ + + {! var ownEvents = data.events.filter(function($){return $.memberOf == data.alias && !$.isNamespace}).sort(makeSortby("name")); !} + + + + + + + + + + + + + + + + + +
Event Summary
Event AttributesEvent Name and Description
{! + if (member.isPrivate) output += "<private> "; + if (member.isInner) output += "<inner> "; + if (member.isStatic) output += "<static> "; + !}  +
{+member.memberOf+}.{+new Link().toSymbol(member.alias).withText(member.name)+}{+makeSignature(member.params)+} +
+
{+resolveLinks(summarize(member.desc))+}
+
+
+ + +
+ {! + var borrowedMembers = data.events.filter(function($) {return $.memberOf != data.alias}); + var contributers = []; + borrowedMembers.map(function($) {if (contributers.indexOf($.memberOf) < 0) contributers.push($.memberOf)}); + for (var i = 0, l = contributers.length; i < l; i++) { + output += + "
Events borrowed from class "+new Link().toSymbol(contributers[i])+":
" + + + "
" + + borrowedMembers + .filter( + function($) { return $.memberOf == contributers[i] } + ) + .sort(makeSortby("name")) + .map( + function($) { return new Link().toSymbol($.alias).withText($.name) } + ) + .join(", ") + + + "
"; + } + + !} +
+
+
+ + + +
+
+ {+classType+}Detail +
+ +
{! + if (data.isPrivate) output += "<private> "; + if (data.isInner) output += "<inner> "; + !} + {+ data.alias +}{+ makeSignature(data.params) +} +
+ +
+ {+resolveLinks(data.desc)+} +
Author: {+data.author+}.
+
+ + + +
{+example+}
+
+
+ + + +
+
Parameters:
+ +
+ {+((item.type)?""+("{"+(new Link().toSymbol(item.type)+"} ")) : "")+} {+item.name+} + Optional, Default: {+item.defaultValue+} +
+
{+resolveLinks(xmlEncode(item.desc))+}
+
+
+
+ +
+
Deprecated:
+
+ {+resolveLinks(data.deprecated)+} +
+
+
+ +
+
Since:
+
{+ data.since +}
+
+
+ +
+
Throws:
+ +
+ {+((item.type)?"{"+(new Link().toSymbol(item.type))+"} " : "")+} {+item.name+} +
+
{+resolveLinks(fixNewLine(item.desc))+}
+
+
+
+ +
+
Returns:
+ +
{+((item.type)?"{"+(new Link().toSymbol(item.type))+"} " : "")+}{+resolveLinks(item.desc)+}
+
+
+
+ +
+
Requires:
+ +
{+ new Link().toSymbol(item) +}
+
+
+
+ +
+
See:
+ +
{+ new Link().toSymbol(item) +}
+
+
+
+ +
+
+ + + +
+ Field Detail +
+ + +
{! + if (member.isPrivate) output += "<private> "; + if (member.isInner) output += "<inner> "; + if (member.isStatic) output += "<static> "; + if (member.isConstant) output += "<constant> "; + !} + + {{+new Link().toSymbol(member.type)+}} + {+member.memberOf+}.{+member.name+} + +
+
+ {+resolveLinks(fixNewLine(xmlEncode(member.desc)))+} + +
+ Defined in: {+new Link().toSrc(member.srcFile)+}. +
+
Author: {+member.author+}.
+
+ + + +
{+example+}
+
+
+ + +
+
Deprecated:
+
+ {+ resolveLinks(member.deprecated) +} +
+
+
+ +
+
Since:
+
{+ member.since +}
+
+
+ +
+
See:
+ +
{+ new Link().toSymbol(item) +}
+
+
+
+ +
+
Default Value:
+
+ {+resolveLinks(member.defaultValue)+} +
+
+
+ +
+
+
+ + + +
+ Method Detail +
+ + +
{! + if (member.isPrivate) output += "<private> "; + if (member.isInner) output += "<inner> "; + if (member.isStatic) output += "<static> "; + !} + + {{+new Link().toSymbol(member.type)+}} + {+member.memberOf+}.{+member.name.replace(/\^\d+$/, '')+}{+makeSignature(member.params)+} + +
+
+ {+resolveLinks(fixNewLine(xmlEncode(member.desc)))+} + +
+ Defined in: {+new Link().toSrc(member.srcFile)+}. +
+
Author: {+member.author+}.
+
+ + + +
{+example+}
+
+
+ + +
+
Parameters:
+ +
+ {+((item.type)?"{"+(new Link().toSymbol(item.type))+"} " : "")+}{+item.name+} + Optional, Default: {+item.defaultValue+} +
+
{+resolveLinks(item.desc)+}
+
+
+
+ +
+
Deprecated:
+
+ {+ resolveLinks(member.deprecated) +} +
+
+
+ +
+
Since:
+
{+ member.since +}
+
+ +
+ +
+
Throws:
+ +
+ {+((item.type)?"{"+(new Link().toSymbol(item.type))+"} " : "")+} {+item.name+} +
+
{+resolveLinks(fixNewLine(item.desc))+}
+
+
+
+ +
+
Returns:
+ +
{+((item.type)?"{"+(new Link().toSymbol(item.type))+"} " : "")+}{+resolveLinks(item.desc)+}
+
+
+
+ +
+
Requires:
+ +
{+ resolveLinks(item) +}
+
+
+
+ +
+
See:
+ +
{+ new Link().toSymbol(item) +}
+
+
+
+ +
+
+
+ + + +
+ Event Detail +
+ + +
{! + if (member.isPrivate) output += "<private> "; + if (member.isInner) output += "<inner> "; + if (member.isStatic) output += "<static> "; + !} + + {{+new Link().toSymbol(member.type)+}} + {+member.memberOf+}.{+member.name+}{+makeSignature(member.params)+} + +
+
+ {+resolveLinks(member.desc)+} + +
+ Defined in: {+new Link().toSrc(member.srcFile)+}. +
+
Author: {+member.author+}.
+
+ + + +
{+example+}
+
+
+ + +
+
Parameters:
+ +
+ {+((item.type)?"{"+(new Link().toSymbol(item.type))+"} " : "")+}{+item.name+} + Optional, Default: {+item.defaultValue+} +
+
{+ resolveLinks(fixNewLine(item.desc)) +}
+
+
+
+ +
+
Deprecated:
+
+ {+ resolveLinks(member.deprecated) +} +
+
+
+ +
+
Since:
+
{+ member.since +}
+
+ +
+ +
+
Throws:
+ +
+ {+((item.type)?"{"+(new Link().toSymbol(item.type))+"} " : "")+} {+item.name+} +
+
{+ resolveLinks(item.desc) +}
+
+
+
+ +
+
Returns:
+ +
{+((item.type)?"{"+(new Link().toSymbol(item.type))+"} " : "")+}{+resolveLinks(item.desc)+}
+
+
+
+ +
+
Requires:
+ +
{+ resolveLinks(item) +}
+
+
+
+ +
+
See:
+ +
{+ new Link().toSymbol(item) +}
+
+
+
+ +
+
+
+ +
+
+ + + +
+ ©{+JSDOC.opt.D.copyright+}
+ Documentation generated by JsDoc Toolkit {+JSDOC.VERSION+} on {+new Date()+} +
+ + diff --git a/templates/vsdoc/index.tmpl b/templates/vsdoc/index.tmpl new file mode 100644 index 0000000..a5dc115 --- /dev/null +++ b/templates/vsdoc/index.tmpl @@ -0,0 +1,39 @@ + + + + + + JsDoc Reference - Index + + + + + + + {+include("static/header.html")+} + +
+ {+publish.classesIndex+} +
+ +
+

Class Index

+ + +
+

{+(new Link().toSymbol(thisClass.alias))+}

+ {+resolveLinks(summarize(thisClass.classDesc))+} +
+
+
+ +
+
+ ©{+JSDOC.opt.D.copyright+}
+ Documentation generated by JsDoc Toolkit {+JSDOC.VERSION+} on {+new Date()+} +
+ + \ No newline at end of file diff --git a/templates/vsdoc/publish.js b/templates/vsdoc/publish.js new file mode 100644 index 0000000..a4cdc02 --- /dev/null +++ b/templates/vsdoc/publish.js @@ -0,0 +1,258 @@ +/** Called automatically by JsDoc Toolkit. */ +function publish(symbolSet) { + publish.conf = { // trailing slash expected for dirs + ext: ".html", + outDir: JSDOC.opt.d || SYS.pwd+"../out/vsdoc/", + templatesDir: JSDOC.opt.t || SYS.pwd+"../templates/vsdoc/", + 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; + + // create the required templates + try { + var classTemplate = new JSDOC.JsPlate(publish.conf.templatesDir + "class.tmpl"); + var symbolTemplate = new JSDOC.JsPlate(publish.conf.templatesDir + "symbol.tmpl"); + var vsdocTemplate = new JSDOC.JsPlate(publish.conf.templatesDir + "vsdoc-class.tmpl"); + var vsdocNsTemplate = new JSDOC.JsPlate(publish.conf.templatesDir + "vsdoc-ns.tmpl"); + var vsdocAllTemplate = new JSDOC.JsPlate(publish.conf.templatesDir + "vsdoc-all.tmpl"); + var classesTemplate = new JSDOC.JsPlate(publish.conf.templatesDir+"allclasses.tmpl"); + } + catch(e) { + 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++) { +// var file = files[i]; +// 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] = + (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); +// var symbolOutput = symbolTemplate.process(symbol); + var vsdocOutput = (symbol.isNamespace ? vsdocNsTemplate : vsdocTemplate).process(symbol); + + try { + LOG.inform("Saving file for symbol "+ ((JSDOC.opt.u)? Link.filemap[symbol.alias] : symbol.alias)); +// IO.saveFile(publish.conf.outDir+"symbols/", ((JSDOC.opt.u)? Link.filemap[symbol.alias] : symbol.alias) + publish.conf.ext, output); +// IO.saveFile(publish.conf.outDir+"symbols/", ((JSDOC.opt.u) ? Link.filemap[symbol.alias] : symbol.alias) + ".xml", symbolOutput); + IO.saveFile(publish.conf.outDir+"symbols/", ((JSDOC.opt.u) ? Link.filemap[symbol.alias] : symbol.alias) + "-vsdoc.js", vsdocOutput); + } + catch (e) { print(e.message); } + } + + // 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"); + var refTemplate = new JSDOC.JsPlate(publish.conf.templatesDir+"vsdoc-references.tmpl"); + } + catch(e) { print(e.message); quit(); } + + var classesIndex = classesindexTemplate.process(classes); + var refIndex = refTemplate.process(classes); + var vsdocIndex = vsdocAllTemplate.process(classes); + IO.saveFile(publish.conf.outDir, "index"+publish.conf.ext, classesIndex); + IO.saveFile(publish.conf.outDir, "OpenLayersReferences.js", refIndex); + IO.saveFile(publish.conf.outDir, "OpenLayersAll.js", vsdocIndex); + 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 + var filesIndex = fileindexTemplate.process(allFiles); + IO.saveFile(publish.conf.outDir, "files"+publish.conf.ext, filesIndex); + fileindexTemplate = filesIndex = files = null; +} + +function fixNewLine(desc) { + return desc.replace(/^(.*)$/mg, "$1
");//.replace(/\(code\)([\w\W]*)\(end\)/g, "
$1
"); +} + +/** Just the first sentence (up to a full stop). Should not break on dotted variable names. */ +function summarize(desc) { + if (typeof desc != "undefined") { + var tmp = desc.match(/([\w\W]+?\.)[^a-z0-9_$]/i) ? RegExp.$1 : desc; + return fixNewLine(tmp); + } + return ""; +} + +/** Make a symbol sorter by some attribute. */ +function makeSortby(attribute) { + return function(a, b) { + if (a[attribute] != undefined && b[attribute] != undefined) { + a = a[attribute].toLowerCase(); + b = b[attribute].toLowerCase(); + if (a < b) return -1; + if (a > b) return 1; + return 0; + } + } +} + +/** Pull in the contents of an external file at the given path. */ +function include(path) { + var path = publish.conf.templatesDir+path; + return IO.readFile(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); + } + + if (src.hilited) { + IO.saveFile(srcDir, name+publish.conf.ext, src.hilited); + } +} + +/** Build output for displaying function parameters. */ +function makeSignature(params) { + if (!params) return "()"; + var signature = "(" + + + params.filter( + function($) { + return $.name.indexOf(".") == -1; // don't show config params in signature + } + ).map( + function($) { + return $.name; + } + ).join(", ") + + + ")"; + return signature; +} + +/** Find symbol {@link ...} strings in text and turn into html links */ +function resolveLinks(str, from) { + str = str.replace(/\{@link ([^} ]+) ?\}/gi, + function(match, symbolName) { + return new Link().toSymbol(symbolName); + } + ); + + return str; +} + +function xmlEncode(string) { + return string.replace(/\&/g, '&' + 'amp;').replace(/<(?!(?:\/)?(?:br|i|b))([^<>]+)>/g, "<$1>") + .replace(/\'/g, '&' + 'apos;').replace(/\"/g, '&' + 'quot;'); +} + +function vsdocDesc(string, indent) { + indent = indent || 0; + var space = ""; + for (var i=0; i < indent; i++) + space += " "; + return xmlEncode(string).replace(/(?:\r|\n)(.*)/g, "\n"+ space +"/// $1"); +} + +function documentType(typeName) { + if (typeName == "DOMElement") + return 'domElement="true"'; + else { + var isInteger = (typeName == "Integer") ? ' integer="true"' : ''; + return 'type="'+ xmlEncode(typeName) +'"' + isInteger; + } +} + +function callTemplate(name, data) { + var tmpl = new JSDOC.JsPlate((JSDOC.opt.t || SYS.pwd+"../templates/vsdoc/") + name); + return tmpl.process(data); +} + +function methodNameEscape(name) { + if (/delete/.test(name)) + return '"delete"'; + else + return name; +} \ No newline at end of file diff --git a/templates/vsdoc/static/default.css b/templates/vsdoc/static/default.css new file mode 100644 index 0000000..97e021e --- /dev/null +++ b/templates/vsdoc/static/default.css @@ -0,0 +1,162 @@ +/* default.css */ +body +{ + font: 12px "Lucida Grande", Tahoma, Arial, Helvetica, sans-serif; + width: 800px; +} + +.header +{ + clear: both; + background-color: #ccc; + padding: 8px; +} + +h1 +{ + font-size: 150%; + font-weight: bold; + padding: 0; + margin: 1em 0 0 .3em; +} + +hr +{ + border: none 0; + border-top: 1px solid #7F8FB1; + height: 1px; +} + +pre.code +{ + display: block; + padding: 8px; + border: 1px dashed #ccc; +} + +#index +{ + margin-top: 24px; + float: left; + width: 160px; + position: absolute; + left: 8px; + background-color: #F3F3F3; + padding: 8px; +} + +#content +{ + margin-left: 190px; + width: 600px; +} + +.classList +{ + list-style-type: none; + padding: 0; + margin: 0 0 0 8px; + font-family: arial, sans-serif; + font-size: 1em; + overflow: auto; +} + +.classList li +{ + padding: 0; + margin: 0 0 8px 0; +} + +.summaryTable { width: 100%; } + +h1.classTitle +{ + font-size:170%; + line-height:130%; +} + +h2 { font-size: 110%; } +caption, div.sectionTitle +{ + background-color: #7F8FB1; + color: #fff; + font-size:130%; + text-align: left; + padding: 2px 6px 2px 6px; + border: 1px #7F8FB1 solid; +} + +div.sectionTitle { margin-bottom: 8px; } +.summaryTable thead { display: none; } + +.summaryTable td +{ + vertical-align: top; + padding: 4px; + border-bottom: 1px #7F8FB1 solid; + border-right: 1px #7F8FB1 solid; +} + +/*col#summaryAttributes {}*/ +.summaryTable td.attributes +{ + border-left: 1px #7F8FB1 solid; + width: 140px; + text-align: right; +} + +td.attributes, .fixedFont +{ + line-height: 15px; + color: #002EBE; + font-family: "Courier New",Courier,monospace; + font-size: 13px; +} + +.summaryTable td.nameDescription +{ + text-align: left; + font-size: 13px; + line-height: 15px; +} + +.summaryTable td.nameDescription, .description +{ + line-height: 15px; + padding: 4px; + padding-left: 4px; +} + +.summaryTable { margin-bottom: 8px; } + +ul.inheritsList +{ + list-style: square; + margin-left: 20px; + padding-left: 0; +} + +.detailList { + margin-left: 20px; + line-height: 15px; +} +.detailList dt { margin-left: 20px; } + +.detailList .heading +{ + font-weight: bold; + padding-bottom: 6px; + margin-left: 0; +} + +.light, td.attributes, .light a:link, .light a:visited +{ + color: #777; + font-style: italic; +} + +.fineprint +{ + text-align: right; + font-size: 10px; +} \ No newline at end of file diff --git a/templates/vsdoc/static/header.html b/templates/vsdoc/static/header.html new file mode 100644 index 0000000..353b735 --- /dev/null +++ b/templates/vsdoc/static/header.html @@ -0,0 +1,2 @@ + \ No newline at end of file diff --git a/templates/vsdoc/static/index.html b/templates/vsdoc/static/index.html new file mode 100644 index 0000000..661f6f6 --- /dev/null +++ b/templates/vsdoc/static/index.html @@ -0,0 +1,19 @@ + + + + + Generated Javascript Documentation + + + + + + <body> + <p> + This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. + </p> + </body> + + + \ No newline at end of file diff --git a/templates/vsdoc/symbol.tmpl b/templates/vsdoc/symbol.tmpl new file mode 100644 index 0000000..4e5809f --- /dev/null +++ b/templates/vsdoc/symbol.tmpl @@ -0,0 +1,51 @@ + + {+data.name+} + {+data.memberOf+} + {+data.isStatic+} + {+data.isa+} + {+data.desc+} + {+data.classDesc+} + + + {+data.comment.getTag("constructs").toString()+} + + + {+param.type+} + {+param.name+} + {+xmlEncode(param.desc)+} + {+param.defaultValue+} + + + + + + + {+method.name+} + {+method.memberOf+} + {+method.isStatic+} + {+xmlEncode(method.desc)+} + + {+xmlEncode(method.returns[0].type)+} + {+xmlEncode(method.returns[0].desc)+} + + + + {+param.type+} + {+param.name+} + {+xmlEncode(param.desc)+} + {+param.defaultValue+} + + + + + + + + {+property.name+} + {+property.memberOf+} + {+property.isStatic+} + {+xmlEncode(property.desc)+} + {+property.type+} + + + diff --git a/templates/vsdoc/vsdoc-all.tmpl b/templates/vsdoc/vsdoc-all.tmpl new file mode 100644 index 0000000..13c16e8 --- /dev/null +++ b/templates/vsdoc/vsdoc-all.tmpl @@ -0,0 +1,4 @@ + + {+callTemplate("vsdoc-ns.tmpl", item)+} + {+callTemplate("vsdoc-class.tmpl", item)+} + diff --git a/templates/vsdoc/vsdoc-class.tmpl b/templates/vsdoc/vsdoc-class.tmpl new file mode 100644 index 0000000..a0d40cd --- /dev/null +++ b/templates/vsdoc/vsdoc-class.tmpl @@ -0,0 +1,31 @@ +{# + # Copyright (c) 2010 Sygic a.s., Jozef Izso. + # Published under the MIT License. + # Altered by Matthew Kastor Feb. 2, 2014 + #} +/* vsdoc for {+data.alias+} */ + +(function (window) { + window.{+data.memberOf+} = window.{+data.memberOf+} || {}; + + window.{+data.alias+} = function({# + #}{# + #}{+param.name+}, ){ + /// {+vsdocDesc(data.comment.getTag("constructs").toString() || vsdocDesc(data.desc), 2)+}{# + #} + /// {+vsdocDesc(param.desc, 2)+}{# + /// + #} + /// {+vsdocDesc(property.desc, 2)+} + {+property.name+} : new {+property.type+}(){# + #}{}, + }; + + var $x = window.{+data.alias+}; + $x.prototype = { + {+callTemplate("vsdoc-methods.tmpl", data)+} + }; + + $x.__class = "true"; + $x.__typeName = "{+data.alias+}"; +})(this); diff --git a/templates/vsdoc/vsdoc-methods.tmpl b/templates/vsdoc/vsdoc-methods.tmpl new file mode 100644 index 0000000..5af2a59 --- /dev/null +++ b/templates/vsdoc/vsdoc-methods.tmpl @@ -0,0 +1,10 @@ + + {+methodNameEscape(method.name)+}: function({# + #}{+param.name+}, ) { + /// {+vsdocDesc(method.desc, 3)+}{# + #} + /// {+vsdocDesc(param.desc, 3)+}{# + #} + /// {+vsdocDesc(method.returns[0].desc, 3)+} + }, + \ No newline at end of file diff --git a/templates/vsdoc/vsdoc-ns.tmpl b/templates/vsdoc/vsdoc-ns.tmpl new file mode 100644 index 0000000..36171d4 --- /dev/null +++ b/templates/vsdoc/vsdoc-ns.tmpl @@ -0,0 +1,27 @@ +{# + # Copyright (c) 2010 Sygic a.s., Jozef Izso. + # Published under the MIT License. + # Altered by Matthew Kastor Feb. 2, 2014 + #} +/* vsdoc for {+data.alias+} */ + +(function (window) { + window.{+data.memberOf+} = window.{+data.memberOf+} || {}; + + window.{+data.alias+} = { + /// {+vsdocDesc(data.comment.getTag("constructs").toString() || vsdocDesc(data.desc), 2)+}{# + #} + /// {+vsdocDesc(param.desc, 2)+} + /// {# + #} + + /// {+vsdocDesc(property.desc, 2)+} + {+property.name+} : new {+property.type+}(){# + #}{}, + {+callTemplate("vsdoc-methods.tmpl", data)+} + }; + + var $x = window.{+data.alias+}; + $x.__namespace = "true"; + $x.__typeName = "{+data.alias+}"; +})(this); diff --git a/templates/vsdoc/vsdoc-references.tmpl b/templates/vsdoc/vsdoc-references.tmpl new file mode 100644 index 0000000..59cf849 --- /dev/null +++ b/templates/vsdoc/vsdoc-references.tmpl @@ -0,0 +1,2 @@ +/// + From a3396a47ecfe644611a4666384cb45d767af4102 Mon Sep 17 00:00:00 2001 From: Matthew Kastor Date: Sun, 2 Feb 2014 18:18:29 -0500 Subject: [PATCH 15/20] version bump --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 21a936d..f81c8fb 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ ], "name": "jsdoc-toolkit", "description": "JSDoc Toolkit", - "version": "2.4.0n1", + "version": "2.5", "homepage": "kaleb.hornsby.ws/jsdoc", "repository": { "type": "git", From de38e529610aa86a4489de2b56e4a4e5126841b8 Mon Sep 17 00:00:00 2001 From: Matthew Kastor Date: Sun, 2 Feb 2014 18:35:34 -0500 Subject: [PATCH 16/20] fixed version number --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f81c8fb..dc6144d 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ ], "name": "jsdoc-toolkit", "description": "JSDoc Toolkit", - "version": "2.5", + "version": "2.5.0", "homepage": "kaleb.hornsby.ws/jsdoc", "repository": { "type": "git", From ee7600e4446b27a716437eb90f81312841498650 Mon Sep 17 00:00:00 2001 From: Matthew Kastor Date: Sun, 2 Feb 2014 19:49:32 -0500 Subject: [PATCH 17/20] updates vsdoc publish.js --- templates/vsdoc/publish.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/vsdoc/publish.js b/templates/vsdoc/publish.js index a4cdc02..a9f88b4 100644 --- a/templates/vsdoc/publish.js +++ b/templates/vsdoc/publish.js @@ -251,7 +251,7 @@ function callTemplate(name, data) { } function methodNameEscape(name) { - if (/delete/.test(name)) + if (/^delete$/.test(name)) return '"delete"'; else return name; From 90383ee6c17ef0b41222136eede51e8c6585c4f4 Mon Sep 17 00:00:00 2001 From: Matthew Kastor Date: Sun, 2 Feb 2014 19:50:11 -0500 Subject: [PATCH 18/20] 2.5.1 --- package.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index dc6144d..302badc 100644 --- a/package.json +++ b/package.json @@ -1,15 +1,15 @@ { "author": "Taka Kojima (taka@gigafied.com)", - "contributors" : [ + "contributors": [ { - "name" : "Matthew Kastor", - "email" : "matthewkastor@gmail.com", - "url" : "http://matthewkastor.blogspot.com" + "name": "Matthew Kastor", + "email": "matthewkastor@gmail.com", + "url": "http://matthewkastor.blogspot.com" } ], "name": "jsdoc-toolkit", "description": "JSDoc Toolkit", - "version": "2.5.0", + "version": "2.5.1", "homepage": "kaleb.hornsby.ws/jsdoc", "repository": { "type": "git", From 0808f37e5eb84d032cdde1a7af8d88f2e4a458cf Mon Sep 17 00:00:00 2001 From: Matthew Colter Date: Tue, 15 Nov 2022 19:06:07 -0500 Subject: [PATCH 19/20] ignore ide files --- .gitignore | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d6c4114 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +################################################################################ +# This .gitignore file was automatically created by Microsoft(R) Visual Studio. +################################################################################ + +/.vs From cb21e0039f587f7939e2fefd994373e318fff4f7 Mon Sep 17 00:00:00 2001 From: Matthew Colter Date: Tue, 15 Nov 2022 19:07:30 -0500 Subject: [PATCH 20/20] fix runInThisContext bug --- app/run.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/run.js b/app/run.js index 6f1281f..d8fd05a 100755 --- a/app/run.js +++ b/app/run.js @@ -10,7 +10,7 @@ // load the node.js libraries to be abstracted var fs = require('fs'); var path = require('path'); -var Script = require('vm').Script; +var Script = require('vm'); // default template directory. process.env.JSDOCTEMPLATEDIR = path.resolve(__dirname, '../templates/jsdoc/');