Permalink
Browse files

Initial import of jsdoc-toolkit 2.4.0 minus the Java parts and with an

alternate run.js which can run on Node.JS rather than Rhino.
  • Loading branch information...
0 parents commit b4761f032663c856b07d8e2716bb405ba2c4ce1b @p120ph37 p120ph37 committed Nov 12, 2010
Showing with 8,648 additions and 0 deletions.
  1. +183 −0 README.txt
  2. +33 −0 app/frame.js
  3. +102 −0 app/frame/Chain.js
  4. +144 −0 app/frame/Dumper.js
  5. +84 −0 app/frame/Hash.js
  6. +173 −0 app/frame/Link.js
  7. +10 −0 app/frame/Namespace.js
  8. +134 −0 app/frame/Opt.js
  9. +26 −0 app/frame/Reflection.js
  10. +93 −0 app/frame/String.js
  11. +129 −0 app/frame/Testrun.js
  12. +26 −0 app/handlers/FOODOC.js
  13. +26 −0 app/handlers/XMLDOC.js
  14. +159 −0 app/handlers/XMLDOC/DomReader.js
  15. +16 −0 app/handlers/XMLDOC/XMLDoc.js
  16. +292 −0 app/handlers/XMLDOC/XMLParse.js
  17. +106 −0 app/lib/JSDOC.js
  18. +204 −0 app/lib/JSDOC/DocComment.js
  19. +294 −0 app/lib/JSDOC/DocTag.js
  20. +140 −0 app/lib/JSDOC/JsDoc.js
  21. +109 −0 app/lib/JSDOC/JsPlate.js
  22. +144 −0 app/lib/JSDOC/Lang.js
  23. +146 −0 app/lib/JSDOC/Parser.js
  24. +33 −0 app/lib/JSDOC/PluginManager.js
  25. +644 −0 app/lib/JSDOC/Symbol.js
  26. +243 −0 app/lib/JSDOC/SymbolSet.js
  27. +41 −0 app/lib/JSDOC/TextStream.js
  28. +18 −0 app/lib/JSDOC/Token.js
  29. +332 −0 app/lib/JSDOC/TokenReader.js
  30. +133 −0 app/lib/JSDOC/TokenStream.js
  31. +32 −0 app/lib/JSDOC/Util.js
  32. +507 −0 app/lib/JSDOC/Walker.js
  33. +111 −0 app/main.js
  34. +20 −0 app/plugins/commentSrcJson.js
  35. +16 −0 app/plugins/frameworkPrototype.js
  36. +10 −0 app/plugins/functionCall.js
  37. +62 −0 app/plugins/publishSrcHilite.js
  38. +10 −0 app/plugins/symbolLink.js
  39. +31 −0 app/plugins/tagParamConfig.js
  40. +43 −0 app/plugins/tagSynonyms.js
  41. +296 −0 app/run.js
  42. +144 −0 app/t/TestDoc.js
  43. +13 −0 app/t/runner.js
  44. +342 −0 app/test.js
  45. +24 −0 app/test/addon.js
  46. +14 −0 app/test/anon_inner.js
  47. +31 −0 app/test/augments.js
  48. +26 −0 app/test/augments2.js
  49. +46 −0 app/test/borrows.js
  50. +23 −0 app/test/borrows2.js
  51. +22 −0 app/test/config.js
  52. +18 −0 app/test/constructs.js
  53. +10 −0 app/test/encoding.js
  54. +12 −0 app/test/encoding_other.js
  55. +54 −0 app/test/event.js
  56. +14 −0 app/test/exports.js
  57. +39 −0 app/test/functions_anon.js
  58. +33 −0 app/test/functions_nested.js
  59. +13 −0 app/test/global.js
  60. +25 −0 app/test/globals.js
  61. +10 −0 app/test/ignore.js
  62. +16 −0 app/test/inner.js
  63. +477 −0 app/test/jsdoc_test.js
  64. +33 −0 app/test/lend.js
  65. +19 −0 app/test/memberof.js
  66. +38 −0 app/test/memberof2.js
  67. +33 −0 app/test/memberof3.js
  68. +17 −0 app/test/memberof_constructor.js
  69. +17 −0 app/test/module.js
  70. +25 −0 app/test/multi_methods.js
  71. +19 −0 app/test/name.js
  72. +23 −0 app/test/namespace_nested.js
  73. +13 −0 app/test/nocode.js
  74. +20 −0 app/test/oblit_anon.js
  75. +20 −0 app/test/overview.js
  76. +37 −0 app/test/param_inline.js
  77. +8 −0 app/test/params_optional.js
  78. +17 −0 app/test/prototype.js
  79. +9 −0 app/test/prototype_nested.js
  80. +13 −0 app/test/prototype_oblit.js
  81. +24 −0 app/test/prototype_oblit_constructor.js
  82. +10 −0 app/test/public.js
  83. +5 −0 app/test/scripts/code.js
  84. +5 −0 app/test/scripts/notcode.txt
  85. +42 −0 app/test/shared.js
  86. +2 −0 app/test/shared2.js
  87. +22 −0 app/test/shortcuts.js
  88. +13 −0 app/test/static_this.js
  89. +31 −0 app/test/synonyms.js
  90. +23 −0 app/test/tosource.js
  91. +14 −0 app/test/variable_redefine.js
  92. +124 −0 changes.txt
  93. +31 −0 conf/sample.conf
  94. +17 −0 templates/jsdoc/allclasses.tmpl
  95. +56 −0 templates/jsdoc/allfiles.tmpl
  96. +649 −0 templates/jsdoc/class.tmpl
  97. +39 −0 templates/jsdoc/index.tmpl
  98. +201 −0 templates/jsdoc/publish.js
  99. +162 −0 templates/jsdoc/static/default.css
  100. +2 −0 templates/jsdoc/static/header.html
  101. +19 −0 templates/jsdoc/static/index.html
  102. +35 −0 templates/jsdoc/symbol.tmpl
