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

scribe at crosswire.org scribe at crosswire.org
Sun Apr 26 10:53:52 MST 2020


Author: scribe
Date: 2020-04-26 10:53:51 -0700 (Sun, 26 Apr 2020)
New Revision: 3726

Modified:
   trunk/src/modules/filters/gbfxhtml.cpp
   trunk/src/modules/filters/osisxhtml.cpp
   trunk/src/modules/filters/teixhtml.cpp
   trunk/src/modules/filters/thmlxhtml.cpp
Log:
updated XHTML render filters to consistenty include class noteMarker along with any type or subType class


Modified: trunk/src/modules/filters/gbfxhtml.cpp
===================================================================
--- trunk/src/modules/filters/gbfxhtml.cpp	2020-04-21 02:01:37 UTC (rev 3725)
+++ trunk/src/modules/filters/gbfxhtml.cpp	2020-04-26 17:53:51 UTC (rev 3726)
@@ -171,10 +171,17 @@
 			SWBuf type = tag.getAttribute("type");
 			SWBuf footnoteNumber = tag.getAttribute("swordFootnote");
 			SWBuf noteName = tag.getAttribute("n");
+			SWBuf classExtras = "";
+
+			if (type.size()) {
+				classExtras.append(" ").append(type);
+			}
+
 			if (u->vkey) {
 				// leave this special osis type in for crossReference notes types?  Might thml use this some day? Doesn't hurt.
 				//char ch = ((tag.getAttribute("type") && ((!strcmp(tag.getAttribute("type"), "crossReference")) || (!strcmp(tag.getAttribute("type"), "x-cross-ref")))) ? 'x':'n');
-				buf.appendFormatted("<a href=\"passagestudy.jsp?action=showNote&type=n&value=%s&module=%s&passage=%s\"><small><sup class=\"n\">*n%s</sup></small></a> ", 
+				buf.appendFormatted("<a class=\"noteMarker%s\" href=\"passagestudy.jsp?action=showNote&type=n&value=%s&module=%s&passage=%s\"><small><sup class=\"n\">*n%s</sup></small></a> ", 
+					classExtras.c_str(),
 					URL::encode(footnoteNumber.c_str()).c_str(),
 					URL::encode(u->version.c_str()).c_str(), 
 					URL::encode(u->vkey->getText()).c_str(), 

Modified: trunk/src/modules/filters/osisxhtml.cpp
===================================================================
--- trunk/src/modules/filters/osisxhtml.cpp	2020-04-21 02:01:37 UTC (rev 3725)
+++ trunk/src/modules/filters/osisxhtml.cpp	2020-04-26 17:53:51 UTC (rev 3726)
@@ -288,6 +288,11 @@
 		else if (!strcmp(tag.getName(), "note")) {
 			if (!tag.isEndTag()) {
 				SWBuf type = tag.getAttribute("type");
+
+				// for backward compatibility
+				if (type == "strongsMarkup") type = "x-strongsMarkup";
+				if (type == "x-cross-ref") type = "crossReference";
+
 				SWBuf subType = tag.getAttribute("subType");
 				SWBuf classExtras = "";
 
@@ -298,7 +303,7 @@
                                         classExtras.append(" ").append(subType);
                                 }
 
-				bool strongsMarkup = (type == "x-strongsMarkup" || type == "strongsMarkup");	// the latter is deprecated
+				bool strongsMarkup = type == "x-strongsMarkup";
 				if (strongsMarkup) {
 					tag.setEmpty(false);	// handle bug in KJV2003 module where some note open tags were <note ... />
 				}
@@ -308,7 +313,7 @@
 					if (!strongsMarkup) {	// leave strong's markup notes out, in the future we'll probably have different option filters to turn different note types on or off
 						SWBuf footnoteNumber = tag.getAttribute("swordFootnote");
 						SWBuf noteName = tag.getAttribute("n");
-						char ch = ((tag.getAttribute("type") && ((!strcmp(tag.getAttribute("type"), "crossReference")) || (!strcmp(tag.getAttribute("type"), "x-cross-ref")))) ? 'x':'n');
+						char ch = (type == "crossReference" ? 'x':'n');
 
 						u->inXRefNote = true; // Why this change? Ben Morgan: Any note can have references in, so we need to set this to true for all notes
 //						u->inXRefNote = (ch == 'x');

Modified: trunk/src/modules/filters/teixhtml.cpp
===================================================================
--- trunk/src/modules/filters/teixhtml.cpp	2020-04-21 02:01:37 UTC (rev 3725)
+++ trunk/src/modules/filters/teixhtml.cpp	2020-04-26 17:53:51 UTC (rev 3726)
@@ -293,6 +293,7 @@
 					u->suspendTextPassThru = true;
 				}
 			}
+			// how does any of this work??? If isEndTag is true, </note>, there will be no attributes.
 			if (tag.isEndTag()) {
 				SWBuf footnoteNumber = tag.getAttribute("swordFootnote");
 				SWBuf noteName = tag.getAttribute("n");

Modified: trunk/src/modules/filters/thmlxhtml.cpp
===================================================================
--- trunk/src/modules/filters/thmlxhtml.cpp	2020-04-21 02:01:37 UTC (rev 3725)
+++ trunk/src/modules/filters/thmlxhtml.cpp	2020-04-26 17:53:51 UTC (rev 3726)
@@ -211,14 +211,28 @@
 		// <note> tag
 		else if (!strcmp(tag.getName(), "note")) {
 			if (!tag.isEndTag()) {
+				SWBuf type = tag.getAttribute("type");
+
+				// for backward compatibility
+				if (type == "x-cross-ref") type = "crossReference";
+
+				SWBuf subType = tag.getAttribute("subType");
+				SWBuf footnoteNumber = tag.getAttribute("swordFootnote");
+				SWBuf noteName = tag.getAttribute("n");
+				SWBuf classExtras = "";
+
+				if (type.size()) {
+					classExtras.append(" ").append(type);
+				}
+				if (subType.size()) {
+                                        classExtras.append(" ").append(subType);
+                                }
 				if (!tag.isEmpty()) {
-					SWBuf type = tag.getAttribute("type");
-					SWBuf footnoteNumber = tag.getAttribute("swordFootnote");
-					SWBuf noteName = tag.getAttribute("n");
 					if (u->vkey) {
 						// leave this special osis type in for crossReference notes types?  Might thml use this some day? Doesn't hurt.
-						char ch = ((tag.getAttribute("type") && ((!strcmp(tag.getAttribute("type"), "crossReference")) || (!strcmp(tag.getAttribute("type"), "x-cross-ref")))) ? 'x':'n');
-						buf.appendFormatted("<a href=\"passagestudy.jsp?action=showNote&type=%c&value=%s&module=%s&passage=%s\"><small><sup class=\"%c\">*%c%s</sup></small></a>", 
+						char ch = (type == "crossReference" ? 'x':'n');
+						buf.appendFormatted("<a class=\"noteMarker%s\" href=\"passagestudy.jsp?action=showNote&type=%c&value=%s&module=%s&passage=%s\"><small><sup class=\"%c\">*%c%s</sup></small></a>", 
+							classExtras.c_str(),
 							ch, 
 							URL::encode(footnoteNumber.c_str()).c_str(), 
 							URL::encode(u->version.c_str()).c_str(), 
@@ -229,7 +243,8 @@
 					}
 					else {
 						char ch = ((tag.getAttribute("type") && ((!strcmp(tag.getAttribute("type"), "crossReference")) || (!strcmp(tag.getAttribute("type"), "x-cross-ref")))) ? 'x':'n');
-						buf.appendFormatted("<a href=\"passagestudy.jsp?action=showNote&type=%c&value=%s&module=%s&passage=%s\"><small><sup class=\"%c\">*%c%s</sup></small></a>", 
+						buf.appendFormatted("<a class=\"noteMarker%s\" href=\"passagestudy.jsp?action=showNote&type=%c&value=%s&module=%s&passage=%s\"><small><sup class=\"%c\">*%c%s</sup></small></a>", 
+							classExtras.c_str(),
 							ch, 
 							URL::encode(footnoteNumber.c_str()).c_str(), 
 							URL::encode(u->version.c_str()).c_str(), 




More information about the sword-cvs mailing list