Skip to content

Commit 6a1a8c7

Browse files
committed
Merge branch 'edge'
2 parents a6b112e + 6e7f721 commit 6a1a8c7

File tree

4 files changed

+34
-29
lines changed

4 files changed

+34
-29
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
#Changelog
22

3+
##0.0.4 (August 10, 2014)
4+
5+
- Improved Node.js support with the addition of a new method: parseFile.
6+
37
##0.0.3 (August 10, 2014)
48

59
- Updated doxdox to be importable through Node.js

bin/doxdox

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ var config = {
1010
layout: 'bootstrap'
1111
};
1212

13-
var script = '',
13+
var file = '',
1414
output = '';
1515

1616
var args = process.argv.slice(2),
1717
value;
1818

1919
if (args.length && !args[0].match(/^\-/)) {
2020

21-
script = args.shift();
21+
file = args.shift();
2222

2323
}
2424

@@ -76,4 +76,4 @@ while (args.length) {
7676

7777
}
7878

79-
doxdox.parseScript(script, output, config);
79+
doxdox.parseFile(file, output, config);

lib/doxdox.js

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -9,48 +9,49 @@ var templates = {
99
markdown: require('../templates/markdown.hbs')
1010
};
1111

12-
exports.parseScript = function (script, output, config) {
13-
14-
fs.exists(script, function (exists) {
15-
16-
var content,
17-
data;
12+
exports.parseFile = function (file, output, config) {
1813

19-
if (exists) {
14+
if (fs.existsSync(file)) {
2015

21-
data = dox.parseComments(fs.readFileSync(script, 'utf8'));
16+
return exports.parseScript(fs.readFileSync(file, 'utf8'), output, config);
2217

23-
if (templates[config.layout]) {
18+
} else {
2419

25-
content = templates[config.layout]({
26-
title: config.title,
27-
description: config.description,
28-
methods: utils.parseData(data)
29-
});
20+
process.stdout.write('File not found.' + '\n');
3021

31-
if (output) {
22+
}
3223

33-
fs.writeFileSync(output, content, 'utf8');
24+
}
3425

35-
} else {
26+
exports.parseScript = function (script, output, config) {
3627

37-
process.stdout.write(content);
28+
var content,
29+
data = dox.parseComments(script);
3830

39-
}
31+
if (templates[config.layout]) {
4032

41-
} else {
33+
content = templates[config.layout]({
34+
title: config.title,
35+
description: config.description,
36+
methods: utils.parseData(data)
37+
});
4238

43-
process.stdout.write('Invalid layout specified.' + '\n');
39+
if (output) {
4440

45-
}
41+
fs.writeFileSync(output, content, 'utf8');
4642

4743
} else {
4844

49-
process.stdout.write('File not found.' + '\n');
45+
process.stdout.write(content);
46+
47+
return content;
5048

5149
}
5250

53-
});
51+
} else {
5452

55-
}
53+
process.stdout.write('Invalid layout specified.' + '\n');
5654

55+
}
56+
57+
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "doxdox",
33
"description": "HTML and Markdown documentation generator.",
4-
"version": "0.0.3",
4+
"version": "0.0.4",
55
"bin": "./bin/doxdox",
66
"license": "MIT",
77
"dependencies": {

0 commit comments

Comments
 (0)