[sword-cvs] sword/src/modules/filters osisplain.cpp,1.5,1.6 thmlgbf.cpp,1.13,1.14 thmlplain.cpp,1.11,1.12 thmlrtf.cpp,1.32,1.33

sword@www.crosswire.org sword@www.crosswire.org
Sat, 26 Jul 2003 16:11:16 -0700


Update of /usr/local/cvsroot/sword/src/modules/filters
In directory www:/tmp/cvs-serv17190/modules/filters

Modified Files:
	osisplain.cpp thmlgbf.cpp thmlplain.cpp thmlrtf.cpp 
Log Message:
extraneous whitespace removal

Index: osisplain.cpp
===================================================================
RCS file: /usr/local/cvsroot/sword/src/modules/filters/osisplain.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- osisplain.cpp	18 Jul 2003 10:36:02 -0000	1.5
+++ osisplain.cpp	26 Jul 2003 23:11:06 -0000	1.6
@@ -39,6 +39,27 @@
 	setTokenCaseSensitive(true);  
 }
 
+char OSISPlain::processText(SWBuf &text, const SWKey *key, const SWModule *module)
+{
+        SWBasicFilter::processText(text, key, module);  //handle tokens as usual
+	const char *from;
+	SWBuf orig = text;
+	from = orig.c_str();
+	for (text = ""; *from; from++) {  //loop to remove extra spaces
+                if ((strchr(" \t\n\r", *from))) {
+                        while (*(from+1) && (strchr(" \t\n\r", *(from+1)))) {
+                                from++;
+                        }
+                        text += " ";
+                }
+                else {
+                        text += *from;
+                }
+        }
+        text += (char)0;
+        return 0;
+}
+
 bool OSISPlain::handleToken(SWBuf &buf, const char *token, DualStringMap &userData) {
   // manually process if it wasn't a simple substitution
 	if (!substituteToken(buf, token)) {

Index: thmlgbf.cpp
===================================================================
RCS file: /usr/local/cvsroot/sword/src/modules/filters/thmlgbf.cpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- thmlgbf.cpp	27 Jun 2003 01:41:07 -0000	1.13
+++ thmlgbf.cpp	26 Jul 2003 23:11:06 -0000	1.14
@@ -261,6 +261,22 @@
 		}
 		else	text += *from;
 	}
+
+	orig = text;
+	from = orig.c_str();
+	for (text = ""; *from; from++) {  //loop to remove extra spaces
+                if ((strchr(" \t\n\r", *from))) {
+                        while (*(from+1) && (strchr(" \t\n\r", *(from+1)))) {
+                                from++;
+                        }
+                        text += " ";
+                }
+                else {
+                        text += *from;
+                }
+        }
+        text += (char)0;
+        
 	return 0;
 }
 

Index: thmlplain.cpp
===================================================================
RCS file: /usr/local/cvsroot/sword/src/modules/filters/thmlplain.cpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- thmlplain.cpp	27 Jun 2003 06:13:16 -0000	1.11
+++ thmlplain.cpp	26 Jul 2003 23:11:06 -0000	1.12
@@ -13,7 +13,6 @@
 ThMLPlain::ThMLPlain() {
 }
 
-
 char ThMLPlain::processText(SWBuf &text, const SWKey *key, const SWModule *module)
 {
 	char token[2048];
@@ -188,6 +187,21 @@
 		}
 		else	text += *from;
 	}
+
+	orig = text;
+	from = orig.c_str();
+	for (text = ""; *from; from++) {  //loop to remove extra spaces
+                if ((strchr(" \t\n\r", *from))) {
+                        while (*(from+1) && (strchr(" \t\n\r", *(from+1)))) {
+                                from++;
+                        }
+                        text += " ";
+                }
+                else {
+                        text += *from;
+                }
+        }
+        text += (char)0;
 
 	return 0;
 }

Index: thmlrtf.cpp
===================================================================
RCS file: /usr/local/cvsroot/sword/src/modules/filters/thmlrtf.cpp,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -d -r1.32 -r1.33
--- thmlrtf.cpp	27 Jun 2003 11:31:42 -0000	1.32
+++ thmlrtf.cpp	26 Jul 2003 23:11:06 -0000	1.33
@@ -149,6 +149,27 @@
         addTokenSubstitute("P", "\\par ");
 }
 
+char ThMLRTF::processText(SWBuf &text, const SWKey *key, const SWModule *module)
+{
+        SWBasicFilter::processText(text, key, module);  //handle tokens as usual
+	const char *from;
+	SWBuf orig = text;
+	from = orig.c_str();
+	for (text = ""; *from; from++) {  //loop to remove extra spaces
+                if ((strchr(" \t\n\r", *from))) {
+                        while (*(from+1) && (strchr(" \t\n\r", *(from+1)))) {
+                                from++;
+                        }
+                        text += " ";
+                }
+                else {
+                        text += *from;
+                }
+        }
+        text += (char)0;
+        return 0;
+}
+
 bool ThMLRTF::handleToken(SWBuf &buf, const char *token, DualStringMap &userData) {
 	if (!substituteToken(buf, token)) {
 	// manually process if it wasn't a simple substitution