Skip to content

Commit 7953d17

Browse files
committed
Added new export template buildWiki.
1 parent cf295fb commit 7953d17

File tree

3 files changed

+82
-1
lines changed

3 files changed

+82
-1
lines changed

lib/doxdox.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ var fs = require('fs'),
99
module.exports.templates = {
1010
bootstrap: require('../templates/bootstrap.hbs'),
1111
markdown: require('../templates/markdown.hbs'),
12-
dash: utils.buildDashDocSet
12+
dash: utils.buildDashDocSet,
13+
wiki: utils.buildWiki
1314
};
1415

1516
module.exports.parseInput = function (input, config, pkg) {

lib/utils.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,35 @@ module.exports.buildDashDocSet = function (input) {
9898

9999
};
100100

101+
102+
module.exports.buildWiki = function (input) {
103+
104+
return new Promise(function (resolve) {
105+
106+
var zip = new admzip(),
107+
template = require('../templates/wiki/methods.hbs');
108+
109+
input.uid = module.exports.formatStringForUID(input.title);
110+
111+
input.files.forEach(function (file) {
112+
113+
file.methods.forEach(function (method) {
114+
115+
zip.addFile(
116+
file.name + '/' + method.name + '.md',
117+
template(method)
118+
);
119+
120+
});
121+
122+
});
123+
124+
resolve(zip.toBuffer());
125+
126+
});
127+
128+
};
129+
101130
module.exports.findPackagePath = function (input) {
102131

103132
var pkg,

templates/wiki/methods.hbs

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
#{{name}}({{params}}) {{#if isPrivate}} _private method_{{/if}}
2+
3+
{{{description}}}
4+
5+
{{{body}}}
6+
7+
{{#if tags.param}}
8+
9+
##Parameters
10+
11+
{{#each tags.param}}
12+
- **{{name}}** {{#each types}}`{{.}}` {{/each}} {{#if isOptional}}_Optional_{{/if}} {{{description}}}
13+
{{/each}}
14+
15+
{{/if}}
16+
17+
{{#if tags.property}}
18+
19+
##Properties
20+
21+
{{#each tags.property}}
22+
- **{{name}}** {{#each types}}`{{.}}` {{/each}} {{#if isOptional}}_Optional_{{/if}} {{{description}}}
23+
{{/each}}
24+
25+
{{/if}}
26+
27+
{{#if tags.example}}
28+
29+
##Examples
30+
31+
{{#each tags.example}}
32+
```javascript
33+
{{{.}}}
34+
```
35+
{{/each}}
36+
37+
{{/if}}
38+
39+
##Returns
40+
41+
{{#if tags.return}}
42+
43+
{{#each tags.return}}
44+
- {{#each types}}`{{.}}` {{/each}} {{#if isOptional}}_Optional_{{/if}} {{{description}}}
45+
{{/each}}
46+
47+
{{else}}
48+
49+
- `Void`
50+
51+
{{/if}}

0 commit comments

Comments
 (0)