@@ -0,0 +1,183 @@
+======================================================================
+
+DESCRIPTION:
+
+This is the source code for JsDoc Toolkit, an automatic documentation
+generation tool for JavaScript. It is written in JavaScript and is run
+from a command line (or terminal) using Java and Mozilla's Rhino
+JavaScript runtime engine.
+
+Using this tool you can automatically turn JavaDoc-like comments in
+your JavaScript source code into published output files, such as HTML
+or XML.
+
+For more information, to report a bug, or to browse the technical
+documentation for this tool please visit the official JsDoc Toolkit
+project homepage at http://code.google.com/p/jsdoc-toolkit/
+
+For the most up-to-date documentation on JsDoc Toolkit see the
+official wiki at http://code.google.com/p/jsdoc-toolkit/w/list
+
+======================================================================
+
+REQUIREMENTS:
+
+JsDoc Toolkit is known to work with:
+java version "1.6.0_03"
+Java(TM) SE Runtime Environment (build 1.6.0_03-b05)
+on Windows XP,
+and java version "1.5.0_19"
+Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_19-b02-304)
+on Mac OS X 10.5.
+
+Other versions of java may or may not work with JsDoc Toolkit.
+
+======================================================================
+
+USAGE:
+
+Running JsDoc Toolkit requires you to have Java installed on your
+computer. For more information see http://www.java.com/getjava/
+
+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.
+
+On a computer running Windows a valid command line to run JsDoc
+Toolkit might look like this:
+
+> java -jar jsrun.jar app\run.js -a -t=templates\jsdoc mycode.js
+
+On Mac OS X or Linux the same command would look like this:
+
+$ java -jar jsrun.jar app/run.js -a -t=templates/jsdoc mycode.js
+
+The above assumes your current working directory contains jsrun.jar,
+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".
+
+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:
+
+$ java -jar jsrun.jar app/run.js --help
+
+More information about the various command line options used by JsDoc
+Toolkit are available on the project wiki.
+
+======================================================================
+
+RUNNING VIA SHELL SCRIPT
+
+Avi Deitcher has contributed the file jsrun.sh with the following usage notes:
+
+A script to simplify running jsdoc from the command-line, especially when
+running from within a development or build environment such as ant.
+
+Normally, to run jsdoc, you need a command-line as the following:
+java -Djsdoc.dir=/some/long/dir/path/to/jsdoc -jar
+/some/long/dir/path/to/jsdoc/jsrun.jar /some/long/dir/path/to/jsdoc/app/run.js
+-t=template -r=4 /some/long/dir/path/to/my/src/code
+
+This can get tedious to redo time and again, and difficult to use from within a build environment.
+
+To simplify the process, jsrun.sh will automatically run this path, as well as passing through any arguments.
+
+Usage: jsrun.sh <run.js arguments>
+
+All <run.js arguments> will be passed through.
+Additionally, jsrun.sh will take the following actions:
+1) If the environment variable JSDOCDIR is set, it will add
+"-Djsdoc.dir=$JSDOCDIR" to the command-line
+2) If the environment variable JSDOCTEMPLATEDIR is set, it will add
+"-Djsdoc.template.dir=$JSDOCTEMPLATEDIR" to the command-line
+3) java with the appropriate path to jsrun.jar and run.js will be instantiated
+
+If not variables are set, it is assumed that the path to jsrun.jar and app/ is in the current working directory.
+
+Example:
+# jsrun.sh ./src/
+Assuming JSDOCDIR=/some/path/to/my/jsdoc will cause the following command to
+execute:
+java -Djsdoc.dir=/some/path/to/my/jsdoc -jar /some/path/to/my/jsdoc/jsrun.jar
+/some/path/to/my/jsdoc/app/run.js ./src/
+
+======================================================================
+
+TESTING:
+
+To run the suite of unit tests included with JsDoc Toolkit enter this
+on the command line:
+
+$ java -jar jsrun.jar app/run.js -T
+
+To see a dump of the internal data structure that JsDoc Toolkit has
+built from your source files use this command:
+
+$ java -jar jsrun.jar app/run.js mycode.js -Z
+
+======================================================================
+
+LICENSE:
+
+JSDoc.pm
+
+This project is based on the JSDoc.pm tool, created by Michael
+Mathews and Gabriel Reid. More information on JsDoc.pm can
+be found on the JSDoc.pm homepage: http://jsdoc.sourceforge.net/
+
+Complete documentation on JsDoc Toolkit can be found on the project
+wiki at http://code.google.com/p/jsdoc-toolkit/w/list
+
+Rhino
+
+Rhino (JavaScript in Java) is open source and licensed by Mozilla
+under the MPL 1.1 or later/GPL 2.0 or later licenses, the text of
+which is available at http://www.mozilla.org/MPL/
+
+You can obtain the source code for Rhino from the Mozilla web site at
+http://www.mozilla.org/rhino/download.html
+
+JsDoc Toolkit is a larger work that uses the Rhino JavaScript engine
+but is not derived from it in any way. The Rhino library is used
+without modification and without any claims whatsoever.
+
+The Rhino Debugger
+
+You can obtain more information about the Rhino Debugger from the
+Mozilla web site at http://www.mozilla.org/rhino/debugger.html
+
+JsDoc Toolkit is a larger work that uses the Rhino Debugger but
+is not derived from it in any way. The Rhino Debugger is used
+without modification and without any claims whatsoever.
+
+JsDoc Toolkit
+
+All code specific to JsDoc Toolkit are free, open source and licensed
+for use under the X11/MIT License.
+
+JsDoc Toolkit is Copyright (c)2009 Michael Mathews <micmath@gmail.com>
+
+This program is free software; you can redistribute it and/or
+modify it under the terms below.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions: The above copyright notice and this
+permission notice must be included in all copies or substantial
+portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,33 @@
+IO.include("frame/Opt.js");
+IO.include("frame/Chain.js");
+IO.include("frame/Link.js");
+IO.include("frame/String.js");
+IO.include("frame/Hash.js");
+IO.include("frame/Namespace.js");
+//IO.include("frame/Reflection.js");
+
+/** A few helper functions to make life a little easier. */
+
+function defined(o) {
+ return (o !== undefined);
+}
+
+function copy(o) { // todo check for circular refs
+ if (o == null || typeof(o) != 'object') return o;
+ var c = new o.constructor();
+ for(var p in o) c[p] = copy(o[p]);
+ return c;
+}
+
+function isUnique(arr) {
+ var l = arr.length;
+ for(var i = 0; i < l; i++ ) {
+ if (arr.lastIndexOf(arr[i]) > i) return false;
+ }
+ return true;
+}
+
+/** Returns the given string with all regex meta characters backslashed. */
+RegExp.escapeMeta = function(str) {
+ return str.replace(/([$^\\\/()|?+*\[\]{}.-])/g, "\\$1");
+}
@@ -0,0 +1,102 @@
+/**@constructor*/
+function ChainNode(object, link) {
+ this.value = object;
+ this.link = link; // describes this node's relationship to the previous node
+}
+
+/**@constructor*/
+function Chain(valueLinks) {
+ this.nodes = [];
+ this.cursor = -1;
+
+ if (valueLinks && valueLinks.length > 0) {
+ this.push(valueLinks[0], "//");
+ for (var i = 1, l = valueLinks.length; i < l; i+=2) {
+ this.push(valueLinks[i+1], valueLinks[i]);
+ }
+ }
+}
+
+Chain.prototype.push = function(o, link) {
+ if (this.nodes.length > 0 && link) this.nodes.push(new ChainNode(o, link));
+ else this.nodes.push(new ChainNode(o));
+}
+
+Chain.prototype.unshift = function(o, link) {
+ if (this.nodes.length > 0 && link) this.nodes[0].link = link;
+ this.nodes.unshift(new ChainNode(o));
+ this.cursor++;
+}
+
+Chain.prototype.get = function() {
+ if (this.cursor < 0 || this.cursor > this.nodes.length-1) return null;
+ return this.nodes[this.cursor];
+}
+
+Chain.prototype.first = function() {
+ this.cursor = 0;
+ return this.get();
+}
+
+Chain.prototype.last = function() {
+ this.cursor = this.nodes.length-1;
+ return this.get();
+}
+
+Chain.prototype.next = function() {
+ this.cursor++;
+ return this.get();
+}
+
+Chain.prototype.prev = function() {
+ this.cursor--;
+ return this.get();
+}
+
+Chain.prototype.toString = function() {
+ var string = "";
+ for (var i = 0, l = this.nodes.length; i < l; i++) {
+ if (this.nodes[i].link) string += " -("+this.nodes[i].link+")-> ";
+ string += this.nodes[i].value.toString();
+ }
+ return string;
+}
+
+Chain.prototype.joinLeft = function() {
+ var result = "";
+ for (var i = 0, l = this.cursor; i < l; i++) {
+ if (result && this.nodes[i].link) result += this.nodes[i].link;
+ result += this.nodes[i].value.toString();
+ }
+ return result;
+}
+
+
+/* USAGE:
+
+var path = "one/two/three.four/five-six";
+var pathChain = new Chain(path.split(/([\/.-])/));
+print(pathChain);
+
+var lineage = new Chain();
+lineage.push("Port");
+lineage.push("Les", "son");
+lineage.push("Dawn", "daughter");
+lineage.unshift("Purdie", "son");
+
+print(lineage);
+
+// walk left
+for (var node = lineage.last(); node !== null; node = lineage.prev()) {
+ print("< "+node.value);
+}
+
+// walk right
+var node = lineage.first()
+while (node !== null) {
+ print(node.value);
+ node = lineage.next();
+ if (node && node.link) print("had a "+node.link+" named");
+}
+
+*/
Oops, something went wrong.

0 comments on commit b4761f0

Please sign in to comment.