[sword-svn] r3460 - in trunk: src/modules/filters tests/testsuite

refdoc at crosswire.org refdoc at crosswire.org
Wed May 17 11:10:54 MST 2017


Author: refdoc
Date: 2017-05-17 11:10:53 -0700 (Wed, 17 May 2017)
New Revision: 3460

Modified:
   trunk/src/modules/filters/osisxhtml.cpp
   trunk/tests/testsuite/osis_basic.good
Log:
Improved xhtml/css classes for canonical titles, strongs and morph links and
footnotes - see [API155]


Modified: trunk/src/modules/filters/osisxhtml.cpp
===================================================================
--- trunk/src/modules/filters/osisxhtml.cpp	2017-04-27 09:08:02 UTC (rev 3459)
+++ trunk/src/modules/filters/osisxhtml.cpp	2017-05-17 18:10:53 UTC (rev 3460)
@@ -90,7 +90,7 @@
 			//	show = false;
 			//else {
 				if (!suspendTextPassThru) {
-					buf.appendFormatted("<small><em class=\"strongs\">&lt;<a href=\"passagestudy.jsp?action=showStrongs&type=%s&value=%s\" class=\"strongs\">%s</a>&gt;</em></small>",
+					buf.appendFormatted("<small><em class=\"strongs\">&lt;<a class=\"strongs\" href=\"passagestudy.jsp?action=showStrongs&type=%s&value=%s\" class=\"strongs\">%s</a>&gt;</em></small>",
 							(gh.length()) ? gh.c_str() : "", 
 							URL::encode(val2).c_str(),
 							val2);
@@ -122,7 +122,7 @@
 				if ((*val == 'T') && (strchr("GH", val[1])) && (isdigit(val[2])))
 					val2+=2;
 				if (!suspendTextPassThru) {
-					buf.appendFormatted("<small><em class=\"morph\">(<a href=\"passagestudy.jsp?action=showMorph&type=%s&value=%s\" class=\"morph\">%s</a>)</em></small>",
+					buf.appendFormatted("<small><em class=\"morph\">(<a class=\"morph\" href=\"passagestudy.jsp?action=showMorph&type=%s&value=%s\" class=\"morph\">%s</a>)</em></small>",
 							URL::encode(tag.getAttribute("morph")).c_str(),
 							URL::encode(val).c_str(), 
 							val2);
@@ -273,6 +273,16 @@
 		else if (!strcmp(tag.getName(), "note")) {
 			if (!tag.isEndTag()) {
 				SWBuf type = tag.getAttribute("type");
+				SWBuf subType = tag.getAttribute("subType");
+				SWBuf classExtras = "";
+
+				if (type.size()) {
+					classExtras.append(" ").append(type);
+				}
+				if (subType.size()) {
+                                        classExtras.append(" ").append(subType);
+                                }
+
 				bool strongsMarkup = (type == "x-strongsMarkup" || type == "strongsMarkup");	// the latter is deprecated
 				if (strongsMarkup) {
 					tag.setEmpty(false);	// handle bug in KJV2003 module where some note open tags were <note ... />
@@ -296,7 +306,8 @@
 						SWCATCH ( ... ) {	}
 						if (vkey) {
 							//printf("URL = %s\n",URL::encode(vkey->getText()).c_str());
-							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=\"%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(), 
@@ -306,7 +317,8 @@
 								(renderNoteNumbers ? noteName.c_str() : ""));
 						}
 						else {
-							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=\"%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(), 
@@ -491,10 +503,16 @@
 		else if (!strcmp(tag.getName(), "title")) {
 			if ((!tag.isEndTag()) && (!tag.isEmpty())) {
 				SWBuf type = tag.getAttribute("type");
+				SWBuf canonical = tag.getAttribute("canonical");
+				
 				SWBuf classExtras = "";
+
 				if (type.size()) {
 					classExtras.append(" ").append(type);
 				}
+				if (canonical.size() && !strcmp(canonical,"true")) {
+					classExtras.append(" canonical");
+				} 
 				VerseKey *vkey = SWDYNAMIC_CAST(VerseKey, u->key);
 				if (vkey && !vkey->getVerse()) {
 					if (!vkey->getChapter()) {

Modified: trunk/tests/testsuite/osis_basic.good
===================================================================
--- trunk/tests/testsuite/osis_basic.good	2017-04-27 09:08:02 UTC (rev 3459)
+++ trunk/tests/testsuite/osis_basic.good	2017-05-17 18:10:53 UTC (rev 3460)
@@ -7,7 +7,7 @@
 <div sID="gen12" type="section"/> <title canonical="true" type="psalm">A Psalm of David, when he fled from Absalom his son.</title> <div sID="gen13" type="x-p"/> <lg sID="gen14"/> 
 -------
 Rendered Header:
- <h3 class="title psalm">A Psalm of David, when he fled from Absalom his son.</h3>
+ <h3 class="title psalm canonical">A Psalm of David, when he fled from Absalom his son.</h3>
 
 <br />
  




More information about the sword-cvs mailing list