Skip to content

Commit 2481dcd

Browse files
committed
Document a bunch of tags
1 parent 50509ba commit 2481dcd

File tree

13 files changed

+253
-219
lines changed

13 files changed

+253
-219
lines changed

tags/class.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ var getParent = require("bit-docs-process-tags/get-parent"),
1616
module.exports = {
1717
add: function(line, curData, scope, docMap){
1818
console.warn("Using the @class directive. It is deprecated!");
19-
// it's possible this has already been matched as something else ... clear parent
19+
// it's possible this has already been matched as something else
20+
// ... clear parent
2021

2122
this.type = "constructor";
2223
var data = tnd(line);

tags/codeend.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
/**
22
* @hide
3-
* @constructor documentjs.tags.codeend @codeend
4-
* @tag documentation
5-
* @parent documentjs.tags
3+
* @parent bit-docs-js/tags
4+
* @module {bit-docs-js/tag} bit-docs-js/tags/codeend @codeend
65
*
76
* @description
87
*
98
* Stops a code block.
109
*
11-
* ###Example:
10+
* ### Example:
1211
*
1312
* @codestart
1413
*
@@ -65,4 +64,4 @@
6564
return ["poppop", out];
6665
},
6766
keepStack: true
68-
};
67+
};

tags/codestart.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
2-
* @constructor documentjs.tags.codestart @codestart
32
* @hide
4-
* @parent documentjs.tags
3+
* @parent bit-docs-js/tags
4+
* @module {bit-docs-js/tag} bit-docs-js/tags/codestart @codestart
55
*
66
* Starts a code block.
77
*
@@ -11,7 +11,7 @@
1111
*
1212
* Must end with "@codeend".
1313
*
14-
* ###Example:
14+
* ### Example:
1515
*
1616
* @codestart
1717
*

tags/function.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ keyFunction = /(?:([\w\.\$]+)|(["'][^"']+["']))\s*[:=].*function\s?\(([^\)]*)/;
88
namedFunction = /\s*function\s+([\w\.\$]+)\s*(~)?\(([^\)]*)/;
99

1010
/**
11-
* @module {Object} bit-docs-js/tags/function @function
1211
* @parent bit-docs-js/tags
12+
* @module {bit-docs-js/tag} bit-docs-js/tags/function @function
1313
*
1414
* @description Specifies the comment block is for a function. Use
1515
* [bit-docs-js/tags/param] to specify the parameters of a function.
@@ -180,4 +180,4 @@ module.exports = {
180180
data.params = [];
181181
}
182182
}
183-
};
183+
};

tags/module.md

Lines changed: 49 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,56 @@
1-
@module {bit-docs-process-tags/tag} bit-docs-js/tags/module @module
21
@parent bit-docs-js/tags
2+
@module {bit-docs-process-tags/tag} bit-docs-js/tags/module @module
33

44
Declares the export value for a module.
55

66
@signature `@module {TYPE} NAME [TITLE]`
77

8-
@codestart
8+
```js
99
/**
10-
* @module {{}} lib/componentProps props
11-
* @option {String} name The name of the component.
12-
* @option {String} title The title of the component.
13-
*|
14-
@codeend
10+
* @module {{}} lib/settings settings
11+
* @option {String} environment Production, development, or staging.
12+
* @option {Number} requestTimeout How long to wait between requests.
13+
*/
14+
export default {
15+
environment: "production",
16+
requestTimeout: 10000
17+
}
18+
```
19+
20+
```js
21+
// resulting docObject
22+
{
23+
"type": "module",
24+
"description": "",
25+
"title": "settings",
26+
"types": [
27+
{
28+
"type": "Object",
29+
"options": [
30+
{
31+
"name": "environment",
32+
"description": "Production, development, or staging.",
33+
"types": [
34+
{
35+
"type": "String"
36+
}
37+
]
38+
},
39+
{
40+
"name": "requestTimeout",
41+
"description": "How long to wait between requests.\n",
42+
"types": [
43+
{
44+
"type": "Number"
45+
}
46+
]
47+
}
48+
]
49+
}
50+
],
51+
"name": "lib/settings"
52+
}
53+
```
1554

1655
@param {bit-docs-type-annotate/typeExpression} [TYPE] A
1756
[bit-docs-type-annotate/typeExpression type expression]. This is typically an
@@ -30,7 +69,7 @@ exports you might use as one of the following:
3069

3170
#### A single function export
3271

33-
```
72+
```js
3473
/**
3574
* @module {function} multi/util/add
3675
* @parent multi/modules
@@ -50,7 +89,7 @@ module.exports = function(first, second) {
5089

5190
#### Multiple export values
5291

53-
```
92+
```js
5493
/**
5594
* @module {Module} multi/util/date-helpers
5695
* @parent multi/modules
@@ -73,7 +112,7 @@ exports.yesterday = function() { ... };
73112

74113
#### A single constructor function export
75114

76-
```
115+
```js
77116
/**
78117
* @module {function(new:multi/lib/graph)} multi/lib/graph
79118
* @parent multi/modules

tags/option.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,8 @@ var setOptionData = function (option, data) {
5353
};
5454

5555
/**
56-
* @module {bit-docs-process-tags/tag} bit-docs-js/tags/option @option
57-
* @tag documentation
5856
* @parent bit-docs-js/tags
57+
* @module {bit-docs-process-tags/tag} bit-docs-js/tags/option @option
5958
*
6059
* Describes a property of the object, or an argument of the function, that was
6160
* specified in an [bit-docs-js/tags/param] tag.
@@ -73,10 +72,9 @@ var setOptionData = function (option, data) {
7372
* * @param {function(Orders.List)} [success(orders)] Callback function.
7473
* * @option orders A list of [Orders] that match `params`.
7574
* *|
76-
* find: function( params, success ) {
75+
* find: function( params, success ) { ... }
7776
* @codeend
7877
*
79-
*
8078
* @param {bit-docs/typeExpression} [TYPE] A [bit-docs/typeExpression type expression]. Examples:
8179
*
8280
* `{String}` - type is a `String`.
@@ -95,13 +93,11 @@ var setOptionData = function (option, data) {
9593
* *|
9694
* @codeend
9795
*
98-
*
9996
* @param {bit-docs/nameExpression} NAME A [bit-docs/nameExpression name expression]. Examples:
10097
*
10198
* `age` - age is item.
10299
* `[age]` - age is item, age is optional.
103100
* `[age=0]` - age defaults to 0.
104-
*
105101
*
106102
* @param {Markdown} [DESCRIPTION] Markdown content that continues for multiple lines.
107103
*/

tags/param.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ var addParam = function (param, params) {
3434
};
3535

3636
/**
37-
* @module {Object} bit-docs-js/tags/param @param
3837
* @parent bit-docs-js/tags
38+
* @module {Object} bit-docs-js/tags/param @param
3939
*
4040
* Specifies parameter information for [bit-docs-js/tags/function] or
4141
* [bit-docs-js/tags/signature].
@@ -125,8 +125,8 @@ module.exports = {
125125
}
126126
}
127127

128-
// if we have a signiture, add this param to the last
129-
// signiture
128+
// if we have a signature, add this param to the last
129+
// signature
130130
if (this.signatures) {
131131
this.signatures[this.signatures.length - 1].params.push(param);
132132
} else {
@@ -171,4 +171,4 @@ module.exports = {
171171

172172
delete this._curParam;
173173
}
174-
};
174+
};

tags/property.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ var getParent = require("bit-docs-process-tags/get-parent"),
33
updateNameWithScope = require("../lib/updateNameAndParentWithScope");
44

55
/**
6-
* @module {bit-docs-process-tags/tag} bit-docs-js/tags/property @property
76
* @parent bit-docs-js/tags
7+
* @module {bit-docs-process-tags/tag} bit-docs-js/tags/property @property
88
*
99
* Documents a property of a parent object.
1010
*

tags/prototype.js

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

44
/**
5-
* @module {bit-docs-process-tags/tag} bit-docs-js/tags/prototype @prototype
65
* @parent bit-docs-js/tags
6+
* @module {bit-docs-process-tags/tag} bit-docs-js/tags/prototype @prototype
77
*
88
* Declares that [bit-docs-js/tags/property] and [bit-docs-js/tags/function]
99
* tags belong to the preceeding [bit-docs-js/tags/function]'s prototype

tags/return.js

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -11,30 +11,30 @@ var addReturnToTypes = function(tagData, returns){
1111
}
1212
};
1313

14-
/**
15-
* @constructor documentjs.tags.return @return
16-
* @parent documentjs.tags
17-
*
18-
* Describes a function's return value.
19-
*
20-
* @signature `@return {TYPE} DESCRIPTION`
21-
*
22-
* @codestart javascript
23-
* /**
24-
* * Capitalizes a string
25-
* * @@param {String} s the string to be lowercased.
26-
* * @@return {String} a string with the first character capitalized,
27-
* * and everything else lowercased
28-
* *|
29-
* capitalize: function( s ) { ... }
30-
* @codeend
31-
*
32-
* @param {documentjs.typeExpression} [TYPE] The type of
33-
* return value.
34-
*
35-
* @param {String} [DESCRIPTION] The description of the
36-
* return value.
37-
*/
14+
/**
15+
* @parent bit-docs-js/tags
16+
* @module {bit-docs-js/tag} bit-docs-js/tags/return @return
17+
*
18+
* Describes a function's return value.
19+
*
20+
* @signature `@return {TYPE} DESCRIPTION`
21+
*
22+
* @codestart javascript
23+
* /**
24+
* * Capitalizes a string
25+
* * @@param {String} s the string to be lowercased.
26+
* * @@return {String} a string with the first character capitalized,
27+
* * and everything else lowercased
28+
* *|
29+
* capitalize: function( s ) { ... }
30+
* @codeend
31+
*
32+
* @param {documentjs.typeExpression} [TYPE] The type of
33+
* return value.
34+
*
35+
* @param {String} [DESCRIPTION] The description of the
36+
* return value.
37+
*/
3838
module.exports = {
3939
add: function( line, tagData ) {
4040

0 commit comments

Comments
 (0)