mirror of
https://github.com/zebrajr/node.git
synced 2025-12-06 00:20:08 +01:00
license2rtf: collapse whitespace
This commit is contained in:
parent
c2c08196d8
commit
ca003f4f3e
|
|
@ -174,7 +174,8 @@ inherits(ParagraphParser, Stream);
|
|||
|
||||
/*
|
||||
* This filter consumes paragraph objects and emits modified paragraph objects.
|
||||
* The lines within the paragraph are unwrapped where appropriate.
|
||||
* The lines within the paragraph are unwrapped where appropriate. It also
|
||||
* replaces multiple consecutive whitespace characters by a single one.
|
||||
*/
|
||||
function Unwrapper() {
|
||||
var self = this;
|
||||
|
|
@ -210,6 +211,12 @@ function Unwrapper() {
|
|||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < lines.length; i++) {
|
||||
// Replace multiple whitespace characters by a single one, and strip
|
||||
// trailing whitespace.
|
||||
lines[i] = lines[i].replace(/\s+/g, ' ').replace(/\s+$/, '');
|
||||
}
|
||||
|
||||
self.emit('data', paragraph);
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user