can generate jsdoc; private methods marked as such
[dygraphs.git] / jsdoc-toolkit / app / plugins / commentSrcJson.js
diff --git a/jsdoc-toolkit/app/plugins/commentSrcJson.js b/jsdoc-toolkit/app/plugins/commentSrcJson.js
new file mode 100644 (file)
index 0000000..e826b57
--- /dev/null
@@ -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