jsdoc 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (119) hide show
  1. data/LICENSE +20 -0
  2. data/README.rdoc +17 -0
  3. data/VERSION +1 -0
  4. data/bin/jsdoc +5 -0
  5. data/jsdoc.gemspec +162 -0
  6. data/lib/jsdoc-toolkit-2.4.0/README.txt +183 -0
  7. data/lib/jsdoc-toolkit-2.4.0/app/frame.js +33 -0
  8. data/lib/jsdoc-toolkit-2.4.0/app/frame/Chain.js +102 -0
  9. data/lib/jsdoc-toolkit-2.4.0/app/frame/Dumper.js +144 -0
  10. data/lib/jsdoc-toolkit-2.4.0/app/frame/Hash.js +84 -0
  11. data/lib/jsdoc-toolkit-2.4.0/app/frame/Link.js +173 -0
  12. data/lib/jsdoc-toolkit-2.4.0/app/frame/Namespace.js +10 -0
  13. data/lib/jsdoc-toolkit-2.4.0/app/frame/Opt.js +134 -0
  14. data/lib/jsdoc-toolkit-2.4.0/app/frame/Reflection.js +26 -0
  15. data/lib/jsdoc-toolkit-2.4.0/app/frame/String.js +93 -0
  16. data/lib/jsdoc-toolkit-2.4.0/app/frame/Testrun.js +129 -0
  17. data/lib/jsdoc-toolkit-2.4.0/app/handlers/FOODOC.js +26 -0
  18. data/lib/jsdoc-toolkit-2.4.0/app/handlers/XMLDOC.js +26 -0
  19. data/lib/jsdoc-toolkit-2.4.0/app/handlers/XMLDOC/DomReader.js +159 -0
  20. data/lib/jsdoc-toolkit-2.4.0/app/handlers/XMLDOC/XMLDoc.js +16 -0
  21. data/lib/jsdoc-toolkit-2.4.0/app/handlers/XMLDOC/XMLParse.js +292 -0
  22. data/lib/jsdoc-toolkit-2.4.0/app/lib/JSDOC.js +106 -0
  23. data/lib/jsdoc-toolkit-2.4.0/app/lib/JSDOC/DocComment.js +204 -0
  24. data/lib/jsdoc-toolkit-2.4.0/app/lib/JSDOC/DocTag.js +294 -0
  25. data/lib/jsdoc-toolkit-2.4.0/app/lib/JSDOC/JsDoc.js +140 -0
  26. data/lib/jsdoc-toolkit-2.4.0/app/lib/JSDOC/JsPlate.js +109 -0
  27. data/lib/jsdoc-toolkit-2.4.0/app/lib/JSDOC/Lang.js +144 -0
  28. data/lib/jsdoc-toolkit-2.4.0/app/lib/JSDOC/Parser.js +146 -0
  29. data/lib/jsdoc-toolkit-2.4.0/app/lib/JSDOC/PluginManager.js +33 -0
  30. data/lib/jsdoc-toolkit-2.4.0/app/lib/JSDOC/Symbol.js +644 -0
  31. data/lib/jsdoc-toolkit-2.4.0/app/lib/JSDOC/SymbolSet.js +243 -0
  32. data/lib/jsdoc-toolkit-2.4.0/app/lib/JSDOC/TextStream.js +41 -0
  33. data/lib/jsdoc-toolkit-2.4.0/app/lib/JSDOC/Token.js +18 -0
  34. data/lib/jsdoc-toolkit-2.4.0/app/lib/JSDOC/TokenReader.js +332 -0
  35. data/lib/jsdoc-toolkit-2.4.0/app/lib/JSDOC/TokenStream.js +133 -0
  36. data/lib/jsdoc-toolkit-2.4.0/app/lib/JSDOC/Util.js +32 -0
  37. data/lib/jsdoc-toolkit-2.4.0/app/lib/JSDOC/Walker.js +507 -0
  38. data/lib/jsdoc-toolkit-2.4.0/app/main.js +111 -0
  39. data/lib/jsdoc-toolkit-2.4.0/app/plugins/commentSrcJson.js +20 -0
  40. data/lib/jsdoc-toolkit-2.4.0/app/plugins/frameworkPrototype.js +16 -0
  41. data/lib/jsdoc-toolkit-2.4.0/app/plugins/functionCall.js +10 -0
  42. data/lib/jsdoc-toolkit-2.4.0/app/plugins/publishSrcHilite.js +62 -0
  43. data/lib/jsdoc-toolkit-2.4.0/app/plugins/symbolLink.js +10 -0
  44. data/lib/jsdoc-toolkit-2.4.0/app/plugins/tagParamConfig.js +31 -0
  45. data/lib/jsdoc-toolkit-2.4.0/app/plugins/tagSynonyms.js +43 -0
  46. data/lib/jsdoc-toolkit-2.4.0/app/run.js +348 -0
  47. data/lib/jsdoc-toolkit-2.4.0/app/t/TestDoc.js +144 -0
  48. data/lib/jsdoc-toolkit-2.4.0/app/t/runner.js +13 -0
  49. data/lib/jsdoc-toolkit-2.4.0/app/test.js +342 -0
  50. data/lib/jsdoc-toolkit-2.4.0/app/test/addon.js +24 -0
  51. data/lib/jsdoc-toolkit-2.4.0/app/test/anon_inner.js +14 -0
  52. data/lib/jsdoc-toolkit-2.4.0/app/test/augments.js +31 -0
  53. data/lib/jsdoc-toolkit-2.4.0/app/test/augments2.js +26 -0
  54. data/lib/jsdoc-toolkit-2.4.0/app/test/borrows.js +46 -0
  55. data/lib/jsdoc-toolkit-2.4.0/app/test/borrows2.js +23 -0
  56. data/lib/jsdoc-toolkit-2.4.0/app/test/config.js +22 -0
  57. data/lib/jsdoc-toolkit-2.4.0/app/test/constructs.js +18 -0
  58. data/lib/jsdoc-toolkit-2.4.0/app/test/encoding.js +10 -0
  59. data/lib/jsdoc-toolkit-2.4.0/app/test/encoding_other.js +12 -0
  60. data/lib/jsdoc-toolkit-2.4.0/app/test/event.js +54 -0
  61. data/lib/jsdoc-toolkit-2.4.0/app/test/exports.js +14 -0
  62. data/lib/jsdoc-toolkit-2.4.0/app/test/functions_anon.js +39 -0
  63. data/lib/jsdoc-toolkit-2.4.0/app/test/functions_nested.js +33 -0
  64. data/lib/jsdoc-toolkit-2.4.0/app/test/global.js +13 -0
  65. data/lib/jsdoc-toolkit-2.4.0/app/test/globals.js +25 -0
  66. data/lib/jsdoc-toolkit-2.4.0/app/test/ignore.js +10 -0
  67. data/lib/jsdoc-toolkit-2.4.0/app/test/inner.js +16 -0
  68. data/lib/jsdoc-toolkit-2.4.0/app/test/jsdoc_test.js +477 -0
  69. data/lib/jsdoc-toolkit-2.4.0/app/test/lend.js +33 -0
  70. data/lib/jsdoc-toolkit-2.4.0/app/test/memberof.js +19 -0
  71. data/lib/jsdoc-toolkit-2.4.0/app/test/memberof2.js +38 -0
  72. data/lib/jsdoc-toolkit-2.4.0/app/test/memberof3.js +33 -0
  73. data/lib/jsdoc-toolkit-2.4.0/app/test/memberof_constructor.js +17 -0
  74. data/lib/jsdoc-toolkit-2.4.0/app/test/module.js +17 -0
  75. data/lib/jsdoc-toolkit-2.4.0/app/test/multi_methods.js +25 -0
  76. data/lib/jsdoc-toolkit-2.4.0/app/test/name.js +19 -0
  77. data/lib/jsdoc-toolkit-2.4.0/app/test/namespace_nested.js +23 -0
  78. data/lib/jsdoc-toolkit-2.4.0/app/test/nocode.js +13 -0
  79. data/lib/jsdoc-toolkit-2.4.0/app/test/oblit_anon.js +20 -0
  80. data/lib/jsdoc-toolkit-2.4.0/app/test/overview.js +20 -0
  81. data/lib/jsdoc-toolkit-2.4.0/app/test/param_inline.js +37 -0
  82. data/lib/jsdoc-toolkit-2.4.0/app/test/params_optional.js +8 -0
  83. data/lib/jsdoc-toolkit-2.4.0/app/test/prototype.js +17 -0
  84. data/lib/jsdoc-toolkit-2.4.0/app/test/prototype_nested.js +9 -0
  85. data/lib/jsdoc-toolkit-2.4.0/app/test/prototype_oblit.js +13 -0
  86. data/lib/jsdoc-toolkit-2.4.0/app/test/prototype_oblit_constructor.js +24 -0
  87. data/lib/jsdoc-toolkit-2.4.0/app/test/public.js +10 -0
  88. data/lib/jsdoc-toolkit-2.4.0/app/test/scripts/code.js +5 -0
  89. data/lib/jsdoc-toolkit-2.4.0/app/test/scripts/notcode.txt +5 -0
  90. data/lib/jsdoc-toolkit-2.4.0/app/test/shared.js +42 -0
  91. data/lib/jsdoc-toolkit-2.4.0/app/test/shared2.js +2 -0
  92. data/lib/jsdoc-toolkit-2.4.0/app/test/shortcuts.js +22 -0
  93. data/lib/jsdoc-toolkit-2.4.0/app/test/static_this.js +13 -0
  94. data/lib/jsdoc-toolkit-2.4.0/app/test/synonyms.js +31 -0
  95. data/lib/jsdoc-toolkit-2.4.0/app/test/tosource.js +23 -0
  96. data/lib/jsdoc-toolkit-2.4.0/app/test/variable_redefine.js +14 -0
  97. data/lib/jsdoc-toolkit-2.4.0/changes.txt +124 -0
  98. data/lib/jsdoc-toolkit-2.4.0/conf/sample.conf +31 -0
  99. data/lib/jsdoc-toolkit-2.4.0/java/build.xml +36 -0
  100. data/lib/jsdoc-toolkit-2.4.0/java/build_1.4.xml +36 -0
  101. data/lib/jsdoc-toolkit-2.4.0/java/classes/js.jar +0 -0
  102. data/lib/jsdoc-toolkit-2.4.0/java/src/JsDebugRun.java +21 -0
  103. data/lib/jsdoc-toolkit-2.4.0/java/src/JsRun.java +21 -0
  104. data/lib/jsdoc-toolkit-2.4.0/jsdebug.jar +0 -0
  105. data/lib/jsdoc-toolkit-2.4.0/jsrun.jar +0 -0
  106. data/lib/jsdoc-toolkit-2.4.0/jsrun.sh +52 -0
  107. data/lib/jsdoc-toolkit-2.4.0/templates/jsdoc/allclasses.tmpl +17 -0
  108. data/lib/jsdoc-toolkit-2.4.0/templates/jsdoc/allfiles.tmpl +56 -0
  109. data/lib/jsdoc-toolkit-2.4.0/templates/jsdoc/class.tmpl +649 -0
  110. data/lib/jsdoc-toolkit-2.4.0/templates/jsdoc/index.tmpl +39 -0
  111. data/lib/jsdoc-toolkit-2.4.0/templates/jsdoc/publish.js +201 -0
  112. data/lib/jsdoc-toolkit-2.4.0/templates/jsdoc/static/default.css +162 -0
  113. data/lib/jsdoc-toolkit-2.4.0/templates/jsdoc/static/header.html +2 -0
  114. data/lib/jsdoc-toolkit-2.4.0/templates/jsdoc/static/index.html +19 -0
  115. data/lib/jsdoc-toolkit-2.4.0/templates/jsdoc/symbol.tmpl +35 -0
  116. data/lib/jsdoc.rb +23 -0
  117. data/test/helper.rb +10 -0
  118. data/test/test_jsdoc.rb +7 -0
  119. metadata +199 -0
