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

scribe at crosswire.org scribe at crosswire.org
Fri Sep 20 05:18:45 MST 2013


Author: scribe
Date: 2013-09-20 05:18:45 -0700 (Fri, 20 Sep 2013)
New Revision: 2984

Modified:
   trunk/src/modules/filters/osisplain.cpp
   trunk/src/modules/filters/osisxhtml.cpp
   trunk/src/modules/filters/teixhtml.cpp
Log:
Updated modules regarding overline <hi> type per Chris' comments.
Retaining support for currently used modules until the modules can be
updated and this code deprecated.  Never advertise support for "ol".


Modified: trunk/src/modules/filters/osisplain.cpp
===================================================================
--- trunk/src/modules/filters/osisplain.cpp	2013-09-15 16:22:32 UTC (rev 2983)
+++ trunk/src/modules/filters/osisplain.cpp	2013-09-20 12:18:45 UTC (rev 2984)
@@ -207,20 +207,29 @@
 			toupperstr(end);
 		}
 		else if (!strncmp(token, "hi", 2)) {
-				if (strstr(token, "rend=\"ol\"")) {
-					u->hiType = "ol";
+
+				// handle both OSIS 'type' and TEI 'rend' attributes
+				// there is no officially supported OSIS overline attribute,
+				// thus either TEI overline or OSIS x-overline would be best,
+				// but we have used "ol" in the past, as well.  Once a valid
+				// OSIS overline attribute is made available, these should all
+				// eventually be deprecated and never documented that they are supported.
+				if (strstr(token, "rend=\"ol\"") || strstr(token, "rend=\"x-overline\"") || strstr(token, "rend=\"overline\"")
+				   || strstr(token, "type=\"ol\"") || strstr(token, "type=\"x-overline\"") || strstr(token, "type=\"overline\"")) {
+					u->hiType = "overline";
 				}
 				else u->hiType = "";
 				u->suspendTextPassThru = true;
 			}
 		else if (!strncmp(token, "/hi", 3)) {
-			if (u->hiType == "ol") {
+			if (u->hiType == "overline") {
 				const unsigned char *b = (const unsigned char *)u->lastTextNode.c_str();
 				while (*b) {
 					const unsigned char *o = b;
 					if (getUniCharFromUTF8(&b)) {
 						while (o != b) buf.append(*(o++));
-						buf.append("\u0305");
+						buf.append((unsigned char)0xCC);
+						buf.append((unsigned char)0x85);
 					}
 				}
 			}

Modified: trunk/src/modules/filters/osisxhtml.cpp
===================================================================
--- trunk/src/modules/filters/osisxhtml.cpp	2013-09-15 16:22:32 UTC (rev 2983)
+++ trunk/src/modules/filters/osisxhtml.cpp	2013-09-20 12:18:45 UTC (rev 2984)
@@ -549,15 +549,24 @@
 		// <hi> text highlighting
 		else if (!strcmp(tag.getName(), "hi")) {
 			SWBuf type = tag.getAttribute("type");
-			// handle tei rend attribute
+
+			// handle tei rend attribute if type doesn't exist
 			if (!type.length()) type = tag.getAttribute("rend");
+
 			if ((!tag.isEndTag()) && (!tag.isEmpty())) {
 				if (type == "bold" || type == "b" || type == "x-b") {
 					outText("<b>", buf, u);
 				}
-				else if (type == "ol") {
+
+				// there is no officially supported OSIS overline attribute,
+				// thus either TEI overline or OSIS x-overline would be best,
+				// but we have used "ol" in the past, as well.  Once a valid
+				// OSIS overline attribute is made available, these should all
+				// eventually be deprecated and never documented that they are supported.
+				else if (type == "ol"  || type == "overline" || type == "x-overline") {
 					outText("<span style=\"text-decoration:overline\">", buf, u);
 				}
+
 				else if (type == "super") {
 					outText("<span class=\"sup\">", buf, u);
 				}

Modified: trunk/src/modules/filters/teixhtml.cpp
===================================================================
--- trunk/src/modules/filters/teixhtml.cpp	2013-09-15 16:22:32 UTC (rev 2983)
+++ trunk/src/modules/filters/teixhtml.cpp	2013-09-20 12:18:45 UTC (rev 2984)
@@ -95,6 +95,8 @@
 					buf += "<b>";
 				else if (rend == "sup")
 					buf += "<small><sup>";
+				else if (rend == "overline")
+					buf += "<span style=\"text-decoration:overline\">";
 
 			}
 			else if (tag.isEndTag()) {
@@ -107,6 +109,8 @@
 					buf += "</b>";
 				else if (rend == "sup")
 					buf += "</sup></small>";
+				else if (rend == "overline")
+					buf += "</span>";
 			}
 		}
 




More information about the sword-cvs mailing list