Skip to content

Commit 2d85a64

Browse files
committed
Modify various docs
1 parent 11dbdc9 commit 2d85a64

File tree

6 files changed

+98
-90
lines changed

6 files changed

+98
-90
lines changed

bit-docs.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ var path = require("path");
55
/**
66
* @parent plugins
77
* @module {function} bit-docs-js
8+
* @group bit-docs-js/modules modules
89
* @group bit-docs-js/tags tags
9-
* @group bit-docs-js/theme theme
10+
* @group bit-docs-js/templates templates
1011
*
1112
* @description Tags, templates, and basic styles for JavaScript.
1213
*
@@ -20,11 +21,19 @@ var path = require("path");
2021
* - `processor`
2122
* - `html`
2223
*
23-
* Registering the `tag` hook adds JavaScript-related tags:
24+
* Registering the `tags` hook adds JavaScript-related tags:
25+
* - [bit-docs-js/tags/codeend @codeend]
26+
* - [bit-docs-js/tags/codestart @codestart]
2427
* - [bit-docs-js/tags/function @function]
28+
* - [bit-docs-js/tags/module @module]
29+
* - [bit-docs-js/tags/option @option]
2530
* - [bit-docs-js/tags/param @param]
31+
* - [bit-docs-js/tags/property @property]
32+
* - [bit-docs-js/tags/prototype @prototype]
33+
* - [bit-docs-js/tags/return @return]
2634
* - [bit-docs-js/tags/signature @signature]
27-
* - ...
35+
* - [bit-docs-js/tags/static @static]
36+
* - [bit-docs-js/tags/typedef @typedef]
2837
*
2938
* Registering the `processor` hook adds a processor for `*.js` files that gets
3039
* code comments in JavaScript, and processes tags like `@function` and

process/code.js

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,22 @@
11
var _ = require("lodash");
22
/**
3-
* @function documentjs.process.code
4-
* @parent documentjs.process.methods
3+
* @parent bit-docs-js/modules
4+
* @module {function} bit-docs-js/process/code code
55
*
66
* Process a code hint into properties on a `docObject`.
77
*
8-
* @signature `documentjs.process.code(options, callback)`
8+
* @signature `processCode(options, callback)`
99
*
10-
* Using the `options.code`, and `options.tags`, processes the code
11-
* into properties on a docObject. The `callback` is called with the new docObject.
10+
* Using the `options.code`, and `options.tags`, processes the code into
11+
* properties on a docObject. The `callback` is called with the new docObject.
1212
*
13-
* @param {documentjs.process.processOptions} options An options object that contains
14-
* the code to process.
13+
* @param {bit-docs/types/processOptions} options An options object that
14+
* contains the code to process.
1515
*
16-
* @param {function(documentjs.process.docObject,documentjs.process.docObject)} callback(newDoc,newScope)
16+
* @param {function(bit-docs/types/docObject,bit-docs/types/docObject)} callback(newDoc,newScope)
1717
*
18-
* A function that is called back with a docObject created from the code and the scope
19-
* `docObject`. If
20-
* no docObject is created, `newDoc` will be null.
18+
* A function that is called back with a docObject created from the code and
19+
* the scope `docObject`. If no docObject is created, `newDoc` will be null.
2120
*
2221
* @body
2322
*

process/code_and_comment.js

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,33 @@
1-
var processCode = require("./code"),
2-
processTags = require("bit-docs-process-tags");
1+
var processCode = require("./code");
2+
var processTags = require("bit-docs-process-tags");
33

44
var typeCheckReg = /^\s*@(\w+)/;
5+
56
/**
6-
* @function documentjs.process.codeAndComment
7-
* @parent documentjs.process.methods
7+
* @parent bit-docs-js/modules
8+
* @module {function} bit-docs-js/process/codeAndComment codeAndComment
89
*
9-
* @signature `documentjs.process.codeAndComment(options, callback)`
10+
* @signature `processCodeAndComment(options, callback)`
1011
*
1112
* Processes a code suggestion and then a comment and produces a docObject.
1213
*
13-
* @param {documentjs.process.processOptions} options An options object that contains
14-
* the code and comment to process.
14+
* @param {bit-docs/types/processOptions} options An options object that
15+
* contains the code and comment to process.
1516
*
16-
* @param {function(documentjs.process.docObject,documentjs.process.docObject)} callback(newDoc,newScope)
17+
* @param {function(bit-docs/types/docObject,bit-docs/types/docObject)} callback(newDoc,newScope)
1718
*
18-
* A function that is called back with a docObject created from the code and the scope
19-
* `docObject`. If
20-
* no docObject is created, `newDoc` will be null.
19+
* A function that is called back with a docObject created from the code and
20+
* the scope `docObject`. If no docObject is created, `newDoc` will be null.
2121
*
2222
* @option newDoc the new documentation object
2323
* @option newScope the new scope
2424
*/
2525
module.exports = function(options, callback){
26-
var self = this,
27-
comment = options.comment;
26+
var self = this;
27+
var comment = options.comment;
2828

29-
var firstLine = (typeof comment == 'string' ? comment : comment[0]) || "",
30-
check = firstLine.match(typeCheckReg);
29+
var firstLine = (typeof comment == 'string' ? comment : comment[0]) || "";
30+
var check = firstLine.match(typeCheckReg);
3131

3232
if(check){
3333
if(!options.docObject){

tags/class.js

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
1-
var getParent = require("bit-docs-process-tags/get-parent"),
2-
tnd = require("bit-docs-type-annotate").typeNameDescription;
1+
var getParent = require("bit-docs-process-tags/get-parent");
2+
var tnd = require("bit-docs-type-annotate").typeNameDescription;
33

4-
var funcMatch = /(?:([\w\.\$]+)|(["'][^"']+["']))\s*[=]\s*function\s?\(([^\)]*)/,
5-
codeMatch = /([\w\.\$]+?).extend\(\s*["']([^"']*)["']/;
4+
var funcMatch = /(?:([\w\.\$]+)|(["'][^"']+["']))\s*[=]\s*function\s?\(([^\)]*)/;
5+
var codeMatch = /([\w\.\$]+?).extend\(\s*["']([^"']*)["']/;
66

77
/**
8-
* @module {bit-docs-process-tags/tag} bit-docs-js/tags/constructor @constructor
98
* @parent bit-docs-js/tags
9+
* @module {bit-docs-process-tags/tag} bit-docs-js/tags/class @class
1010
* @hide
1111
*
12-
* Document a constructor function.
12+
* DEPRECATED: Gets converted to [bit-docs-js/tags/constructor].
1313
*
14-
* @signature `@constructor NAME [TITLE]`
14+
* @signature `@class NAME [TITLE]`
1515
*/
16-
module.exports = {
17-
add: function(line, curData, scope, docMap){
18-
console.warn("Using the @class directive. It is deprecated!");
19-
// it's possible this has already been matched as something else
20-
// ... clear parent
16+
module.exports = {
17+
add: function(line, curData, scope, docMap){
18+
console.warn("Using the @class directive. It is deprecated!");
19+
// it's possible this has already been matched as something else
20+
// ... clear parent
2121

22-
this.type = "constructor";
23-
var data = tnd(line);
24-
if(data.name) {
25-
this.name = data.name;
26-
}
27-
28-
this.title = data.description;
29-
return ["scope",this];
22+
this.type = "constructor";
23+
var data = tnd(line);
24+
if(data.name) {
25+
this.name = data.name;
3026
}
31-
};
27+
28+
this.title = data.description;
29+
return ["scope",this];
30+
}
31+
};

tags/constructor.js

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,53 @@
1-
var getParent = require("bit-docs-process-tags/get-parent"),
2-
tnd = require("bit-docs-type-annotate").typeNameDescription;
1+
var getParent = require("bit-docs-process-tags/get-parent");
2+
var tnd = require("bit-docs-type-annotate").typeNameDescription;
33

4-
var funcMatch = /(?:([\w\.\$]+)|(["'][^"']+["']))\s*[=]\s*function\s?\(([^\)]*)/,
5-
codeMatch = /([\w\.\$]+?).extend\(\s*["']([^"']*)["']/;
4+
var funcMatch = /(?:([\w\.\$]+)|(["'][^"']+["']))\s*[=]\s*function\s?\(([^\)]*)/;
5+
var codeMatch = /([\w\.\$]+?).extend\(\s*["']([^"']*)["']/;
66

77
/**
8-
* @module {bit-docs-process-tags/tag} bit-docs-js/tags/constructor @constructor
98
* @parent bit-docs-js/tags
9+
* @module {bit-docs-process-tags/tag} bit-docs-js/tags/constructor @constructor
1010
* @hide
1111
*
1212
* Document a constructor function.
1313
*
1414
* @signature `@constructor NAME [TITLE]`
1515
*/
16-
module.exports = {
17-
codeMatch: function(code){
18-
return codeMatch.test(code);
19-
},
20-
code: function( code ) {
21-
22-
var parts = code.match(codeMatch);
23-
if ( parts ) {
24-
return {
25-
name: parts[2],
26-
inherits: parts[1].replace(/^\$./, "jQuery."),
27-
type: "constructor"
28-
};
29-
}
30-
parts = code.match(funcMatch)
16+
module.exports = {
17+
codeMatch: function(code){
18+
return codeMatch.test(code);
19+
},
20+
code: function( code ) {
3121

32-
if ( parts ) {
33-
return {
34-
name: parts[1] ? parts[1].replace(/^this\./, "") : parts[2],
35-
type: "constructor"
36-
};
37-
}
38-
},
39-
codeScope: true,
40-
add: function(line, curData, scope, docMap){
22+
var parts = code.match(codeMatch);
23+
if ( parts ) {
24+
return {
25+
name: parts[2],
26+
inherits: parts[1].replace(/^\$./, "jQuery."),
27+
type: "constructor"
28+
};
29+
}
30+
parts = code.match(funcMatch)
4131

42-
// it's possible this has already been matched as something else ... clear parent
32+
if ( parts ) {
33+
return {
34+
name: parts[1] ? parts[1].replace(/^this\./, "") : parts[2],
35+
type: "constructor"
36+
};
37+
}
38+
},
39+
codeScope: true,
40+
add: function(line, curData, scope, docMap){
4341

44-
this.type = "constructor";
45-
var data = tnd(line);
46-
if(data.name) {
47-
this.name = data.name;
48-
}
42+
// it's possible this has already been matched as something else ... clear parent
4943

50-
this.title = data.description;
51-
return ["scope",this];
44+
this.type = "constructor";
45+
var data = tnd(line);
46+
if(data.name) {
47+
this.name = data.name;
5248
}
53-
};
49+
50+
this.title = data.description;
51+
return ["scope",this];
52+
}
53+
};

templates/signature.mustache.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
@parent bit-docs-js/theme
2-
@module bit-docs-js/site/templates/signature.mustache signature.mustache
1+
@parent bit-docs-js/templates
2+
@page bit-docs-js/templates/signature.mustache signature.mustache
33

44
@description The function signature template.
55

0 commit comments

Comments
 (0)