forked from fluent-ffmpeg/node-fluent-ffmpeg
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjsdoc-aliases.js
58 lines (48 loc) · 1.16 KB
/
jsdoc-aliases.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/*jshint node:true*/
'use strict';
function createAlias(doclet, alias) {
var clone = {};
Object.keys(doclet).forEach(function(key) {
clone[key] = doclet[key];
});
if (alias.indexOf('#') !== -1) {
clone.longname = alias;
clone.memberof = alias.split('#')[0];
clone.name = alias.split('#')[1];
} else {
clone.longname = clone.memberof + '#' + alias;
clone.name = alias;
}
delete clone.returns;
delete clone.examples;
delete clone.meta;
delete clone.aliases;
clone.isAlias = true;
clone.description = 'Alias for <a href="#' + doclet.name + '">' + doclet.longname + '</a>';
return clone;
}
exports.handlers = {
parseComplete: function(e) {
var doclets = e.doclets.slice();
doclets.forEach(function(doclet) {
// Duplicate doclets with aliases
if (doclet.aliases) {
doclet.aliases.forEach(function(alias) {
e.doclets.push(createAlias(doclet, alias));
});
}
});
}
};
exports.defineTags = function(dict) {
dict.defineTag('aliases', {
onTagged: function(doclet, tag) {
doclet.aliases = tag.text.split(',');
}
});
dict.defineTag('category', {
onTagged: function(doclet, tag) {
doclet.category = tag.text;
}
});
};