[sword-cvs] sword/src/modules/filters osisheadings.cpp,1.15,1.16 osisplain.cpp,1.18,1.19

sword@www.crosswire.org sword@www.crosswire.org
Fri, 16 Apr 2004 04:25:58 -0700


Update of /cvs/core/sword/src/modules/filters
In directory www:/tmp/cvs-serv15514/src/modules/filters

Modified Files:
	osisheadings.cpp osisplain.cpp 
Log Message:
Fixed the last bugs; all is working now again as before the optimization (joachim)

Index: osisheadings.cpp
===================================================================
RCS file: /cvs/core/sword/src/modules/filters/osisheadings.cpp,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- osisheadings.cpp	14 Apr 2004 20:08:57 -0000	1.15
+++ osisheadings.cpp	16 Apr 2004 11:25:56 -0000	1.16
@@ -14,6 +14,9 @@
 #include <unixstr.h>
 #endif
 
+#include <iostream>
+using namespace std;
+
 SWORD_NAMESPACE_START
 
 const char oName[] = "Headings";
@@ -32,6 +35,7 @@
 
 
 char OSISHeadings::processText(SWBuf &text, const SWKey *key, const SWModule *module) {
+
 	SWBuf token;
 	bool intoken    = false;
 	bool hide       = false;
@@ -45,28 +49,28 @@
 	SWBuf orig = text;
 	const char *from = orig.c_str();
 	
-	XMLTag tag;
+ 	XMLTag tag;
 
 	for (text = ""; *from; ++from) {
 		if (*from == '<') {
 			intoken = true;
 			token = "";
+			
 			continue;
 		}
 		if (*from == '>') {	// process tokens
 			intoken = false;
 
-			//if (!stricmp(tag.getName(), "title")) {
 			if (!strncmp(token.c_str(), "title", 5) || !strncmp(token.c_str(), "/title", 6)) {
-				
 				tag = token;
-				if ((tag.getAttribute("subtype")) && (!stricmp(tag.getAttribute("subtype"), "x-preverse"))) {
+				
+				if (tag.getAttribute("subtype") && !stricmp(tag.getAttribute("subtype"), "x-preverse")) {
 					hide = true;
 					preverse = true;
 					header = "";
 					continue;
 				}
-				if (!tag.isEndTag()) {
+				if (!tag.isEndTag()) { //start tag
 					if (!tag.isEmpty()) {
 						startTag = tag;
 					}
@@ -80,9 +84,8 @@
 					continue;
 				}
 				if (hide && tag.isEndTag()) {
-
 					SWBuf subType = startTag.getAttribute("subType");
-					if (module->isProcessEntryAttributes() && ((option) || (subType != "x-Section"))) {
+					if (module->isProcessEntryAttributes() && (option || (subType != "x-Section"))) {
 						if (preverse) {
 							sprintf(buf, "%i", pvHeaderNum++);
 							module->getEntryAttributes()["Heading"]["Preverse"][buf] = header;
@@ -100,8 +103,9 @@
 							module->getEntryAttributes()["Heading"][buf][it->c_str()] = startTag.getAttribute(it->c_str());
 						}
 					}
+					
 					hide = false;
-					if ((!option) || (preverse)) {	// we don't want the tag in the text anymore
+					if (!option || preverse) {	// we don't want the tag in the text anymore
 						preverse = false;
 						continue;
 					}

Index: osisplain.cpp
===================================================================
RCS file: /cvs/core/sword/src/modules/filters/osisplain.cpp,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- osisplain.cpp	14 Apr 2004 20:08:57 -0000	1.18
+++ osisplain.cpp	16 Apr 2004 11:25:56 -0000	1.19
@@ -37,9 +37,8 @@
 	addEscapeStringSubstitute("quot", "\"");
 
         setTokenCaseSensitive(true);
-
-        addTokenSubstitute("title", "\n");
-        addTokenSubstitute("/title", "\n");
+//        addTokenSubstitute("title", "\n");
+//        addTokenSubstitute("/title", "\n");
         addTokenSubstitute("/l", "\n");
         addTokenSubstitute("lg", "\n");
         addTokenSubstitute("/lg", "\n");