[sword-svn] r2317 - trunk/src/modules/filters

scribe at crosswire.org scribe at crosswire.org
Fri Apr 10 10:59:52 MST 2009


Author: scribe
Date: 2009-04-10 10:59:52 -0700 (Fri, 10 Apr 2009)
New Revision: 2317

Modified:
   trunk/src/modules/filters/osisheadings.cpp
Log:
Added initial support for <div subType="x-preverse">


Modified: trunk/src/modules/filters/osisheadings.cpp
===================================================================
--- trunk/src/modules/filters/osisheadings.cpp	2009-04-10 15:59:46 UTC (rev 2316)
+++ trunk/src/modules/filters/osisheadings.cpp	2009-04-10 17:59:52 UTC (rev 2317)
@@ -50,6 +50,7 @@
 	bool hide       = false;
 	bool preverse   = false;
 	bool withinTitle = false;
+	bool withinPreverseDiv = false;
 	bool canonical  = false;
 	SWBuf header;
 	int headerNum   = 0;
@@ -71,10 +72,19 @@
 		}
 		if (*from == '>') {	// process tokens
 			intoken = false;
+			tag = token;
 
-			if (!strncmp(token.c_str(), "title", 5) || !strncmp(token.c_str(), "/title", 6)) {
-				withinTitle =  (!strnicmp(token.c_str(), "title", 5));
-				tag = token;
+			// <title> </title> <div subType="x-preverse"> (</div> ## when in previous)
+			if ( (!withinPreverseDiv && !strcmp(tag.getName(), "title")) || 
+				(!strcmp(tag.getName(), "div") &&
+					((tag.isEndTag() && withinPreverseDiv) ||
+					 (tag.getAttribute("subType") && !strcmp(tag.getAttribute("subType"), "x-preverse")))
+				)) {
+
+				withinTitle = !tag.isEndTag();
+				if (!strcmp(tag.getName(), "div")) {
+					withinPreverseDiv = !tag.isEndTag();
+				}
 				
 				if (!tag.isEndTag()) { //start tag
 					if (!tag.isEmpty()) {
@@ -82,8 +92,9 @@
 					}
 				}
 				
-				if (         (tag.getAttribute("subType") && !stricmp(tag.getAttribute("subType"), "x-preverse"))
-						|| (tag.getAttribute("subtype") && !stricmp(tag.getAttribute("subtype"), "x-preverse"))	// deprecated
+				if ( withinPreverseDiv
+					|| (tag.getAttribute("subType") && !stricmp(tag.getAttribute("subType"), "x-preverse"))
+					|| (tag.getAttribute("subtype") && !stricmp(tag.getAttribute("subtype"), "x-preverse"))	// deprecated
 						) {
 					hide = true;
 					preverse = true;




More information about the sword-cvs mailing list