-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
43 lines (41 loc) · 1.45 KB
/
index.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
/**
* This plugin creates a summary tag, if there is none, and if there is more
* than one description tag. The contents of the first description tag are moved
* to the new summary tag. Other description tags are combined into a single
* description.
*
* @copyright (C) 2018 Jorge Ramos {@link https://github.com/jramos-br}
*
* @license MIT. This program is free software, licensed under the terms of the
* MIT License as published by the Open Source Initiative. It is distributed in
* the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the file LICENSE for more details. If you don't find it, please see the
* MIT License template at {@link http://opensource.org/licenses/MIT}.
*
* @author Jorge Ramos <jramos@pobox.com>
*
* @module jsdoc-summarize2
*/
'use strict';
exports.defineTags = function(dictionary) {
var description = dictionary.lookUp('description');
var onDescription = description.onTagged;
description.onTagged = function(doclet, tag) {
if (doclet.description) {
if (doclet.summary) {
if (tag.value) {
tag.value = doclet.description + '<br/>' + tag.value;
} else {
tag.value = doclet.description;
}
} else {
doclet.summary = doclet.description;
}
doclet.description = undefined;
}
if (onDescription) {
onDescription(doclet, tag);
}
};
};