[sword-svn] r1694 - trunk/utilities
scribe at crosswire.org
scribe at crosswire.org
Sun Jan 23 04:10:30 MST 2005
Author: scribe
Date: 2005-01-23 04:10:29 -0700 (Sun, 23 Jan 2005)
New Revision: 1694
Modified:
trunk/utilities/osis2mod.cpp
Log:
First attempt to revert removal of x-preverse headings and keep Chris' enhancements.
Modified: trunk/utilities/osis2mod.cpp
===================================================================
--- trunk/utilities/osis2mod.cpp 2005-01-12 10:18:02 UTC (rev 1693)
+++ trunk/utilities/osis2mod.cpp 2005-01-23 11:10:29 UTC (rev 1694)
@@ -165,15 +165,15 @@
bool handleToken(SWBuf &text, XMLTag token) {
- static bool inHeader = true;
- static bool inVerse = true;
-// static SWBuf headerType = "";
-// static SWBuf header = "";
-// static SWBuf lastTitle = "";
-// static int titleOffset = -1;
+ static bool inHeader = false;
+ static bool inVerse = true;
+ static SWBuf headerType = "";
+ static SWBuf header = "";
+ static SWBuf lastTitle = "";
+ static int titleOffset = -1;
static ListKey lastVerseIDs = ListKey();
- /*if ((!strcmp(token.getName(), "title")) && (!token.isEndTag() && !(token.getAttribute("eID")))) {
+ if ((!strcmp(token.getName(), "title")) && (!token.isEndTag() && !(token.getAttribute("eID")))) {
titleOffset = text.length();
return false;
}
@@ -181,27 +181,27 @@
lastTitle = (text.c_str() + titleOffset);
lastTitle += token;
return false;
- }*/
+ }
if (((!strcmp(token.getName(), "div")) && (!token.isEndTag() && !(token.getAttribute("eID"))) && (token.getAttribute("osisID"))) && (!strcmp(token.getAttribute("type"), "book"))) {
inVerse = false;
if (inHeader) { // this one should never happen, but just in case
// cout << "HEADING ";
currentVerse->Testament(0);
- currentVerse->Book(0);
- currentVerse->Chapter(0);
- currentVerse->Verse(0);
- writeEntry(*currentVerse, text);
+ currentVerse->Book(0);
+ currentVerse->Chapter(0);
+ currentVerse->Verse(0);
+ writeEntry(*currentVerse, text);
inHeader = false;
}
*currentVerse = token.getAttribute("osisID");
currentVerse->Chapter(0);
currentVerse->Verse(0);
inHeader = true;
-// headerType = "book";
-// lastTitle = "";
+ headerType = "book";
+ lastTitle = "";
text = "";
}
- else if (((!strcmp(token.getName(), "chapter")) && (!token.isEndTag() || (token.getAttribute("eID"))) && (token.getAttribute("osisID")))) {
+ else if ((((!strcmp(token.getName(), "div")) && (!token.isEndTag()) && (token.getAttribute("osisID"))) && (!strcmp(token.getAttribute("type"), "chapter"))) || ((!strcmp(token.getName(), "chapter")) && (!token.isEndTag() || (token.getAttribute("eID"))) && (token.getAttribute("osisID")))) {
inVerse = false;
if (inHeader) {
// cout << "HEADING ";
@@ -212,8 +212,8 @@
*currentVerse = token.getAttribute("osisID");
currentVerse->Verse(0);
inHeader = true;
-// headerType = "chap";
-// lastTitle = "";
+ headerType = "chap";
+ lastTitle = "";
text = "";
}
else if ((!strcmp(token.getName(), "verse")) && (!token.isEndTag() && !(token.getAttribute("eID")))) {
@@ -252,7 +252,7 @@
}
else if ((!strcmp(token.getName(), "verse")) && (token.isEndTag() || (token.getAttribute("eID")))) {
inVerse = false;
-/* if (lastTitle.length()) {
+ if (lastTitle.length()) {
SWBuf titleHead = lastTitle;
char *end = strchr(lastTitle.getRawData(), '>');
titleHead.setSize((end - lastTitle.getRawData())+1);
@@ -260,8 +260,8 @@
titleTag.setAttribute("type", "section");
titleTag.setAttribute("subtype", "x-preverse");
text = SWBuf(titleTag) + SWBuf(end+1) + text;
- }*/
- text += token;
+ }
+// text += token;
writeEntry(*currentVerse, text);
// If we found an osisID like osisID="Gen.1.1 Gen.1.2 Gen.1.3" we have to link Gen.1.2 and Gen.1.3 to Gen.1.1
@@ -279,7 +279,7 @@
}
}
-// lastTitle = "";
+ lastTitle = "";
text = "";
return true;
}
More information about the sword-cvs
mailing list