[sword-svn] r1707 - trunk/utilities

jansorg at crosswire.org jansorg at crosswire.org
Wed Feb 2 08:41:55 MST 2005


Author: jansorg
Date: 2005-02-02 08:41:54 -0700 (Wed, 02 Feb 2005)
New Revision: 1707

Modified:
   trunk/utilities/osis2mod.cpp
Log:
another fix to osis2mod. Fixes preverse titles being inserted as chapter intro

Modified: trunk/utilities/osis2mod.cpp
===================================================================
--- trunk/utilities/osis2mod.cpp	2005-01-30 20:10:11 UTC (rev 1706)
+++ trunk/utilities/osis2mod.cpp	2005-02-02 15:41:54 UTC (rev 1707)
@@ -223,9 +223,22 @@
 	else if ((!strcmp(token.getName(), "verse")) && (!token.isEndTag() && !(token.getAttribute("eID")))) {
 		inVerse = true;
 		if (inHeader) {
-//			cout << "HEADING ";
+			//make sure we don't insert the preverse title which belongs to the first verse of this chapter!
+			const char* chapterTagEnd = strchr(text.c_str(), '>');
+			const char* titleTagStart = strstr(text.c_str(), "<title");
+			
+			if (chapterTagEnd+1 == titleTagStart) {
+				const char* titleTagEnd = strstr(text.c_str(), "</title>");
+				const char* textEnd = text.c_str() + text.length();
+				if (titleTagEnd+8 == textEnd) {
+					text.setSize(chapterTagEnd+1-text.c_str()); //only insert the <chapter...> part
+				}
+			}
+			
+// 			cout << "HEADING "<< text.c_str() << endl;
 			writeEntry(*currentVerse, text);
-                        text = "";
+			
+			text = "";
 			inHeader = false;
 		}
 



More information about the sword-cvs mailing list