Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorBert Belder <bertbelder@gmail.com>2012-06-14 20:34:38 +0400
committerBert Belder <bertbelder@gmail.com>2012-06-14 20:36:49 +0400
commitca003f4f3ee9a8d44f941b046ca5a5a16b49a314 (patch)
tree72ee1ef679c1c256b20af5892cdbafebe0789065 /tools
parentc2c08196d80d6034ca63866249e6a6d4b88650ca (diff)
license2rtf: collapse whitespace
Diffstat (limited to 'tools')
-rw-r--r--tools/license2rtf.js9
1 files changed, 8 insertions, 1 deletions
diff --git a/tools/license2rtf.js b/tools/license2rtf.js
index 9bf7de42f4c..f5a75a176dd 100644
--- a/tools/license2rtf.js
+++ b/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);
};