Skip to content
This repository was archived by the owner on Dec 4, 2017. It is now read-only.

Commit 93c187d

Browse files
api-builder: trim blank lines from the end of a text block too
1 parent 096e5f0 commit 93c187d

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

tools/api-builder/angular.io-package/rendering/trimBlankLines.js

+3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ module.exports = function() {
66
while(lines.length && (lines[0].trim() === '')) {
77
lines.shift();
88
}
9+
while(lines.length && (lines[lines.length-1].trim() === '')) {
10+
lines.pop();
11+
}
912
return lines.join('\n');
1013
}
1114
};

tools/api-builder/angular.io-package/rendering/trimBlankLines.spec.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ describe('trimBlankLines filter', function() {
1111
expect(filter.name).toEqual('trimBlankLines');
1212
});
1313

14-
it('should remove all empty lines from the start of the string', function() {
15-
expect(filter.process('\n\n\nsome text\n\nmore text\n\n'))
16-
.toEqual('some text\n\nmore text\n\n');
14+
it('should remove empty lines from the start and end of the string', function() {
15+
expect(filter.process('\n \n\nsome text\n \nmore text\n \n'))
16+
.toEqual('some text\n \nmore text');
1717
});
1818
});

0 commit comments

Comments
 (0)