Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
license2rtf: collapse whitespace
Browse files Browse the repository at this point in the history
  • Loading branch information
piscisaureus committed Jun 14, 2012
1 parent c2c0819 commit ca003f4
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion tools/license2rtf.js
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
};

Expand Down

0 comments on commit ca003f4

Please sign in to comment.