[sword-cvs] sword/src/modules/filters osisrtf.cpp,1.3,1.4

sword@www.crosswire.org sword@www.crosswire.org
Wed, 18 Jun 2003 13:55:20 -0700


Update of /usr/local/cvsroot/sword/src/modules/filters
In directory www:/tmp/cvs-serv9563/src/modules/filters

Modified Files:
	osisrtf.cpp 
Log Message:


Index: osisrtf.cpp
===================================================================
RCS file: /usr/local/cvsroot/sword/src/modules/filters/osisrtf.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** osisrtf.cpp	6 Apr 2003 07:27:13 -0000	1.3
--- osisrtf.cpp	18 Jun 2003 20:55:18 -0000	1.4
***************
*** 18,21 ****
--- 18,23 ----
  #include <string.h>
  #include <osisrtf.h>
+ #include <utilxml.h>
+ #include <versekey.h>
  
  SWORD_NAMESPACE_START
***************
*** 43,46 ****
--- 45,49 ----
    // manually process if it wasn't a simple substitution
    if (!substituteToken(buf, token)) {
+ 	XMLTag tag(token);
      //w
      if (!strncmp(token, "w", 1)) {
***************
*** 88,91 ****
--- 91,116 ----
        buf += "}";
      }
+ 	else if (!strcmp(tag.getName(), "note")) {
+ 		if (!tag.isEmpty() && !tag.isEndTag()) {
+ 			string footnoteNum = userData["fn"];
+ 			int footnoteNumber = (footnoteNum.length()) ? atoi(footnoteNum.c_str()) : 1;
+ 			VerseKey *vkey;
+ 			// see if we have a VerseKey * or decendant
+ 			try {
+ 				vkey = SWDYNAMIC_CAST(VerseKey, this->key);
+ 			}
+ 			catch ( ... ) {	}
+ 			if (vkey) {
+ 				buf.appendFormatted("{<a href=\"\">*n%i.%i</a>}", vkey->Verse(), footnoteNumber);
+ 				SWBuf tmp;
+ 				tmp.appendFormatted("%i", ++footnoteNumber);
+ 				userData["fn"] = tmp.c_str();
+ 				userData["suspendTextPassThru"] = "true";
+ 			}
+ 		}
+ 		if (tag.isEndTag()) {
+ 			userData["suspendTextPassThru"] = "false";
+ 		}
+ 	}
  
      //p
***************
*** 113,123 ****
      }
  
-     //note
-     else if (!strncmp(token, "note", 4)) {
-       buf += " {\\i1\\fs15 (";
-     }
-     else if (!strncmp(token, "/note", 5)) {
-       buf += ")} ";
-     }
  
      //title
--- 138,141 ----