spacedocs 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- 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
@@ -0,0 +1,20 @@
|
|
1
|
+
.site {
|
2
|
+
width: 45em;
|
3
|
+
}
|
4
|
+
|
5
|
+
#content.site {
|
6
|
+
width: 44em;
|
7
|
+
}
|
8
|
+
|
9
|
+
#user_input, #html_result {
|
10
|
+
width: 580px;
|
11
|
+
height: 170px;
|
12
|
+
}
|
13
|
+
|
14
|
+
#result {
|
15
|
+
width: 560px;
|
16
|
+
min-height: 150px;
|
17
|
+
border: 1px solid #999;
|
18
|
+
margin-top: 15px;
|
19
|
+
padding: 10px;
|
20
|
+
}
|
@@ -0,0 +1,43 @@
|
|
1
|
+
{
|
2
|
+
"name": "dox",
|
3
|
+
"description": "Markdown / JSdoc documentation generator",
|
4
|
+
"version": "0.3.1",
|
5
|
+
"author": {
|
6
|
+
"name": "TJ Holowaychuk",
|
7
|
+
"email": "tj@vision-media.ca"
|
8
|
+
},
|
9
|
+
"repository": {
|
10
|
+
"type": "git",
|
11
|
+
"url": "git://github.com/visionmedia/dox.git"
|
12
|
+
},
|
13
|
+
"keywords": [
|
14
|
+
"documentation",
|
15
|
+
"docs",
|
16
|
+
"markdown",
|
17
|
+
"jsdoc"
|
18
|
+
],
|
19
|
+
"bin": {
|
20
|
+
"dox": "./bin/dox"
|
21
|
+
},
|
22
|
+
"dependencies": {
|
23
|
+
"github-flavored-markdown": ">= 0.0.1",
|
24
|
+
"commander": "0.5.2"
|
25
|
+
},
|
26
|
+
"devDependencies": {
|
27
|
+
"mocha": "*",
|
28
|
+
"should": "*"
|
29
|
+
},
|
30
|
+
"_id": "dox@0.3.1",
|
31
|
+
"optionalDependencies": {},
|
32
|
+
"engines": {
|
33
|
+
"node": "*"
|
34
|
+
},
|
35
|
+
"_engineSupported": true,
|
36
|
+
"_npmVersion": "1.1.3",
|
37
|
+
"_nodeVersion": "v0.6.11",
|
38
|
+
"_defaultsLoaded": true,
|
39
|
+
"dist": {
|
40
|
+
"shasum": "ac9eaa1a58907e81eedb9f7f3851179a9769bc6a"
|
41
|
+
},
|
42
|
+
"_from": "./dox/"
|
43
|
+
}
|
data/lib/spacedocs.rb
CHANGED
@@ -1,22 +1,41 @@
|
|
1
1
|
require 'tilt'
|
2
|
+
|
2
3
|
require 'haml'
|
4
|
+
require 'sass'
|
5
|
+
require 'compass'
|
6
|
+
|
3
7
|
require 'json'
|
8
|
+
|
4
9
|
require 'fileutils'
|
5
10
|
|
6
11
|
module Spacedocs
|
7
12
|
class << self
|
8
|
-
def
|
13
|
+
def generate_stylesheet(output_dir)
|
14
|
+
tilt_path = File.dirname(__FILE__)
|
15
|
+
|
16
|
+
stylesheets_dir = File.join(output_dir, 'stylesheets')
|
17
|
+
|
18
|
+
FileUtils.mkdir_p stylesheets_dir
|
19
|
+
|
20
|
+
stylesheet_template = Tilt.new(File.join(tilt_path, 'spacedocs.sass'), Compass.configuration.to_sass_engine_options)
|
21
|
+
|
22
|
+
File.open(File.join(stylesheets_dir, 'spacedocs.css'), 'w') do |f|
|
23
|
+
f.write(stylesheet_template.render self)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def doc(file_path, output_dir)
|
9
28
|
tilt_path = File.dirname(__FILE__)
|
10
29
|
|
11
|
-
#
|
12
|
-
json =
|
30
|
+
# can't use < unless it's a file
|
31
|
+
json = `#{File.join tilt_path, 'node_modules/dox/bin/dox'} < #{file_path}`
|
13
32
|
|
14
33
|
doc_json = JSON.parse json
|
15
34
|
|
16
35
|
processed_data = process_data doc_json
|
17
36
|
|
18
|
-
template = Tilt.new(File.join tilt_path, "
|
19
|
-
index_template = Tilt.new(File.join tilt_path, "
|
37
|
+
template = Tilt.new(File.join tilt_path, "class.html.haml")
|
38
|
+
index_template = Tilt.new(File.join tilt_path, "index.html.haml")
|
20
39
|
|
21
40
|
files = {}
|
22
41
|
|
@@ -26,48 +45,26 @@ module Spacedocs
|
|
26
45
|
files[namespace] = true
|
27
46
|
end
|
28
47
|
|
29
|
-
|
30
|
-
|
31
|
-
FileUtils.rm_rf docs_dir
|
32
|
-
FileUtils.mkdir_p docs_dir
|
48
|
+
FileUtils.rm_rf output_dir
|
49
|
+
FileUtils.mkdir_p output_dir
|
33
50
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
files.each_key do |file_name|
|
40
|
-
methods = class_data[file_name]['methods']
|
41
|
-
|
42
|
-
File.open("source/#{file_name}.html", 'w') do |f|
|
43
|
-
f.write(template.render self, {
|
44
|
-
class_name: file_name,
|
45
|
-
method_list: methods.keys,
|
46
|
-
methods: methods,
|
47
|
-
class_names: files.keys,
|
48
|
-
class_summary: class_data[file_name]['summary'],
|
49
|
-
dev: true
|
50
|
-
})
|
51
|
-
end
|
52
|
-
end
|
53
|
-
else
|
54
|
-
File.open(File.join(project_dir, "docs/index.html"), 'w') do |f|
|
55
|
-
f.write(index_template.render self, { class_names: files.keys })
|
56
|
-
end
|
51
|
+
File.open(File.join(output_dir, "index.html"), 'w') do |f|
|
52
|
+
f.write(index_template.render self, {
|
53
|
+
class_names: files.keys,
|
54
|
+
})
|
55
|
+
end
|
57
56
|
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
})
|
70
|
-
end
|
57
|
+
files.each_key do |file_name|
|
58
|
+
methods = class_data[file_name]['methods']
|
59
|
+
|
60
|
+
File.open(File.join(output_dir, "#{file_name}.html"), 'w') do |f|
|
61
|
+
f.write(template.render self, {
|
62
|
+
class_name: file_name,
|
63
|
+
method_list: methods.keys,
|
64
|
+
methods: methods,
|
65
|
+
class_names: files.keys,
|
66
|
+
class_summary: class_data[file_name]['summary'],
|
67
|
+
})
|
71
68
|
end
|
72
69
|
end
|
73
70
|
end
|
@@ -201,15 +198,7 @@ module Spacedocs
|
|
201
198
|
}
|
202
199
|
end
|
203
200
|
|
204
|
-
# File.open("source/sanity.json", 'w') do |f|
|
205
|
-
# f.write(JSON.pretty_generate(docs_data))
|
206
|
-
# end
|
207
|
-
|
208
201
|
return { docs_data: docs_data, class_names: class_names }
|
209
202
|
end
|
210
203
|
end
|
211
204
|
end
|
212
|
-
|
213
|
-
if __FILE__ == $0
|
214
|
-
Spacedocs.doc 'projects/6', 'game.js'
|
215
|
-
end
|
File without changes
|
data/lib/spacedocs/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spacedocs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,9 +9,89 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
13
|
-
dependencies:
|
14
|
-
|
12
|
+
date: 2013-05-12 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: compass
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: haml
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: rake
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: sass
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
type: :runtime
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: tilt
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ! '>='
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
86
|
+
type: :runtime
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
94
|
+
description: Generate beautiful API docs based on JSON output from the Node project
|
15
95
|
dox. Supports jsDocToolkit comment style
|
16
96
|
email:
|
17
97
|
- mdiebolt@gmail.com
|
@@ -19,26 +99,37 @@ executables: []
|
|
19
99
|
extensions: []
|
20
100
|
extra_rdoc_files: []
|
21
101
|
files:
|
22
|
-
-
|
23
|
-
-
|
24
|
-
- dox/
|
25
|
-
-
|
26
|
-
- dox/
|
27
|
-
- dox/
|
28
|
-
- dox/
|
29
|
-
- dox/
|
30
|
-
- dox/
|
31
|
-
- dox/
|
32
|
-
- dox/
|
33
|
-
- dox/
|
34
|
-
- dox/
|
35
|
-
- dox/
|
36
|
-
- lib/
|
37
|
-
- lib/
|
102
|
+
- lib/class.html.haml
|
103
|
+
- lib/index.html.haml
|
104
|
+
- lib/node_modules/dox/bin/dox
|
105
|
+
- lib/node_modules/dox/History.md
|
106
|
+
- lib/node_modules/dox/index.js
|
107
|
+
- lib/node_modules/dox/lib/dox.js
|
108
|
+
- lib/node_modules/dox/lib/utils.js
|
109
|
+
- lib/node_modules/dox/Makefile
|
110
|
+
- lib/node_modules/dox/node_modules/commander/History.md
|
111
|
+
- lib/node_modules/dox/node_modules/commander/index.js
|
112
|
+
- lib/node_modules/dox/node_modules/commander/lib/commander.js
|
113
|
+
- lib/node_modules/dox/node_modules/commander/Makefile
|
114
|
+
- lib/node_modules/dox/node_modules/commander/package.json
|
115
|
+
- lib/node_modules/dox/node_modules/commander/Readme.md
|
116
|
+
- lib/node_modules/dox/node_modules/github-flavored-markdown/_config.yml
|
117
|
+
- lib/node_modules/dox/node_modules/github-flavored-markdown/_layouts/default.html
|
118
|
+
- lib/node_modules/dox/node_modules/github-flavored-markdown/code.rb
|
119
|
+
- lib/node_modules/dox/node_modules/github-flavored-markdown/images/gfm.png
|
120
|
+
- lib/node_modules/dox/node_modules/github-flavored-markdown/index.md
|
121
|
+
- lib/node_modules/dox/node_modules/github-flavored-markdown/package.json
|
122
|
+
- lib/node_modules/dox/node_modules/github-flavored-markdown/preview.md
|
123
|
+
- lib/node_modules/dox/node_modules/github-flavored-markdown/README.md
|
124
|
+
- lib/node_modules/dox/node_modules/github-flavored-markdown/sample_content.html
|
125
|
+
- lib/node_modules/dox/node_modules/github-flavored-markdown/scripts/preview.js
|
126
|
+
- lib/node_modules/dox/node_modules/github-flavored-markdown/scripts/showdown.js
|
127
|
+
- lib/node_modules/dox/node_modules/github-flavored-markdown/stylesheets/screen.css
|
128
|
+
- lib/node_modules/dox/package.json
|
129
|
+
- lib/node_modules/dox/Readme.md
|
38
130
|
- lib/spacedocs/version.rb
|
39
131
|
- lib/spacedocs.rb
|
40
|
-
-
|
41
|
-
- source/index.html.haml
|
132
|
+
- lib/spacedocs.sass
|
42
133
|
- README.md
|
43
134
|
homepage: http://mdiebolt.github.com/spacedocs
|
44
135
|
licenses: []
|
@@ -54,7 +145,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
54
145
|
version: '0'
|
55
146
|
segments:
|
56
147
|
- 0
|
57
|
-
hash: -
|
148
|
+
hash: -1585695545739810584
|
58
149
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
59
150
|
none: false
|
60
151
|
requirements:
|
@@ -63,10 +154,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
63
154
|
version: '0'
|
64
155
|
segments:
|
65
156
|
- 0
|
66
|
-
hash: -
|
157
|
+
hash: -1585695545739810584
|
67
158
|
requirements: []
|
68
159
|
rubyforge_project:
|
69
|
-
rubygems_version: 1.8.
|
160
|
+
rubygems_version: 1.8.23
|
70
161
|
signing_key:
|
71
162
|
specification_version: 3
|
72
163
|
summary: Documentation from space
|
data/dox/package.json
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
{ "name": "dox"
|
2
|
-
, "description": "Markdown / JSdoc documentation generator"
|
3
|
-
, "version": "0.3.1"
|
4
|
-
, "author": "TJ Holowaychuk <tj@vision-media.ca>"
|
5
|
-
, "repository": { "type": "git", "url": "git://github.com/visionmedia/dox.git" }
|
6
|
-
, "keywords": ["documentation", "docs", "markdown", "jsdoc"]
|
7
|
-
, "bin": { "dox": "./bin/dox" }
|
8
|
-
, "dependencies": {
|
9
|
-
"github-flavored-markdown": ">= 0.0.1"
|
10
|
-
, "commander": "0.5.2"
|
11
|
-
}
|
12
|
-
, "devDependencies": {
|
13
|
-
"mocha": "*"
|
14
|
-
, "should": "*"
|
15
|
-
}
|
16
|
-
}
|
data/dox/test/dox.test.js
DELETED
@@ -1,287 +0,0 @@
|
|
1
|
-
|
2
|
-
/**
|
3
|
-
* Module dependencies.
|
4
|
-
*/
|
5
|
-
|
6
|
-
var dox = require('../')
|
7
|
-
, should = require('should')
|
8
|
-
, fs = require('fs');
|
9
|
-
|
10
|
-
function fixture(name, fn) {
|
11
|
-
fs.readFile(__dirname + '/fixtures/' + name, 'utf8', fn);
|
12
|
-
}
|
13
|
-
|
14
|
-
module.exports = {
|
15
|
-
'test .version': function(){
|
16
|
-
dox.version.should.match(/^\d+\.\d+\.\d+$/);
|
17
|
-
},
|
18
|
-
|
19
|
-
'test .parseComments() blocks': function(done){
|
20
|
-
fixture('a.js', function(err, str){
|
21
|
-
var comments = dox.parseComments(str)
|
22
|
-
, file = comments.shift()
|
23
|
-
, version = comments.shift();
|
24
|
-
file.should.have.property('ignore', true);
|
25
|
-
file.description.full.should.equal('<p>A<br />Copyright (c) 2010 Author Name <Author Email><br />MIT Licensed</p>');
|
26
|
-
file.description.summary.should.equal('<p>A<br />Copyright (c) 2010 Author Name <Author Email><br />MIT Licensed</p>');
|
27
|
-
file.description.body.should.equal('');
|
28
|
-
file.tags.should.be.empty;
|
29
|
-
|
30
|
-
version.should.have.property('ignore', false);
|
31
|
-
version.description.full.should.equal('<p>Library version.</p>');
|
32
|
-
version.description.summary.should.equal('<p>Library version.</p>');
|
33
|
-
version.description.body.should.equal('');
|
34
|
-
version.tags.should.be.empty;
|
35
|
-
done();
|
36
|
-
});
|
37
|
-
},
|
38
|
-
|
39
|
-
'test .parseComments() tags': function(done){
|
40
|
-
fixture('b.js', function(err, str){
|
41
|
-
var comments = dox.parseComments(str);
|
42
|
-
|
43
|
-
var version = comments.shift();
|
44
|
-
version.description.summary.should.equal('<p>Library version.</p>');
|
45
|
-
version.description.full.should.equal('<p>Library version.</p>');
|
46
|
-
version.tags.should.have.length(2);
|
47
|
-
version.tags[0].type.should.equal('type');
|
48
|
-
version.tags[0].types.should.eql(['String']);
|
49
|
-
version.tags[1].type.should.equal('api');
|
50
|
-
version.tags[1].visibility.should.equal('public');
|
51
|
-
version.ctx.type.should.equal('property');
|
52
|
-
version.ctx.receiver.should.equal('exports');
|
53
|
-
version.ctx.name.should.equal('version');
|
54
|
-
version.ctx.value.should.equal("'0.0.1'");
|
55
|
-
|
56
|
-
var parse = comments.shift();
|
57
|
-
parse.description.summary.should.equal('<p>Parse the given <code>str</code>.</p>');
|
58
|
-
parse.description.body.should.equal('<h2>Examples</h2>\n\n<pre><code>parse(str)\n// =&gt; "wahoo"\n</code></pre>');
|
59
|
-
parse.description.full.should.equal('<p>Parse the given <code>str</code>.</p>\n\n<h2>Examples</h2>\n\n<pre><code>parse(str)\n// =&gt; "wahoo"\n</code></pre>');
|
60
|
-
parse.tags[0].type.should.equal('param');
|
61
|
-
parse.tags[0].name.should.equal('str');
|
62
|
-
parse.tags[0].description.should.equal('to parse');
|
63
|
-
parse.tags[0].types.should.eql(['String', 'Buffer']);
|
64
|
-
parse.tags[1].type.should.equal('return');
|
65
|
-
parse.tags[1].types.should.eql(['String']);
|
66
|
-
parse.tags[2].visibility.should.equal('public');
|
67
|
-
done();
|
68
|
-
});
|
69
|
-
},
|
70
|
-
|
71
|
-
'test .parseComments() complex': function(done){
|
72
|
-
fixture('c.js', function(err, str){
|
73
|
-
var comments = dox.parseComments(str);
|
74
|
-
|
75
|
-
var file = comments.shift();
|
76
|
-
|
77
|
-
file.tags.should.be.empty;
|
78
|
-
// the following doesn't work as gh-md now obfuscates emails different on every pass
|
79
|
-
//file.description.full.should.equal('<p>Dox<br />Copyright (c) 2010 TJ Holowaychuk <a href=\'mailto:tj@vision-media.ca\'>tj@vision-media.ca</a><br />MIT Licensed</p>');
|
80
|
-
file.description.full.should.be.a('string');
|
81
|
-
file.ignore.should.be.true;
|
82
|
-
|
83
|
-
var mods = comments.shift();
|
84
|
-
mods.tags.should.be.empty;
|
85
|
-
mods.description.full.should.equal('<p>Module dependencies.</p>');
|
86
|
-
mods.description.summary.should.equal('<p>Module dependencies.</p>');
|
87
|
-
mods.description.body.should.equal('');
|
88
|
-
mods.ignore.should.be.false;
|
89
|
-
mods.code.should.equal('var markdown = require(\'github-flavored-markdown\').parse;');
|
90
|
-
mods.ctx.type.should.equal('declaration');
|
91
|
-
mods.ctx.name.should.equal('markdown');
|
92
|
-
mods.ctx.value.should.equal('require(\'github-flavored-markdown\').parse');
|
93
|
-
|
94
|
-
var version = comments.shift();
|
95
|
-
version.tags.should.be.empty;
|
96
|
-
version.description.full.should.equal('<p>Library version.</p>');
|
97
|
-
|
98
|
-
var parseComments = comments.shift();
|
99
|
-
parseComments.tags.should.have.length(4);
|
100
|
-
parseComments.ctx.type.should.equal('method');
|
101
|
-
parseComments.ctx.receiver.should.equal('exports');
|
102
|
-
parseComments.ctx.name.should.equal('parseComments');
|
103
|
-
parseComments.description.full.should.equal('<p>Parse comments in the given string of <code>js</code>.</p>');
|
104
|
-
parseComments.description.summary.should.equal('<p>Parse comments in the given string of <code>js</code>.</p>');
|
105
|
-
parseComments.description.body.should.equal('');
|
106
|
-
|
107
|
-
var parseComment = comments.shift();
|
108
|
-
parseComment.tags.should.have.length(4);
|
109
|
-
parseComment.description.summary.should.equal('<p>Parse the given comment <code>str</code>.</p>');
|
110
|
-
parseComment.description.full.should.equal('<p>Parse the given comment <code>str</code>.</p>\n\n<h2>The comment object returned contains the following</h2>\n\n<ul>\n<li><code>tags</code> array of tag objects</li>\n<li><code>description</code> the first line of the comment</li>\n<li><code>body</code> lines following the description</li>\n<li><code>content</code> both the description and the body</li>\n<li><code>isPrivate</code> true when "@api private" is used</li>\n</ul>');
|
111
|
-
parseComment.description.body.should.equal('<h2>The comment object returned contains the following</h2>\n\n<ul>\n<li><code>tags</code> array of tag objects</li>\n<li><code>description</code> the first line of the comment</li>\n<li><code>body</code> lines following the description</li>\n<li><code>content</code> both the description and the body</li>\n<li><code>isPrivate</code> true when "@api private" is used</li>\n</ul>');
|
112
|
-
|
113
|
-
var escape = comments.pop();
|
114
|
-
escape.tags.should.have.length(3);
|
115
|
-
escape.description.full.should.equal('<p>Escape the given <code>html</code>.</p>');
|
116
|
-
escape.ctx.type.should.equal('function');
|
117
|
-
escape.ctx.name.should.equal('escape');
|
118
|
-
done();
|
119
|
-
});
|
120
|
-
},
|
121
|
-
|
122
|
-
'test .parseComments() tags': function (done){
|
123
|
-
fixture('d.js', function(err, str){
|
124
|
-
var comments = dox.parseComments(str);
|
125
|
-
var first = comments.shift();
|
126
|
-
first.tags.should.have.length(4);
|
127
|
-
first.description.full.should.equal('<p>Parse tag type string "{Array|Object}" etc.</p>');
|
128
|
-
first.description.summary.should.equal('<p>Parse tag type string "{Array|Object}" etc.</p>');
|
129
|
-
first.description.body.should.equal('');
|
130
|
-
first.ctx.type.should.equal('method');
|
131
|
-
first.ctx.receiver.should.equal('exports');
|
132
|
-
first.ctx.name.should.equal('parseTagTypes');
|
133
|
-
first.code.should.equal('exports.parseTagTypes = function(str) {\n return str\n .replace(/[{}]/g, \'\')\n .split(/ *[|,\\/] */);\n};');
|
134
|
-
done();
|
135
|
-
});
|
136
|
-
},
|
137
|
-
|
138
|
-
'test .parseComments() code': function(done){
|
139
|
-
fixture('b.js', function(err, str){
|
140
|
-
var comments = dox.parseComments(str)
|
141
|
-
, version = comments.shift()
|
142
|
-
, parse = comments.shift();
|
143
|
-
|
144
|
-
version.code.should.equal("exports.version = '0.0.1';");
|
145
|
-
parse.code.should.equal('exports.parse = function(str) {\n return "wahoo";\n}');
|
146
|
-
done();
|
147
|
-
});
|
148
|
-
},
|
149
|
-
|
150
|
-
'test .parseComments() titles': function(done){
|
151
|
-
fixture('titles.js', function(err, str){
|
152
|
-
var comments = dox.parseComments(str);
|
153
|
-
comments[0].description.body.should.include('<h2>Some examples</h2>');
|
154
|
-
comments[0].description.body.should.not.include('<h2>for example</h2>');
|
155
|
-
comments[0].description.body.should.include('<p>Some longer thing<br />for example:</p>');
|
156
|
-
done();
|
157
|
-
});
|
158
|
-
},
|
159
|
-
|
160
|
-
'test .parseCodeContext() function statement': function(){
|
161
|
-
var ctx = dox.parseCodeContext('function foo(){\n\n}');
|
162
|
-
ctx.type.should.equal('function');
|
163
|
-
ctx.name.should.equal('foo');
|
164
|
-
},
|
165
|
-
|
166
|
-
'test .parseCodeContext() function expression': function(){
|
167
|
-
var ctx = dox.parseCodeContext('var foo = function(){\n\n}');
|
168
|
-
ctx.type.should.equal('function');
|
169
|
-
ctx.name.should.equal('foo');
|
170
|
-
},
|
171
|
-
|
172
|
-
'test .parseCodeContext() prototype method': function(){
|
173
|
-
var ctx = dox.parseCodeContext('User.prototype.save = function(){}');
|
174
|
-
ctx.type.should.equal('method');
|
175
|
-
ctx.constructor.should.equal('User');
|
176
|
-
ctx.name.should.equal('save');
|
177
|
-
},
|
178
|
-
|
179
|
-
'test .parseCodeContext() prototype property': function(){
|
180
|
-
var ctx = dox.parseCodeContext('Database.prototype.enabled = true;\nasdf');
|
181
|
-
ctx.type.should.equal('property');
|
182
|
-
ctx.constructor.should.equal('Database');
|
183
|
-
ctx.name.should.equal('enabled');
|
184
|
-
ctx.value.should.equal('true');
|
185
|
-
},
|
186
|
-
|
187
|
-
'test .parseCodeContext() method': function(){
|
188
|
-
var ctx = dox.parseCodeContext('user.save = function(){}');
|
189
|
-
ctx.type.should.equal('method');
|
190
|
-
ctx.receiver.should.equal('user');
|
191
|
-
ctx.name.should.equal('save');
|
192
|
-
},
|
193
|
-
|
194
|
-
'test .parseCodeContext() property': function(){
|
195
|
-
var ctx = dox.parseCodeContext('user.name = "tj";\nasdf');
|
196
|
-
ctx.type.should.equal('property');
|
197
|
-
ctx.receiver.should.equal('user');
|
198
|
-
ctx.name.should.equal('name');
|
199
|
-
ctx.value.should.equal('"tj"');
|
200
|
-
},
|
201
|
-
|
202
|
-
'test .parseCodeContext() declaration': function(){
|
203
|
-
var ctx = dox.parseCodeContext('var name = "tj";\nasdf');
|
204
|
-
ctx.type.should.equal('declaration');
|
205
|
-
ctx.name.should.equal('name');
|
206
|
-
ctx.value.should.equal('"tj"');
|
207
|
-
},
|
208
|
-
|
209
|
-
'test .parseTag() @constructor': function(){
|
210
|
-
var tag = dox.parseTag('@constructor');
|
211
|
-
tag.type.should.equal('constructor');
|
212
|
-
},
|
213
|
-
|
214
|
-
'test .parseTag() @see': function(){
|
215
|
-
var tag = dox.parseTag('@see http://google.com');
|
216
|
-
tag.type.should.equal('see');
|
217
|
-
tag.title.should.equal('');
|
218
|
-
tag.url.should.equal('http://google.com');
|
219
|
-
|
220
|
-
var tag = dox.parseTag('@see Google http://google.com');
|
221
|
-
tag.type.should.equal('see');
|
222
|
-
tag.title.should.equal('Google');
|
223
|
-
tag.url.should.equal('http://google.com');
|
224
|
-
|
225
|
-
var tag = dox.parseTag('@see exports.parseComment');
|
226
|
-
tag.type.should.equal('see');
|
227
|
-
tag.local.should.equal('exports.parseComment');
|
228
|
-
},
|
229
|
-
|
230
|
-
'test .parseTag() @api': function(){
|
231
|
-
var tag = dox.parseTag('@api private');
|
232
|
-
tag.type.should.equal('api');
|
233
|
-
tag.visibility.should.equal('private');
|
234
|
-
},
|
235
|
-
|
236
|
-
'test .parseTag() @type': function(){
|
237
|
-
var tag = dox.parseTag('@type {String}');
|
238
|
-
tag.type.should.equal('type');
|
239
|
-
tag.types.should.eql(['String']);
|
240
|
-
},
|
241
|
-
|
242
|
-
'test .parseTag() @param': function(){
|
243
|
-
var tag = dox.parseTag('@param {String|Buffer}');
|
244
|
-
tag.type.should.equal('param');
|
245
|
-
tag.types.should.eql(['String', 'Buffer']);
|
246
|
-
tag.name.should.equal('');
|
247
|
-
tag.description.should.equal('');
|
248
|
-
},
|
249
|
-
|
250
|
-
'test .parseTag() @return': function(){
|
251
|
-
var tag = dox.parseTag('@return {String} a normal string');
|
252
|
-
tag.type.should.equal('return');
|
253
|
-
tag.types.should.eql(['String']);
|
254
|
-
tag.description.should.equal('a normal string');
|
255
|
-
},
|
256
|
-
|
257
|
-
'test .parseTag() @augments': function(){
|
258
|
-
var tag = dox.parseTag('@augments otherClass');
|
259
|
-
tag.type.should.equal('augments');
|
260
|
-
tag.otherClass.should.equal('otherClass')
|
261
|
-
},
|
262
|
-
|
263
|
-
'test .parseTag() @author': function(){
|
264
|
-
var tag = dox.parseTag('@author Bob Bobson');
|
265
|
-
tag.type.should.equal('author');
|
266
|
-
tag.string.should.equal('Bob Bobson');
|
267
|
-
},
|
268
|
-
|
269
|
-
'test .parseTag() @borrows': function(){
|
270
|
-
var tag = dox.parseTag('@borrows foo as bar');
|
271
|
-
tag.type.should.equal('borrows');
|
272
|
-
tag.otherMemberName.should.equal('foo');
|
273
|
-
tag.thisMemberName.should.equal('bar');
|
274
|
-
},
|
275
|
-
|
276
|
-
'test .parseTag() @memberOf': function(){
|
277
|
-
var tag = dox.parseTag('@memberOf Foo.bar')
|
278
|
-
tag.type.should.equal('memberOf')
|
279
|
-
tag.parent.should.equal('Foo.bar')
|
280
|
-
},
|
281
|
-
|
282
|
-
'test .parseTag() default': function(){
|
283
|
-
var tag = dox.parseTag('@hello universe is better than world');
|
284
|
-
tag.type.should.equal('hello');
|
285
|
-
tag.string.should.equal('universe is better than world');
|
286
|
-
}
|
287
|
-
};
|