mirror of
https://github.com/jsdoc/jsdoc.git
synced 2025-12-08 19:46:11 +00:00
remove extra period from end of summary
This commit is contained in:
parent
ca62994d22
commit
cfd9743eaa
@ -18,8 +18,8 @@ exports.handlers = {
|
||||
// If the summary is missing, grab the first sentence from the description
|
||||
// and use that.
|
||||
if (e.doclet && !e.doclet.summary && e.doclet.description) {
|
||||
// The summary may end with `. ` or with `.<` (a period followed by an HTML tag).
|
||||
e.doclet.summary = e.doclet.description.split(/\.\s|\.</)[0];
|
||||
// The summary may end with `.$`, `. `, or `.<` (a period followed by an HTML tag).
|
||||
e.doclet.summary = e.doclet.description.split(/\.$|\.\s|\.</)[0];
|
||||
// Append `.` as it was removed in both cases, or is possibly missing.
|
||||
e.doclet.summary += '.';
|
||||
|
||||
|
||||
@ -51,6 +51,16 @@ describe('summarize', function() {
|
||||
expect(doclet.summary).toBe('This sentence is the summary.');
|
||||
});
|
||||
|
||||
it('should not add an extra period if there is only one sentence in the description',
|
||||
function() {
|
||||
var doclet = {
|
||||
description: 'This description has only one sentence.'
|
||||
};
|
||||
handler({ doclet: doclet });
|
||||
|
||||
expect(doclet.summary).toBe('This description has only one sentence.');
|
||||
});
|
||||
|
||||
it('should use the entire description, plus a period, as the summary if the description ' +
|
||||
'does not contain a period', function() {
|
||||
var doclet = {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user