Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
  • 2 commits
  • 3 files changed
  • 0 comments
  • 2 contributors
16  README
@@ -10,4 +10,18 @@
10 10
 Docco is a quick-and-dirty, hundred-line-long, literate-programming-style
11 11
 documentation generator. For more information, see:
12 12
 
13  
-http://jashkenas.github.com/docco/
  13
+http://jashkenas.github.com/docco/
  14
+
  15
+===================================================================
  16
+
  17
+This fork supports JSDoc style comments and highlights declared parameters.
  18
+
  19
+Example:
  20
+
  21
+/**
  22
+ * @description Lolify someone's name
  23
+ * @param {String} name A person's name
  24
+ */
  25
+function lolify(name) {
  26
+   return 'OH HAI ' + name + ' KTHXBAI';
  27
+}
9  lib/docco.js
@@ -14,7 +14,8 @@
14 14
   };
15 15
 
16 16
   parse = function(source, code) {
17  
-    var code_text, docs_text, has_code, incomment, language, line, lines, save, sections, _i, _len;
  17
+    var code_text, docs_text, has_code, incomment, language, line, lines, param, save, sections, _i, _len;
  18
+    param = '';
18 19
     lines = code.split('\n');
19 20
     sections = [];
20 21
     language = get_language(source);
@@ -38,6 +39,9 @@
38 39
         line = line.replace(language.comment_exit, '');
39 40
         line = line.replace(language.comment_enter, '');
40 41
         line = line.replace(language.comment_matcher, '');
  42
+        line = line.replace(/^ +/, '');
  43
+        param = line.match(language.param);
  44
+        if (param) line = line.replace(param[0], '\n' + '<b>' + param[1] + '</b>');
41 45
         docs_text += line + '\n';
42 46
       } else {
43 47
         has_code = true;
@@ -120,7 +124,8 @@
120 124
       name: 'javascript',
121 125
       symbol: '//',
122 126
       enter: '/\\*\+',
123  
-      exit: '\\*\+/'
  127
+      exit: '\\*\+/',
  128
+      param: /\* *@([a-zA-Z]+)/
124 129
     },
125 130
     '.rb': {
126 131
       name: 'ruby',
7  src/docco.coffee
@@ -75,6 +75,7 @@ generate_documentation = (source, callback) ->
75 75
 #     }
76 76
 #
77 77
 parse = (source, code) ->
  78
+  param    = ''
78 79
   lines    = code.split '\n'
79 80
   sections = []
80 81
   language = get_language source
@@ -96,6 +97,10 @@ parse = (source, code) ->
96 97
       line = line.replace(language.comment_exit, '')
97 98
       line = line.replace(language.comment_enter, '')
98 99
       line = line.replace(language.comment_matcher, '')
  100
+      line = line.replace(/^ +/, '');
  101
+      param = line.match(language.param);
  102
+      if param
  103
+        line = line.replace(param[0], '\n' + '<b>' + param[1] + '</b>');
99 104
       docs_text += line + '\n'
100 105
     else
101 106
       has_code = yes
@@ -165,7 +170,7 @@ languages =
165 170
   '.coffee':
166 171
     name: 'coffee-script', symbol: '#'
167 172
   '.js':
168  
-    name: 'javascript', symbol: '//', enter: '/\\*\+', exit: '\\*\+/'
  173
+    name: 'javascript', symbol: '//', enter: '/\\*\+', exit: '\\*\+/', param: /\* *@([a-zA-Z]+)/
169 174
   '.rb':
170 175
     name: 'ruby', symbol: '#'
171 176
   '.py':

No commit comments for this range

Something went wrong with that request. Please try again.