aboutsummaryrefslogtreecommitdiff
path: root/tools/jsdoc-toolkit-2.4.0/app/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'tools/jsdoc-toolkit-2.4.0/app/plugins')
-rw-r--r--tools/jsdoc-toolkit-2.4.0/app/plugins/commentSrcJson.js20
-rw-r--r--tools/jsdoc-toolkit-2.4.0/app/plugins/frameworkPrototype.js16
-rw-r--r--tools/jsdoc-toolkit-2.4.0/app/plugins/functionCall.js10
-rw-r--r--tools/jsdoc-toolkit-2.4.0/app/plugins/publishSrcHilite.js62
-rw-r--r--tools/jsdoc-toolkit-2.4.0/app/plugins/symbolLink.js10
-rw-r--r--tools/jsdoc-toolkit-2.4.0/app/plugins/tagParamConfig.js31
-rw-r--r--tools/jsdoc-toolkit-2.4.0/app/plugins/tagSynonyms.js43
7 files changed, 192 insertions, 0 deletions
diff --git a/tools/jsdoc-toolkit-2.4.0/app/plugins/commentSrcJson.js b/tools/jsdoc-toolkit-2.4.0/app/plugins/commentSrcJson.js
new file mode 100644
index 0000000..e826b57
--- /dev/null
+++ b/tools/jsdoc-toolkit-2.4.0/app/plugins/commentSrcJson.js
@@ -0,0 +1,20 @@
+JSDOC.PluginManager.registerPlugin(
+ "JSDOC.commentSrcJson",
+ {
+ onDocCommentSrc: function(comment) {
+ var json;
+ if (/^\s*@json\b/.test(comment)) {
+ comment.src = new String(comment.src).replace("@json", "");
+
+ eval("json = "+comment.src);
+ var tagged = "";
+ for (var i in json) {
+ var tag = json[i];
+ // todo handle cases where tag is an object
+ tagged += "@"+i+" "+tag+"\n";
+ }
+ comment.src = tagged;
+ }
+ }
+ }
+); \ No newline at end of file
diff --git a/tools/jsdoc-toolkit-2.4.0/app/plugins/frameworkPrototype.js b/tools/jsdoc-toolkit-2.4.0/app/plugins/frameworkPrototype.js
new file mode 100644
index 0000000..9c41751
--- /dev/null
+++ b/tools/jsdoc-toolkit-2.4.0/app/plugins/frameworkPrototype.js
@@ -0,0 +1,16 @@
+JSDOC.PluginManager.registerPlugin(
+ "JSDOC.frameworkPrototype",
+ {
+ onPrototypeClassCreate: function(classCreator) {
+ var desc = "";
+ if (classCreator.comment) {
+ desc = classCreator.comment;
+ }
+ var insert = desc+"/** @name "+classCreator.name+"\n@constructor\n@scope "+classCreator.name+".prototype */"
+
+ insert = insert.replace(/\*\/\/\*\*/g, "\n");
+ /*DEBUG*///print("insert is "+insert);
+ classCreator.addComment.data = insert;
+ }
+ }
+);
diff --git a/tools/jsdoc-toolkit-2.4.0/app/plugins/functionCall.js b/tools/jsdoc-toolkit-2.4.0/app/plugins/functionCall.js
new file mode 100644
index 0000000..6f87705
--- /dev/null
+++ b/tools/jsdoc-toolkit-2.4.0/app/plugins/functionCall.js
@@ -0,0 +1,10 @@
+JSDOC.PluginManager.registerPlugin(
+ "JSDOC.functionCall",
+ {
+ onFunctionCall: function(functionCall) {
+ if (functionCall.name == "dojo.define" && functionCall.arg1) {
+ functionCall.doc = "/** @lends "+eval(functionCall.arg1)+".prototype */";
+ }
+ }
+ }
+); \ No newline at end of file
diff --git a/tools/jsdoc-toolkit-2.4.0/app/plugins/publishSrcHilite.js b/tools/jsdoc-toolkit-2.4.0/app/plugins/publishSrcHilite.js
new file mode 100644
index 0000000..65514f2
--- /dev/null
+++ b/tools/jsdoc-toolkit-2.4.0/app/plugins/publishSrcHilite.js
@@ -0,0 +1,62 @@
+JSDOC.PluginManager.registerPlugin(
+ "JSDOC.publishSrcHilite",
+ {
+ onPublishSrc: function(src) {
+ if (src.path in JsHilite.cache) {
+ return; // already generated src code
+ }
+ else JsHilite.cache[src.path] = true;
+
+ try {
+ var sourceCode = IO.readFile(src.path);
+ }
+ catch(e) {
+ print(e.message);
+ quit();
+ }
+
+ var hiliter = new JsHilite(sourceCode, src.charset);
+ src.hilited = hiliter.hilite();
+ }
+ }
+);
+
+function JsHilite(src, charset) {
+
+ var tr = new JSDOC.TokenReader();
+
+ tr.keepComments = true;
+ tr.keepDocs = true;
+ tr.keepWhite = true;
+
+ this.tokens = tr.tokenize(new JSDOC.TextStream(src));
+
+ // TODO is redefining toString() the best way?
+ JSDOC.Token.prototype.toString = function() {
+ return "<span class=\""+this.type+"\">"+this.data.replace(/</g, "&lt;")+"</span>";
+ }
+
+ if (!charset) charset = "utf-8";
+
+ this.header = '<html><head><meta http-equiv="content-type" content="text/html; charset='+charset+'"> '+
+ "<style>\n\
+ .KEYW {color: #933;}\n\
+ .COMM {color: #bbb; font-style: italic;}\n\
+ .NUMB {color: #393;}\n\
+ .STRN {color: #393;}\n\
+ .REGX {color: #339;}\n\
+ .line {border-right: 1px dotted #666; color: #666; font-style: normal;}\n\
+ </style></head><body><pre>";
+ this.footer = "</pre></body></html>";
+ this.showLinenumbers = true;
+}
+
+JsHilite.cache = {};
+
+JsHilite.prototype.hilite = function() {
+ var hilited = this.tokens.join("");
+ var line = 1;
+ if (this.showLinenumbers) hilited = hilited.replace(/(^|\n)/g, function(m){return m+"<span class='line'>"+((line<10)? " ":"")+((line<100)? " ":"")+(line++)+"</span> "});
+
+ return this.header+hilited+this.footer;
+} \ No newline at end of file
diff --git a/tools/jsdoc-toolkit-2.4.0/app/plugins/symbolLink.js b/tools/jsdoc-toolkit-2.4.0/app/plugins/symbolLink.js
new file mode 100644
index 0000000..c87f1ca
--- /dev/null
+++ b/tools/jsdoc-toolkit-2.4.0/app/plugins/symbolLink.js
@@ -0,0 +1,10 @@
+JSDOC.PluginManager.registerPlugin(
+ "JSDOC.symbolLink",
+ {
+ onSymbolLink: function(link) {
+ // modify link.linkPath (the href part of the link)
+ // or link.linkText (the text displayed)
+ // or link.linkInner (the #name part of the link)
+ }
+ }
+); \ No newline at end of file
diff --git a/tools/jsdoc-toolkit-2.4.0/app/plugins/tagParamConfig.js b/tools/jsdoc-toolkit-2.4.0/app/plugins/tagParamConfig.js
new file mode 100644
index 0000000..3ea8a1b
--- /dev/null
+++ b/tools/jsdoc-toolkit-2.4.0/app/plugins/tagParamConfig.js
@@ -0,0 +1,31 @@
+JSDOC.PluginManager.registerPlugin(
+ "JSDOC.tagParamConfig",
+ {
+ onDocCommentTags: function(comment) {
+ var currentParam = null;
+ var tags = comment.tags;
+ for (var i = 0, l = tags.length; i < l; i++) {
+
+ if (tags[i].title == "param") {
+ if (tags[i].name.indexOf(".") == -1) {
+ currentParam = i;
+ }
+ }
+ else if (tags[i].title == "config") {
+ tags[i].title = "param";
+ if (currentParam == null) {
+ tags[i].name = "arguments"+"."+tags[i].name;
+ }
+ else if (tags[i].name.indexOf(tags[currentParam].name+".") != 0) {
+ tags[i].name = tags[currentParam].name+"."+tags[i].name;
+ }
+ currentParam != null
+ //tags[currentParam].properties.push(tags[i]);
+ }
+ else {
+ currentParam = null;
+ }
+ }
+ }
+ }
+);
diff --git a/tools/jsdoc-toolkit-2.4.0/app/plugins/tagSynonyms.js b/tools/jsdoc-toolkit-2.4.0/app/plugins/tagSynonyms.js
new file mode 100644
index 0000000..49a874f
--- /dev/null
+++ b/tools/jsdoc-toolkit-2.4.0/app/plugins/tagSynonyms.js
@@ -0,0 +1,43 @@
+JSDOC.PluginManager.registerPlugin(
+ "JSDOC.tagSynonyms",
+ {
+ onDocCommentSrc: function(comment) {
+ comment.src = comment.src.replace(/@methodOf\b/i, "@function\n@memberOf");
+ comment.src = comment.src.replace(/@fieldOf\b/i, "@field\n@memberOf");
+ },
+
+ onDocCommentTags: function(comment) {
+ for (var i = 0, l = comment.tags.length; i < l; i++) {
+ var title = comment.tags[i].title.toLowerCase();
+ var syn;
+ if ((syn = JSDOC.tagSynonyms.synonyms["="+title])) {
+ comment.tags[i].title = syn;
+ }
+ }
+ }
+ }
+);
+
+new Namespace(
+ "JSDOC.tagSynonyms",
+ function() {
+ JSDOC.tagSynonyms.synonyms = {
+ "=member": "memberOf",
+ "=memberof": "memberOf",
+ "=description": "desc",
+ "=exception": "throws",
+ "=argument": "param",
+ "=returns": "return",
+ "=classdescription": "class",
+ "=fileoverview": "overview",
+ "=extends": "augments",
+ "=base": "augments",
+ "=projectdescription": "overview",
+ "=classdescription": "class",
+ "=link": "see",
+ "=borrows": "inherits",
+ "=scope": "lends",
+ "=construct": "constructor"
+ }
+ }
+); \ No newline at end of file