[sword-svn] r1975 - in trunk: include lib/bcppmake src/modules/filters

scribe at www.crosswire.org scribe at www.crosswire.org
Wed Sep 20 21:30:11 MST 2006


Author: scribe
Date: 2006-09-20 21:29:01 -0700 (Wed, 20 Sep 2006)
New Revision: 1975

Modified:
   trunk/include/osishtmlhref.h
   trunk/lib/bcppmake/libsword.bpr
   trunk/src/modules/filters/osishtmlhref.cpp
   trunk/src/modules/filters/osiswebif.cpp
Log:
apply same fixes to other osis render filters.

Modified: trunk/include/osishtmlhref.h
===================================================================
--- trunk/include/osishtmlhref.h	2006-09-21 04:10:23 UTC (rev 1974)
+++ trunk/include/osishtmlhref.h	2006-09-21 04:29:01 UTC (rev 1975)
@@ -37,6 +37,7 @@
 		bool osisQToTick;
 		bool inBold;
 		bool inName;
+		int suspendLevel;
 		SWBuf wordsOfChristStart;
 		SWBuf wordsOfChristEnd;
                 QuoteStack *quoteStack;

Modified: trunk/lib/bcppmake/libsword.bpr
===================================================================
--- trunk/lib/bcppmake/libsword.bpr	2006-09-21 04:10:23 UTC (rev 1974)
+++ trunk/lib/bcppmake/libsword.bpr	2006-09-21 04:29:01 UTC (rev 1975)
@@ -288,4 +288,4 @@
 ProjectLang=
 RootDir=
   </IDEOPTIONS>
-</PROJECT>
+</PROJECT>
\ No newline at end of file

Modified: trunk/src/modules/filters/osishtmlhref.cpp
===================================================================
--- trunk/src/modules/filters/osishtmlhref.cpp	2006-09-21 04:10:23 UTC (rev 1974)
+++ trunk/src/modules/filters/osishtmlhref.cpp	2006-09-21 04:29:01 UTC (rev 1975)
@@ -1,6 +1,6 @@
 /***************************************************************************
-                     osishtmlhref.cpp  -  OSIS to HTML with hrefs filter
-                             -------------------
+				 osishtmlhref.cpp  -  OSIS to HTML with hrefs filter
+					    -------------------
     begin                : 2003-06-24
     copyright            : 2003 by CrossWire Bible Society
  ***************************************************************************/
@@ -29,6 +29,9 @@
 };
 
 OSISHTMLHREF::MyUserData::MyUserData(const SWModule *module, const SWKey *key) : BasicFilterUserData(module, key) {
+	inBold = false;
+	inName = false;
+	suspendLevel = 0;
 	quoteStack = new QuoteStack();
 	wordsOfChristStart = "<font color=\"red\"> ";
 	wordsOfChristEnd   = "</font> ";
@@ -82,9 +85,11 @@
 static inline void outText(char t, SWBuf &o, BasicFilterUserData *u) { if (!u->suspendTextPassThru) o += t; }
 
 bool OSISHTMLHREF::handleToken(SWBuf &buf, const char *token, BasicFilterUserData *userData) {
+	MyUserData *u = (MyUserData *)userData;
+	SWBuf scratch;
+	bool sub = (u->suspendTextPassThru) ? substituteToken(scratch, token) : substituteToken(buf, token);
+	if (!sub) {
   // manually process if it wasn't a simple substitution
-	if (!substituteToken(buf, token)) {
-		MyUserData *u = (MyUserData *)userData;
 		XMLTag tag(token);
 		
 		// <w> tag
@@ -217,10 +222,10 @@
 						}
 					}
 				}
-				u->suspendTextPassThru = true;
+				u->suspendTextPassThru = (++u->suspendLevel);
 			}
 			if (tag.isEndTag()) {
-				u->suspendTextPassThru = false;
+				u->suspendTextPassThru = (--u->suspendLevel);
 			}
 		}
 
@@ -324,12 +329,12 @@
 		else if (!strcmp(tag.getName(), "divineName")) {
 			if ((!tag.isEndTag()) && (!tag.isEmpty())) {
 				u->inName = true;
-				u->suspendTextPassThru = true;
+				u->suspendTextPassThru = (++u->suspendLevel);
 			}
 			else if (tag.isEndTag()) {
 				if(u->inName ) {
 					u->inName = false;
-					u->suspendTextPassThru = false;
+					u->suspendTextPassThru = (--u->suspendLevel);
 					char firstChar = *u->lastTextNode.c_str();
 					const char *name = u->lastTextNode.c_str();
 					++name;

Modified: trunk/src/modules/filters/osiswebif.cpp
===================================================================
--- trunk/src/modules/filters/osiswebif.cpp	2006-09-21 04:10:23 UTC (rev 1974)
+++ trunk/src/modules/filters/osiswebif.cpp	2006-09-21 04:29:01 UTC (rev 1975)
@@ -40,9 +40,11 @@
 
 
 bool OSISWEBIF::handleToken(SWBuf &buf, const char *token, BasicFilterUserData *userData) {
+	MyUserData *u = (MyUserData *)userData;
+	SWBuf scratch;
+	bool sub = (u->suspendTextPassThru) ? substituteToken(scratch, token) : substituteToken(buf, token);
+	if (!sub) {
   // manually process if it wasn't a simple substitution
-	if (!substituteToken(buf, token)) {
-		MyUserData *u = (MyUserData *)userData;
 		XMLTag tag(token);
 
 		// <w> tag
@@ -148,11 +150,11 @@
 							buf.appendFormatted("<span class=\"fn\" onclick=\"f(\'%s\',\'%s\',\'%s\');\" >%c</span>", modName.c_str(), u->key->getText(), footnoteNumber.c_str(), ch);
 						}
 					}
-					u->suspendTextPassThru = true;
+					u->suspendTextPassThru = (++u->suspendLevel);
 				}
 			}
 			if (tag.isEndTag()) {
-				u->suspendTextPassThru = false;
+				u->suspendTextPassThru = (--u->suspendLevel);
 
 			}
 		}




More information about the sword-cvs mailing list