[sword-cvs] sword/src/modules/filters osisplain.cpp,1.10,1.11 osisrtf.cpp,1.19,1.20 swbasicfilter.cpp,1.28,1.29

sword@www.crosswire.org sword@www.crosswire.org
Tue, 5 Aug 2003 02:06:32 -0700


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

Modified Files:
	osisplain.cpp osisrtf.cpp swbasicfilter.cpp 
Log Message:


Index: osisplain.cpp
===================================================================
RCS file: /usr/local/cvsroot/sword/src/modules/filters/osisplain.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- osisplain.cpp	30 Jul 2003 02:03:45 -0000	1.10
+++ osisplain.cpp	5 Aug 2003 09:06:30 -0000	1.11
@@ -44,21 +44,6 @@
         addTokenSubstitute("/lg", "\n");
 
         setTokenCaseSensitive(true);
-	setStageProcessing(PRECHAR);		// just at top of for loop
-}
-
-
-bool OSISPlain::processStage(char stage, SWBuf &text, char *&from, UserData *userData) {
-	switch (stage) {
-	PRECHAR:
-		if ((strchr(" \t\n\r", *from))) {
-			while (*(from+1) && (strchr(" \t\n\r", *(from+1)))) {
-				from++;
-			}
-			*from = ' ';
-		}
-	}
-	return false;
 }
 
 
@@ -145,11 +130,13 @@
 		// <p> paragraph tag
 		else if (((*token == 'p') && ((token[1] == ' ') || (!token[1]))) ||
 			((*token == '/') && (token[1] == 'p') && (!token[2]))) {
+				userData->supressAdjacentWhitespace = true;
 				buf += "\n";
 		}
 
                 // <milestone type="line"/>
                 else if ((!strcmp(tag.getName(), "milestone")) && (tag.getAttribute("type")) && (!strcmp(tag.getAttribute("type"), "line"))) {
+			userData->supressAdjacentWhitespace = true;
         		buf += "\n";
                 }
 

Index: osisrtf.cpp
===================================================================
RCS file: /usr/local/cvsroot/sword/src/modules/filters/osisrtf.cpp,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- osisrtf.cpp	30 Jul 2003 02:03:45 -0000	1.19
+++ osisrtf.cpp	5 Aug 2003 09:06:30 -0000	1.20
@@ -45,21 +45,6 @@
         addTokenSubstitute("lg", "\\par ");
         addTokenSubstitute("/lg", "\\par ");
 	setTokenCaseSensitive(true);
-	setStageProcessing(PRECHAR);		// just at top of for loop
-}
-
-
-bool OSISRTF::processStage(char stage, SWBuf &text, char *&from, UserData *userData) {
-	switch (stage) {
-	PRECHAR:
-		if ((strchr(" \t\n\r", *from))) {
-			while (*(from+1) && (strchr(" \t\n\r", *(from+1)))) {
-				from++;
-			}
-			*from = ' ';
-		}
-	}
-	return false;
 }
 
 
@@ -179,9 +164,11 @@
 			}
 			else if (tag.isEndTag()) {	// end tag
 				buf += "\\par}";
+				userData->supressAdjacentWhitespace = true;
 			}
 			else {					// empty paragraph break marker
 				buf += "{\\par\\par}";
+				userData->supressAdjacentWhitespace = true;
 			}
 		}
 
@@ -211,6 +198,7 @@
                 // <milestone type="line"/>
                 else if ((!strcmp(tag.getName(), "milestone")) && (tag.getAttribute("type")) && (!strcmp(tag.getAttribute("type"), "line"))) {
         		buf += "\\par ";
+			userData->supressAdjacentWhitespace = true;
                 }
 
 		// <title>

Index: swbasicfilter.cpp
===================================================================
RCS file: /usr/local/cvsroot/sword/src/modules/filters/swbasicfilter.cpp,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -d -r1.28 -r1.29
--- swbasicfilter.cpp	30 Jul 2003 02:03:45 -0000	1.28
+++ swbasicfilter.cpp	5 Aug 2003 09:06:30 -0000	1.29
@@ -298,9 +298,12 @@
 				token[tokpos+2] = 0;
 		}
 		else {
-			if (!userData->suspendTextPassThru)
-				text += *from;
-			lastTextNode += *from;
+			if ((!userData->supressAdjacentWhitepace) || (*from != ' ')) {
+				if (!userData->suspendTextPassThru)
+					text += *from;
+				lastTextNode += *from;
+			}
+			userData->supressAdjacentWhitespace = false;
 		}
 
 		if (processStages & POSTCHAR)