12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- exports.handlers = {
-
- newDoclet({doclet}) {
- let endTag;
- let tags;
- let stack;
-
-
- if (doclet && !doclet.summary && doclet.description) {
-
- doclet.summary = doclet.description.split(/\.$|\.\s|\.</)[0];
-
- doclet.summary += '.';
-
-
- tags = doclet.summary.match(/<[^>]+>/g) || [];
- stack = [];
- tags.forEach(tag => {
- const idx = tag.indexOf('/');
- if (idx === -1) {
-
- stack.push(tag);
- } else if (idx === 1) {
-
- stack.pop();
- }
-
- });
-
-
- while (stack.length > 0) {
-
- endTag = stack.pop();
-
- endTag = endTag.substring(1, endTag.search(/[ >]/));
-
- doclet.summary += `</${endTag}>`;
- }
-
-
- doclet.summary = doclet.summary.replace(/^<p>(.*)<\/p>$/i, '$1');
- }
- }
- };
|