[sword-svn] r2409 - in trunk: include src/modules/filters

chrislit at crosswire.org chrislit at crosswire.org
Thu May 14 00:24:48 MST 2009


Author: chrislit
Date: 2009-05-14 00:24:47 -0700 (Thu, 14 May 2009)
New Revision: 2409

Modified:
   trunk/include/teirtf.h
   trunk/src/modules/filters/teirtf.cpp
Log:
added handling of <ref> tag for case where an osisRef is present (i.e. Biblical references)


Modified: trunk/include/teirtf.h
===================================================================
--- trunk/include/teirtf.h	2009-05-14 06:53:22 UTC (rev 2408)
+++ trunk/include/teirtf.h	2009-05-14 07:24:47 UTC (rev 2409)
@@ -34,6 +34,7 @@
 	class MyUserData : public BasicFilterUserData {
 	public:
 		bool BiblicalText;
+		bool inOsisRef;
 		SWBuf w;
 		SWBuf version;
 		MyUserData(const SWModule *module, const SWKey *key);

Modified: trunk/src/modules/filters/teirtf.cpp
===================================================================
--- trunk/src/modules/filters/teirtf.cpp	2009-05-14 06:53:22 UTC (rev 2408)
+++ trunk/src/modules/filters/teirtf.cpp	2009-05-14 07:24:47 UTC (rev 2409)
@@ -32,6 +32,7 @@
 
 TEIRTF::MyUserData::MyUserData(const SWModule *module, const SWKey *key) : BasicFilterUserData(module, key) {
 	BiblicalText = false;
+	inOsisRef = false;
 	if (module) {
 		version = module->Name();
 		BiblicalText = (!strcmp(module->Type(), "Biblical Texts"));
@@ -181,6 +182,19 @@
 			userData->supressAdjacentWhitespace = true;
 		}
 
+		// <ref> tag
+		else if (!strcmp(tag.getName(), "ref")) {
+			if (!tag.isEndTag() && tag.getAttribute("osisRef")) {
+				buf += "{<a href=\"\">";
+				u->inOsisRef = true;
+			}
+			else if (tag.isEndTag() && u->inOsisRef) {
+				buf += "</a>}";
+				u->inOsisRef = false;
+			}
+		}
+
+
 		else {
 			return false;  // we still didn't handle token
 		}




More information about the sword-cvs mailing list