@@ -0,0 +1,144 @@
1
+ /**
2
+ * @class
3
+ <pre>
4
+ This is a lightly modified version of Kevin Jones' JavaScript
5
+ library Data.Dump. To download the original visit:
6
+ <a href="http://openjsan.org/doc/k/ke/kevinj/Data/Dump/">http://openjsan.org/doc/k/ke/kevinj/Data/Dump/</a>
7
+
8
+ AUTHORS
9
+
10
+ The Data.Dump JavaScript module is written by Kevin Jones
11
+ (kevinj@cpan.org), based on Data::Dump by Gisle Aas (gisle@aas.no),
12
+ based on Data::Dumper by Gurusamy Sarathy (gsar@umich.edu).
13
+
14
+ COPYRIGHT
15
+
16
+ Copyright 2007 Kevin Jones. Copyright 1998-2000,2003-2004 Gisle Aas.
17
+ Copyright 1996-1998 Gurusamy Sarathy.
18
+
19
+ This program is free software; you can redistribute it and/or modify
20
+ it under the terms of the Perl Artistic License
21
+
22
+ See http://www.perl.com/perl/misc/Artistic.html
23
+ </pre>
24
+ * @static
25
+ */
26
+ Dumper = {
27
+ /** @param [...] The objects to dump. */
28
+ dump: function () {
29
+ if (arguments.length > 1)
30
+ return this._dump(arguments);
31
+ else if (arguments.length == 1)
32
+ return this._dump(arguments[0]);
33
+ else
34
+ return "()";
35
+ },
36
+
37
+ _dump: function (obj) {
38
+ if (typeof obj == 'undefined') return 'undefined';
39
+ var out;
40
+ if (obj.serialize) { return obj.serialize(); }
41
+ var type = this._typeof(obj);
42
+ if (obj.circularReference) obj.circularReference++;
43
+ switch (type) {
44
+ case 'circular':
45
+ out = "{ //circularReference\n}";
46
+ break;
47
+ case 'object':
48
+ var pairs = new Array;
49
+
50
+ for (var prop in obj) {
51
+ if (prop != "circularReference" && obj.hasOwnProperty(prop)) { //hide inherited properties
52
+ pairs.push(prop + ': ' + this._dump(obj[prop]));
53
+ }
54
+ }
55
+
56
+ out = '{' + this._format_list(pairs) + '}';
57
+ break;
58
+
59
+ case 'string':
60
+ for (var prop in Dumper.ESC) {
61
+ if (Dumper.ESC.hasOwnProperty(prop)) {
62
+ obj = obj.replace(prop, Dumper.ESC[prop]);
63
+ }
64
+ }
65
+
66
+ // Escape UTF-8 Strings
67
+ if (obj.match(/^[\x00-\x7f]*$/)) {
68
+ out = '"' + obj.replace(/\"/g, "\\\"").replace(/([\n\r]+)/g, "\\$1") + '"';
69
+ }
70
+ else {
71
+ out = "unescape('"+escape(obj)+"')";
72
+ }
73
+ break;
74
+
75
+ case 'array':
76
+ var elems = new Array;
77
+
78
+ for (var i=0; i<obj.length; i++) {
79
+ elems.push( this._dump(obj[i]) );
80
+ }
81
+
82
+ out = '[' + this._format_list(elems) + ']';
83
+ break;
84
+
85
+ case 'date':
86
+ // firefox returns GMT strings from toUTCString()...
87
+ var utc_string = obj.toUTCString().replace(/GMT/,'UTC');
88
+ out = 'new Date("' + utc_string + '")';
89
+ break;
90
+
91
+ case 'element':
92
+ // DOM element
93
+ out = this._dump_dom(obj);
94
+ break;
95
+
96
+ default:
97
+ out = obj;
98
+ }
99
+
100
+ out = String(out).replace(/\n/g, '\n ');
101
+ out = out.replace(/\n (.*)$/,"\n$1");
102
+
103
+ return out;
104
+ },
105
+
106
+ _format_list: function (list) {
107
+ if (!list.length) return '';
108
+ var nl = list.toString().length > 60 ? '\n' : ' ';
109
+ return nl + list.join(',' + nl) + nl;
110
+ },
111
+
112
+ _typeof: function (obj) {
113
+ if (obj && obj.circularReference && obj.circularReference > 1) return 'circular';
114
+ if (Array.prototype.isPrototypeOf(obj)) return 'array';
115
+ if (Date.prototype.isPrototypeOf(obj)) return 'date';
116
+ if (typeof obj.nodeType != 'undefined') return 'element';
117
+ return typeof(obj);
118
+ },
119
+
120
+ _dump_dom: function (obj) {
121
+ return '"' + Dumper.nodeTypes[obj.nodeType] + '"';
122
+ }
123
+ };
124
+
125
+ Dumper.ESC = {
126
+ "\t": "\\t",
127
+ "\n": "\\n",
128
+ "\f": "\\f"
129
+ };
130
+
131
+ Dumper.nodeTypes = {
132
+ 1: "ELEMENT_NODE",
133
+ 2: "ATTRIBUTE_NODE",
134
+ 3: "TEXT_NODE",
135
+ 4: "CDATA_SECTION_NODE",
136
+ 5: "ENTITY_REFERENCE_NODE",
137
+ 6: "ENTITY_NODE",
138
+ 7: "PROCESSING_INSTRUCTION_NODE",
139
+ 8: "COMMENT_NODE",
140
+ 9: "DOCUMENT_NODE",
141
+ 10: "DOCUMENT_TYPE_NODE",
142
+ 11: "DOCUMENT_FRAGMENT_NODE",
143
+ 12: "NOTATION_NODE"
144
+ };
@@ -0,0 +1,84 @@
1
+ /**
2
+ @constructor
3
+ @example
4
+ var _index = new Hash();
5
+ _index.set("a", "apple");
6
+ _index.set("b", "blue");
7
+ _index.set("c", "coffee");
8
+
9
+ for (var p = _index.first(); p; p = _index.next()) {
10
+ print(p.key+" is for "+p.value);
11
+ }
12
+
13
+ */
14
+ var Hash = function() {
15
+ this._map = {};
16
+ this._keys = [];
17
+ this._vals = [];
18
+ this.reset();
19
+ }
20
+
21
+ Hash.prototype.set = function(k, v) {
22
+ if (k != "") {
23
+ this._keys.push(k);
24
+ this._map["="+k] = this._vals.length;
25
+ this._vals.push(v);
26
+ }
27
+ }
28
+
29
+ Hash.prototype.replace = function(k, k2, v) {
30
+ if (k == k2) return;
31
+
32
+ var offset = this._map["="+k];
33
+ this._keys[offset] = k2;
34
+ if (typeof v != "undefined") this._vals[offset] = v;
35
+ this._map["="+k2] = offset;
36
+ delete(this._map["="+k]);
37
+ }
38
+
39
+ Hash.prototype.drop = function(k) {
40
+ if (k != "") {
41
+ var offset = this._map["="+k];
42
+ this._keys.splice(offset, 1);
43
+ this._vals.splice(offset, 1);
44
+ delete(this._map["="+k]);
45
+ for (var p in this._map) {
46
+ if (this._map[p] >= offset) this._map[p]--;
47
+ }
48
+ if (this._cursor >= offset && this._cursor > 0) this._cursor--;
49
+ }
50
+ }
51
+
52
+ Hash.prototype.get = function(k) {
53
+ if (k != "") {
54
+ return this._vals[this._map["="+k]];
55
+ }
56
+ }
57
+
58
+ Hash.prototype.keys = function() {
59
+ return this._keys;
60
+ }
61
+
62
+ Hash.prototype.hasKey = function(k) {
63
+ if (k != "") {
64
+ return (typeof this._map["="+k] != "undefined");
65
+ }
66
+ }
67
+
68
+ Hash.prototype.values = function() {
69
+ return this._vals;
70
+ }
71
+
72
+ Hash.prototype.reset = function() {
73
+ this._cursor = 0;
74
+ }
75
+
76
+ Hash.prototype.first = function() {
77
+ this.reset();
78
+ return this.next();
79
+ }
80
+
81
+ Hash.prototype.next = function() {
82
+ if (this._cursor++ < this._keys.length)
83
+ return {key: this._keys[this._cursor-1], value: this._vals[this._cursor-1]};
84
+ }
@@ -0,0 +1,173 @@
1
+ /** Handle the creation of HTML links to documented symbols.
2
+ @constructor
3
+ */
4
+ function Link() {
5
+ this.alias = "";
6
+ this.src = "";
7
+ this.file = "";
8
+ this.text = "";
9
+ this.innerName = "";
10
+ this.classLink = false;
11
+ this.targetName = "";
12
+
13
+ this.target = function(targetName) {
14
+ if (defined(targetName)) this.targetName = targetName;
15
+ return this;
16
+ }
17
+ this.inner = function(inner) {
18
+ if (defined(inner)) this.innerName = inner;
19
+ return this;
20
+ }
21
+ this.withText = function(text) {
22
+ if (defined(text)) this.text = text;
23
+ return this;
24
+ }
25
+ this.toSrc = function(filename) {
26
+ if (defined(filename)) this.src = filename;
27
+ return this;
28
+ }
29
+ this.toSymbol = function(alias) {
30
+ if (defined(alias)) this.alias = new String(alias);
31
+ return this;
32
+ }
33
+ this.toClass = function(alias) {
34
+ this.classLink = true;
35
+ return this.toSymbol(alias);
36
+ }
37
+ this.toFile = function(file) {
38
+ if (defined(file)) this.file = file;
39
+ return this;
40
+ }
41
+
42
+ this.toString = function() {
43
+ var linkString;
44
+ var thisLink = this;
45
+
46
+ if (this.alias) {
47
+ linkString = this.alias.replace(/(^|[^a-z$0-9_#.:^-])([|a-z$0-9_#.:^-]+)($|[^a-z$0-9_#.:^-])/i,
48
+ function(match, prematch, symbolName, postmatch) {
49
+ var symbolNames = symbolName.split("|");
50
+ var links = [];
51
+ for (var i = 0, l = symbolNames.length; i < l; i++) {
52
+ thisLink.alias = symbolNames[i];
53
+ links.push(thisLink._makeSymbolLink(symbolNames[i]));
54
+ }
55
+ return prematch+links.join("|")+postmatch;
56
+ }
57
+ );
58
+ }
59
+ else if (this.src) {
60
+ linkString = thisLink._makeSrcLink(this.src);
61
+ }
62
+ else if (this.file) {
63
+ linkString = thisLink._makeFileLink(this.file);
64
+ }
65
+
66
+ return linkString;
67
+ }
68
+ }
69
+
70
+ /** prefixed for hashes */
71
+ Link.hashPrefix = "";
72
+
73
+ /** Appended to the front of relative link paths. */
74
+ Link.base = "";
75
+
76
+ Link.symbolNameToLinkName = function(symbol) {
77
+ var linker = "",
78
+ ns = "";
79
+
80
+ if (symbol.isStatic) linker = ".";
81
+ else if (symbol.isInner) linker = "-";
82
+
83
+ if (symbol.isEvent && !/^event:/.test(symbol.name)) {
84
+ ns = "event:";
85
+ }
86
+ return Link.hashPrefix+linker+ns+symbol.name;
87
+ }
88
+
89
+ Link.getSymbol= function(alias) {
90
+ var symbol= Link.symbolSet.getSymbol(alias);
91
+
92
+ if (symbol)
93
+ return symbol;
94
+
95
+ if ('#'!==alias.charAt(0) || !Link.currentSymbol)
96
+ return null;
97
+
98
+ // resolve relative name
99
+ var container= Link.currentSymbol;
100
+
101
+ while (container)
102
+ {
103
+ symbol= Link.symbolSet.getSymbol(container.alias + alias);
104
+ if (symbol)
105
+ return symbol;
106
+
107
+ // No superclass
108
+ if (!container.augments.length)
109
+ return null;
110
+
111
+ container= Link.symbolSet.getSymbol(container.augments[0].desc);
112
+ }
113
+
114
+ return null;
115
+ }
116
+
117
+ /** Create a link to another symbol. */
118
+ Link.prototype._makeSymbolLink = function(alias) {
119
+ var linkBase = Link.base+publish.conf.symbolsDir;
120
+ var linkTo = Link.getSymbol(alias);
121
+ var linkPath;
122
+ var target = (this.targetName)? " target=\""+this.targetName+"\"" : "";
123
+
124
+ // if there is no symbol by that name just return the name unaltered
125
+ if (!linkTo)
126
+ return this.text || alias;
127
+
128
+ // it's a symbol in another file
129
+ else {
130
+ if (!linkTo.is("CONSTRUCTOR") && !linkTo.isNamespace) { // it's a method or property
131
+ linkPath= (Link.filemap) ? Link.filemap[linkTo.memberOf] :
132
+ escape(linkTo.memberOf) || "_global_";
133
+ linkPath += publish.conf.ext + "#" + Link.symbolNameToLinkName(linkTo);
134
+ }
135
+ else {
136
+ linkPath = (Link.filemap)? Link.filemap[linkTo.alias] : escape(linkTo.alias);
137
+ linkPath += publish.conf.ext;// + (this.classLink? "":"#" + Link.hashPrefix + "constructor");
138
+ }
139
+ linkPath = linkBase + linkPath
140
+ }
141
+
142
+ var linkText= this.text || alias;
143
+
144
+ var link = {linkPath: linkPath, linkText: linkText, linkInner: (this.innerName? "#"+this.innerName : "")};
145
+
146
+ if (typeof JSDOC.PluginManager != "undefined") {
147
+ JSDOC.PluginManager.run("onSymbolLink", link);
148
+ }
149
+
150
+ return "<a href=\""+link.linkPath+link.linkInner+"\""+target+">"+link.linkText+"</a>";
151
+ }
152
+
153
+ /** Create a link to a source file. */
154
+ Link.prototype._makeSrcLink = function(srcFilePath) {
155
+ var target = (this.targetName)? " target=\""+this.targetName+"\"" : "";
156
+
157
+ // transform filepath into a filename
158
+ var srcFile = srcFilePath.replace(/\.\.?[\\\/]/g, "").replace(/[:\\\/]/g, "_");
159
+ var outFilePath = Link.base + publish.conf.srcDir + srcFile + publish.conf.ext;
160
+
161
+ if (!this.text) this.text = FilePath.fileName(srcFilePath);
162
+ return "<a href=\""+outFilePath+"\""+target+">"+this.text+"</a>";
163
+ }
164
+
165
+ /** Create a link to a source file. */
166
+ Link.prototype._makeFileLink = function(filePath) {
167
+ var target = (this.targetName)? " target=\""+this.targetName+"\"" : "";
168
+
169
+ var outFilePath = Link.base + filePath;
170
+
171
+ if (!this.text) this.text = filePath;
172
+ return "<a href=\""+outFilePath+"\""+target+">"+this.text+"</a>";
173
+ }
@@ -0,0 +1,10 @@
1
+ _global_ = this;
2
+
3
+ function Namespace(name, f) {
4
+ var n = name.split(".");
5
+ for (var o = _global_, i = 0, l = n.length; i < l; i++) {
6
+ o = o[n[i]] = o[n[i]] || {};
7
+ }
8
+
9
+ if (f) f();
10
+ }
@@ -0,0 +1,134 @@
1
+ /** @namespace */
2
+ Opt = {
3
+ /**
4
+ * Get commandline option values.
5
+ * @param {Array} args Commandline arguments. Like ["-a=xml", "-b", "--class=new", "--debug"]
6
+ * @param {object} optNames Map short names to long names. Like {a:"accept", b:"backtrace", c:"class", d:"debug"}.
7
+ * @return {object} Short names and values. Like {a:"xml", b:true, c:"new", d:true}
8
+ */
9
+ get: function(args, optNames) {
10
+ var opt = {"_": []}; // the unnamed option allows multiple values
11
+ for (var i = 0; i < args.length; i++) {
12
+ var arg = new String(args[i]);
13
+ var name;
14
+ var value;
15
+ if (arg.charAt(0) == "-") {
16
+ if (arg.charAt(1) == "-") { // it's a longname like --foo
17
+ arg = arg.substring(2);
18
+ var m = arg.split("=");
19
+ name = m.shift();
20
+ value = m.shift();
21
+ if (typeof value == "undefined") value = true;
22
+
23
+ for (var n in optNames) { // convert it to a shortname
24
+ if (name == optNames[n]) {
25
+ name = n;
26
+ }
27
+ }
28
+ }
29
+ else { // it's a shortname like -f
30
+ arg = arg.substring(1);
31
+ var m = arg.split("=");
32
+ name = m.shift();
33
+ value = m.shift();
34
+ if (typeof value == "undefined") value = true;
35
+
36
+ for (var n in optNames) { // find the matching key
37
+ if (name == n || name+'[]' == n) {
38
+ name = n;
39
+ break;
40
+ }
41
+ }
42
+ }
43
+ if (name.match(/(.+)\[\]$/)) { // it's an array type like n[]
44
+ name = RegExp.$1;
45
+ if (!opt[name]) opt[name] = [];
46
+ }
47
+
48
+ if (opt[name] && opt[name].push) {
49
+ opt[name].push(value);
50
+ }
51
+ else {
52
+ opt[name] = value;
53
+ }
54
+ }
55
+ else { // not associated with any optname
56
+ opt._.push(args[i]);
57
+ }
58
+ }
59
+ return opt;
60
+ }
61
+ }
62
+
63
+ /*t:
64
+ plan(11, "Testing Opt.");
65
+
66
+ is(
67
+ typeof Opt,
68
+ "object",
69
+ "Opt is an object."
70
+ );
71
+
72
+ is(
73
+ typeof Opt.get,
74
+ "function",
75
+ "Opt.get is a function."
76
+ );
77
+
78
+ var optNames = {a:"accept", b:"backtrace", c:"class", d:"debug", "e[]":"exceptions"};
79
+ var t_options = Opt.get(["-a=xml", "-b", "--class=new", "--debug", "-e=one", "-e=two", "foo", "bar"], optNames);
80
+
81
+ is(
82
+ t_options.a,
83
+ "xml",
84
+ "an option defined with a short name can be accessed by its short name."
85
+ );
86
+
87
+ is(
88
+ t_options.b,
89
+ true,
90
+ "an option defined with a short name and no value are true."
91
+ );
92
+
93
+ is(
94
+ t_options.c,
95
+ "new",
96
+ "an option defined with a long name can be accessed by its short name."
97
+ );
98
+
99
+ is(
100
+ t_options.d,
101
+ true,
102
+ "an option defined with a long name and no value are true."
103
+ );
104
+
105
+ is(
106
+ typeof t_options.e,
107
+ "object",
108
+ "an option that can accept multiple values is defined."
109
+ );
110
+
111
+ is(
112
+ t_options.e.length,
113
+ 2,
114
+ "an option that can accept multiple values can have more than one value."
115
+ );
116
+
117
+ is(
118
+ t_options.e[1],
119
+ "two",
120
+ "an option that can accept multiple values can be accessed as an array."
121
+ );
122
+
123
+ is(
124
+ typeof t_options._,
125
+ "object",
126
+ "the property '_' is defined for unnamed options."
127
+ );
128
+
129
+ is(
130
+ t_options._[0],
131
+ "foo",
132
+ "the property '_' can be accessed as an array."
133
+ );
134
+ */