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

scribe at crosswire.org scribe at crosswire.org
Tue Apr 15 14:27:54 MST 2014


Author: scribe
Date: 2014-04-15 14:27:54 -0700 (Tue, 15 Apr 2014)
New Revision: 3155

Modified:
   trunk/src/modules/filters/osisheadings.cpp
Log:
Made consistent the handling of old school preverse titles and the newer
preverse divs.  They both include the <title> tags now for titles, so
fronends need to stop wrapping preverse headings with <h3> or whatever
the do to make it stand off as a title.  The <title> tag will process as
any other title tag now.

Modified: trunk/src/modules/filters/osisheadings.cpp
===================================================================
--- trunk/src/modules/filters/osisheadings.cpp	2014-04-15 20:27:07 UTC (rev 3154)
+++ trunk/src/modules/filters/osisheadings.cpp	2014-04-15 21:27:54 UTC (rev 3155)
@@ -91,6 +91,8 @@
 		if (name == u->currentHeadingName) {
 			if (tag.isEndTag(u->sID)) {
 				if (!u->depth-- || u->sID) {
+					// see comment below about preverse div changed and needing to preserve the <title> container tag for old school pre-verse titles
+					if (u->currentHeadingName == "title") u->heading.append(tag);
 					// we've just finished a heading.  It's all stored up in u->heading
 					bool canonical = (SWBuf("true") == u->currentHeadingTag.getAttribute("canonical"));
 					bool preverse = (SWBuf("x-preverse") == u->currentHeadingTag.getAttribute("subType") || SWBuf("x-preverse") == u->currentHeadingTag.getAttribute("subtype"));
@@ -130,7 +132,16 @@
 
 		u->currentHeadingName = name;
 		u->currentHeadingTag = tag;
-		u->heading = "";
+		// leave the actual <title...> wrapper in if we're part of an old school preverse title
+		// because now frontend have to deal with preverse as a div which may or may not include <title> elements
+		// and they can't simply wrap all preverse material in <h1>, like they probably did previously
+		if (name == "title") {
+			XMLTag wrapper = tag;
+			if (SWBuf("x-preverse") == wrapper.getAttribute("subType")) wrapper.setAttribute("subType", 0);
+			else if (SWBuf("x-preverse") == wrapper.getAttribute("subtype")) wrapper.setAttribute("subtype", 0);
+			u->heading = wrapper;
+		}
+		else	u->heading = "";
 		u->sID = u->currentHeadingTag.getAttribute("sID");
 		u->depth = 0;
 		u->suspendTextPassThru = true;




More information about the sword-cvs mailing list