spacedocs 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +6 -2
- data/{source → lib}/class.html.haml +1 -4
- data/{source → lib}/index.html.haml +2 -2
- data/{dox → lib/node_modules/dox}/History.md +0 -0
- data/{dox → lib/node_modules/dox}/Makefile +0 -0
- data/{dox → lib/node_modules/dox}/Readme.md +0 -0
- data/{dox → lib/node_modules/dox}/bin/dox +0 -0
- data/{dox → lib/node_modules/dox}/index.js +0 -0
- data/{dox → lib/node_modules/dox}/lib/dox.js +1 -10
- data/{dox → lib/node_modules/dox}/lib/utils.js +0 -0
- data/lib/node_modules/dox/node_modules/commander/History.md +99 -0
- data/lib/node_modules/dox/node_modules/commander/Makefile +7 -0
- data/lib/node_modules/dox/node_modules/commander/Readme.md +263 -0
- data/lib/node_modules/dox/node_modules/commander/index.js +2 -0
- data/lib/node_modules/dox/node_modules/commander/lib/commander.js +992 -0
- data/lib/node_modules/dox/node_modules/commander/package.json +38 -0
- data/lib/node_modules/dox/node_modules/github-flavored-markdown/README.md +17 -0
- data/lib/node_modules/dox/node_modules/github-flavored-markdown/_config.yml +3 -0
- data/lib/node_modules/dox/node_modules/github-flavored-markdown/_layouts/default.html +77 -0
- data/lib/node_modules/dox/node_modules/github-flavored-markdown/code.rb +67 -0
- data/lib/node_modules/dox/node_modules/github-flavored-markdown/images/gfm.png +0 -0
- data/lib/node_modules/dox/node_modules/github-flavored-markdown/index.md +78 -0
- data/lib/node_modules/dox/node_modules/github-flavored-markdown/package.json +27 -0
- data/lib/node_modules/dox/node_modules/github-flavored-markdown/preview.md +27 -0
- data/lib/node_modules/dox/node_modules/github-flavored-markdown/sample_content.html +169 -0
- data/lib/node_modules/dox/node_modules/github-flavored-markdown/scripts/preview.js +18 -0
- data/lib/node_modules/dox/node_modules/github-flavored-markdown/scripts/showdown.js +1414 -0
- data/lib/node_modules/dox/node_modules/github-flavored-markdown/stylesheets/screen.css +20 -0
- data/lib/node_modules/dox/package.json +43 -0
- data/lib/spacedocs.rb +42 -53
- data/lib/{assets/stylesheets/spacedocs/docs.css.sass → spacedocs.sass} +0 -0
- data/lib/spacedocs/version.rb +1 -1
- metadata +116 -25
- data/dox/package.json +0 -16
- data/dox/test/dox.test.js +0 -287
- data/dox/test/fixtures/a.js +0 -12
- data/dox/test/fixtures/b.js +0 -26
- data/dox/test/fixtures/c.js +0 -266
- data/dox/test/fixtures/d.js +0 -15
- data/dox/test/fixtures/titles.js +0 -14
- data/lib/spacedocs/engine.rb +0 -6
data/dox/test/fixtures/a.js
DELETED
data/dox/test/fixtures/b.js
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
|
2
|
-
/**
|
3
|
-
* Library version.
|
4
|
-
*
|
5
|
-
* @type {String}
|
6
|
-
* @api public
|
7
|
-
*/
|
8
|
-
|
9
|
-
exports.version = '0.0.1';
|
10
|
-
|
11
|
-
/**
|
12
|
-
* Parse the given `str`.
|
13
|
-
*
|
14
|
-
* Examples:
|
15
|
-
*
|
16
|
-
* parse(str)
|
17
|
-
* // => "wahoo"
|
18
|
-
*
|
19
|
-
* @param {String|Buffer} str to parse
|
20
|
-
* @return {String}
|
21
|
-
* @api public
|
22
|
-
*/
|
23
|
-
|
24
|
-
exports.parse = function(str) {
|
25
|
-
return "wahoo";
|
26
|
-
}
|
data/dox/test/fixtures/c.js
DELETED
@@ -1,266 +0,0 @@
|
|
1
|
-
|
2
|
-
/*!
|
3
|
-
* Dox
|
4
|
-
* Copyright (c) 2010 TJ Holowaychuk <tj@vision-media.ca>
|
5
|
-
* MIT Licensed
|
6
|
-
*/
|
7
|
-
|
8
|
-
/**
|
9
|
-
* Module dependencies.
|
10
|
-
*/
|
11
|
-
|
12
|
-
var markdown = require('github-flavored-markdown').parse;
|
13
|
-
|
14
|
-
/**
|
15
|
-
* Library version.
|
16
|
-
*/
|
17
|
-
|
18
|
-
exports.version = '0.0.5';
|
19
|
-
|
20
|
-
/**
|
21
|
-
* Parse comments in the given string of `js`.
|
22
|
-
*
|
23
|
-
* @param {String} js
|
24
|
-
* @return {Array}
|
25
|
-
* @see exports.parseComment
|
26
|
-
* @api public
|
27
|
-
*/
|
28
|
-
|
29
|
-
exports.parseComments = function(js){
|
30
|
-
var comments = []
|
31
|
-
, comment
|
32
|
-
, buf = ''
|
33
|
-
, ignore
|
34
|
-
, within
|
35
|
-
, code;
|
36
|
-
|
37
|
-
for (var i = 0, len = js.length; i < len; ++i) {
|
38
|
-
// start comment
|
39
|
-
if ('/' == js[i] && '*' == js[i+1]) {
|
40
|
-
// code following previous comment
|
41
|
-
if (buf.trim().length) {
|
42
|
-
comment = comments[comments.length - 1];
|
43
|
-
comment.code = code = buf.trim();
|
44
|
-
comment.ctx = exports.parseCodeContext(code);
|
45
|
-
buf = '';
|
46
|
-
}
|
47
|
-
i += 2;
|
48
|
-
within = true;
|
49
|
-
ignore = '!' == js[i];
|
50
|
-
// end comment
|
51
|
-
} else if ('*' == js[i] && '/' == js[i+1]) {
|
52
|
-
i += 2;
|
53
|
-
buf = buf.replace(/^ *\* ?/gm, '');
|
54
|
-
var comment = exports.parseComment(buf);
|
55
|
-
comment.ignore = ignore;
|
56
|
-
comments.push(comment);
|
57
|
-
within = ignore = false;
|
58
|
-
buf = '';
|
59
|
-
// buffer comment or code
|
60
|
-
} else {
|
61
|
-
buf += js[i];
|
62
|
-
}
|
63
|
-
}
|
64
|
-
|
65
|
-
// trailing code
|
66
|
-
if (buf.trim().length) {
|
67
|
-
comment = comments[comments.length - 1];
|
68
|
-
code = buf.trim();
|
69
|
-
comment.code = code;
|
70
|
-
}
|
71
|
-
|
72
|
-
return comments;
|
73
|
-
};
|
74
|
-
|
75
|
-
/**
|
76
|
-
* Parse the given comment `str`.
|
77
|
-
*
|
78
|
-
* The comment object returned contains the following:
|
79
|
-
*
|
80
|
-
* - `tags` array of tag objects
|
81
|
-
* - `description` the first line of the comment
|
82
|
-
* - `body` lines following the description
|
83
|
-
* - `content` both the description and the body
|
84
|
-
* - `isPrivate` true when "@api private" is used
|
85
|
-
*
|
86
|
-
* @param {String} str
|
87
|
-
* @return {Object}
|
88
|
-
* @see exports.parseTag
|
89
|
-
* @api public
|
90
|
-
*/
|
91
|
-
|
92
|
-
exports.parseComment = function(str) {
|
93
|
-
str = str.trim();
|
94
|
-
var comment = { tags: [] }
|
95
|
-
, description = {};
|
96
|
-
|
97
|
-
// parse comment body
|
98
|
-
description.full = str.split('@')[0].replace(/^([\w ]+):/gm, '## $1');
|
99
|
-
description.summary = description.full.split('\n\n')[0];
|
100
|
-
description.body = description.full.split('\n\n').slice(1).join('\n\n');
|
101
|
-
comment.description = description;
|
102
|
-
|
103
|
-
// parse tags
|
104
|
-
if (~str.indexOf('@')) {
|
105
|
-
var tags = '@' + str.split('@').slice(1).join('@');
|
106
|
-
comment.tags = tags.split('\n').map(exports.parseTag);
|
107
|
-
comment.isPrivate = comment.tags.some(function(tag){
|
108
|
-
return 'api' == tag.type && 'private' == tag.visibility;
|
109
|
-
})
|
110
|
-
}
|
111
|
-
|
112
|
-
// markdown
|
113
|
-
description.full = markdown(escape(description.full));
|
114
|
-
description.summary = markdown(escape(description.summary));
|
115
|
-
description.body = markdown(escape(description.body));
|
116
|
-
|
117
|
-
return comment;
|
118
|
-
}
|
119
|
-
|
120
|
-
/**
|
121
|
-
* Parse tag string "@param {Array} name description" etc.
|
122
|
-
*
|
123
|
-
* @param {String}
|
124
|
-
* @return {Object}
|
125
|
-
* @api public
|
126
|
-
*/
|
127
|
-
|
128
|
-
exports.parseTag = function(str) {
|
129
|
-
var tag = {}
|
130
|
-
, parts = str.split(/ +/)
|
131
|
-
, type = tag.type = parts.shift().replace('@', '');
|
132
|
-
|
133
|
-
/* shouldn't fail */
|
134
|
-
switch (type) { // asfasdfasdf /** /////
|
135
|
-
case 'param':
|
136
|
-
tag.types = exports.parseTagTypes(parts.shift());
|
137
|
-
tag.name = parts.shift() || '';
|
138
|
-
tag.description = parts.join(' ');
|
139
|
-
break;
|
140
|
-
case 'return':
|
141
|
-
tag.types = exports.parseTagTypes(parts.shift());
|
142
|
-
tag.description = parts.join(' ');
|
143
|
-
break;
|
144
|
-
case 'see':
|
145
|
-
if (~str.indexOf('http')) {
|
146
|
-
tag.title = parts.length > 1
|
147
|
-
? parts.shift()
|
148
|
-
: '';
|
149
|
-
tag.url = parts.join(' ');
|
150
|
-
} else {
|
151
|
-
tag.local = parts.join(' ');
|
152
|
-
}
|
153
|
-
case 'api':
|
154
|
-
tag.visibility = parts.shift();
|
155
|
-
break;
|
156
|
-
case 'type':
|
157
|
-
tag.types = exports.parseTagTypes(parts.shift());
|
158
|
-
break;
|
159
|
-
}
|
160
|
-
|
161
|
-
return tag;
|
162
|
-
}
|
163
|
-
|
164
|
-
/**
|
165
|
-
* Parse tag type string "{Array|Object}" etc.
|
166
|
-
*
|
167
|
-
* @param {String} str
|
168
|
-
* @return {Array}
|
169
|
-
* @api public
|
170
|
-
*/
|
171
|
-
|
172
|
-
exports.parseTagTypes = function(str) {
|
173
|
-
return str
|
174
|
-
.replace(/[{}]/g, '')
|
175
|
-
.split(/ *[|,\/] */);
|
176
|
-
};
|
177
|
-
|
178
|
-
/**
|
179
|
-
* Parse the context from the given `str` of js.
|
180
|
-
*
|
181
|
-
* This method attempts to discover the context
|
182
|
-
* for the comment based on it's code. Currently
|
183
|
-
* supports:
|
184
|
-
*
|
185
|
-
* - function statements
|
186
|
-
* - function expressions
|
187
|
-
* - prototype methods
|
188
|
-
* - prototype properties
|
189
|
-
* - methods
|
190
|
-
* - properties
|
191
|
-
* - declarations
|
192
|
-
*
|
193
|
-
* @param {String} str
|
194
|
-
* @return {Object}
|
195
|
-
* @api public
|
196
|
-
*/
|
197
|
-
|
198
|
-
exports.parseCodeContext = function(str){
|
199
|
-
var str = str.split('\n')[0];
|
200
|
-
|
201
|
-
// function statement
|
202
|
-
if (/^function (\w+)\(/.exec(str)) {
|
203
|
-
return {
|
204
|
-
type: 'function'
|
205
|
-
, name: RegExp.$1
|
206
|
-
};
|
207
|
-
// function expression
|
208
|
-
} else if (/^var *(\w+) *= *function/.exec(str)) {
|
209
|
-
return {
|
210
|
-
type: 'function'
|
211
|
-
, name: RegExp.$1
|
212
|
-
};
|
213
|
-
// prototype method
|
214
|
-
} else if (/^(\w+)\.prototype\.(\w+) *= *function/.exec(str)) {
|
215
|
-
return {
|
216
|
-
type: 'method'
|
217
|
-
, constructor: RegExp.$1
|
218
|
-
, name: RegExp.$2
|
219
|
-
};
|
220
|
-
// prototype property
|
221
|
-
} else if (/^(\w+)\.prototype\.(\w+) *= *([^\n;]+)/.exec(str)) {
|
222
|
-
return {
|
223
|
-
type: 'property'
|
224
|
-
, constructor: RegExp.$1
|
225
|
-
, name: RegExp.$2
|
226
|
-
, value: RegExp.$3
|
227
|
-
};
|
228
|
-
// method
|
229
|
-
} else if (/^(\w+)\.(\w+) *= *function/.exec(str)) {
|
230
|
-
return {
|
231
|
-
type: 'method'
|
232
|
-
, receiver: RegExp.$1
|
233
|
-
, name: RegExp.$2
|
234
|
-
};
|
235
|
-
// property
|
236
|
-
} else if (/^(\w+)\.(\w+) *= *([^\n;]+)/.exec(str)) {
|
237
|
-
return {
|
238
|
-
type: 'property'
|
239
|
-
, receiver: RegExp.$1
|
240
|
-
, name: RegExp.$2
|
241
|
-
, value: RegExp.$3
|
242
|
-
};
|
243
|
-
// declaration
|
244
|
-
} else if (/^var +(\w+) *= *([^\n;]+)/.exec(str)) {
|
245
|
-
return {
|
246
|
-
type: 'declaration'
|
247
|
-
, name: RegExp.$1
|
248
|
-
, value: RegExp.$2
|
249
|
-
};
|
250
|
-
}
|
251
|
-
};
|
252
|
-
|
253
|
-
/**
|
254
|
-
* Escape the given `html`.
|
255
|
-
*
|
256
|
-
* @param {String} html
|
257
|
-
* @return {String}
|
258
|
-
* @api private
|
259
|
-
*/
|
260
|
-
|
261
|
-
function escape(html){
|
262
|
-
return String(html)
|
263
|
-
.replace(/&(?!\w+;)/g, '&')
|
264
|
-
.replace(/</g, '<')
|
265
|
-
.replace(/>/g, '>');
|
266
|
-
}
|
data/dox/test/fixtures/d.js
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
|
2
|
-
/**
|
3
|
-
* Parse tag type string "{Array|Object}" etc.
|
4
|
-
*
|
5
|
-
* @name is arbitrary
|
6
|
-
* @param {String} str
|
7
|
-
* @return {Array}
|
8
|
-
* @api public
|
9
|
-
*/
|
10
|
-
|
11
|
-
exports.parseTagTypes = function(str) {
|
12
|
-
return str
|
13
|
-
.replace(/[{}]/g, '')
|
14
|
-
.split(/ *[|,\/] */);
|
15
|
-
};
|
data/dox/test/fixtures/titles.js
DELETED