Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

license2rtf: collapse whitespace

  • Loading branch information...
commit ca003f4f3ee9a8d44f941b046ca5a5a16b49a314 1 parent c2c0819
@piscisaureus piscisaureus authored
Showing with 8 additions and 1 deletion.
  1. +8 −1 tools/license2rtf.js
View
9 tools/license2rtf.js
@@ -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);
};
Please sign in to comment.
Something went wrong with that request. Please try again.