[sword-svn] r3290 - in branches/sword-1-7-x: . src/modules/filters

greg.hellings at crosswire.org greg.hellings at crosswire.org
Wed Dec 3 21:54:52 MST 2014


Author: greg.hellings
Date: 2014-12-03 21:54:52 -0700 (Wed, 03 Dec 2014)
New Revision: 3290

Modified:
   branches/sword-1-7-x/
   branches/sword-1-7-x/ChangeLog
   branches/sword-1-7-x/src/modules/filters/osisplain.cpp
   branches/sword-1-7-x/src/modules/filters/osisxhtml.cpp
Log:
Merging r3289



Property changes on: branches/sword-1-7-x
___________________________________________________________________
Modified: svn:mergeinfo
   - /trunk:2989-2991,2997,3001-3004,3006,3010-3020,3026-3039,3045-3046,3048,3056,3058-3062,3067,3073,3077-3081,3085-3086,3091,3094,3097-3099,3102,3104,3106-3108,3110,3115,3118-3121,3126-3127,3131-3135,3140,3144,3151,3153-3155,3190-3192,3198-3199,3202-3203,3225,3230,3232-3234,3236,3238-3239,3242,3244,3256-3257,3272-3274
   + /trunk:2989-2991,2997,3001-3004,3006,3010-3020,3026-3039,3045-3046,3048,3056,3058-3062,3067,3073,3077-3081,3085-3086,3091,3094,3097-3099,3102,3104,3106-3108,3110,3115,3118-3121,3126-3127,3131-3135,3140,3144,3151,3153-3155,3190-3192,3198-3199,3202-3203,3225,3230,3232-3234,3236,3238-3239,3242,3244,3256-3257,3272-3274,3289

Modified: branches/sword-1-7-x/ChangeLog
===================================================================
--- branches/sword-1-7-x/ChangeLog	2014-12-03 22:47:15 UTC (rev 3289)
+++ branches/sword-1-7-x/ChangeLog	2014-12-04 04:54:52 UTC (rev 3290)
@@ -1,5 +1,9 @@
 API ChangeLog
 
+03-Dec-2014	Karl Kleinpaste <charcoal at users.sf.net>
+	Corrected anomalous OSIS highlighting output w/GHellings' patches in
+		src/modules/filters/osis{plain,xhtml}.cpp
+
 27-Apr-2014	Troy A. Griffitts <scribe at crosswire.org>
 	Added C# bindings contributed by Daniel Hughes <trampster at gmail.com>
 

Modified: branches/sword-1-7-x/src/modules/filters/osisplain.cpp
===================================================================
--- branches/sword-1-7-x/src/modules/filters/osisplain.cpp	2014-12-03 22:47:15 UTC (rev 3289)
+++ branches/sword-1-7-x/src/modules/filters/osisplain.cpp	2014-12-04 04:54:52 UTC (rev 3290)
@@ -235,7 +235,7 @@
 			}
 			else {
 				buf.append("*");
-				buf.append(u->lastTextNode);
+				buf.append(u->lastSuspendSegment);
 				buf.append("*");
 			}
 			u->suspendTextPassThru = false;

Modified: branches/sword-1-7-x/src/modules/filters/osisxhtml.cpp
===================================================================
--- branches/sword-1-7-x/src/modules/filters/osisxhtml.cpp	2014-12-03 22:47:15 UTC (rev 3289)
+++ branches/sword-1-7-x/src/modules/filters/osisxhtml.cpp	2014-12-04 04:54:52 UTC (rev 3290)
@@ -43,7 +43,11 @@
 		.indent2         { margin-left: 20px }\n\
 		.indent3         { margin-left: 30px }\n\
 		.indent4         { margin-left: 40px }\n\
+		.small-caps { font-variant: small-caps; }\n\
+		.selah { text-align: right; width: 50%; margin: 0; padding: 0; }\n\
+		.acrostic { text-align: center; }\n\
 	";
+	// Acrostic for things like the titles in Psalm 119
 	return header;
 }
 
@@ -397,14 +401,28 @@
 		else if (!strcmp(tag.getName(), "l")) {
 			// start line marker
 			if (tag.getAttribute("sID") || (!tag.isEndTag() && !tag.isEmpty())) {
-				// nested lines plus if the line itself has an x-indent type attribute value
-				outText(SWBuf("<span class=\"line indent").appendFormatted("%d\">", u->lineStack->size() + (SWBuf("x-indent") == tag.getAttribute("type")?1:0)).c_str(), buf, u);
+				SWBuf type = tag.getAttribute("type");
+				if (type == "selah") {
+					outText("<p class=\"selah\">", buf, u);
+				} else {
+					// nested lines plus if the line itself has an x-indent type attribute value
+					outText(SWBuf("<span class=\"line indent").appendFormatted("%d\">", u->lineStack->size() + (SWBuf("x-indent") == tag.getAttribute("type")?1:0)).c_str(), buf, u);
+				}
 				u->lineStack->push(tag.toString());
 			}
 			// end line marker
 			else if (tag.getAttribute("eID") || tag.isEndTag()) {
-				outText("</span>", buf, u);
-				u->outputNewline(buf);
+				SWBuf type = "";
+				if (!u->lineStack->empty()) {
+					XMLTag startTag(u->lineStack->top());
+					type = startTag.getAttribute("type");
+				}
+				if (type == "selah") {
+					outText("</p>", buf, u);
+				} else {
+					outText("</span>", buf, u);
+					u->outputNewline(buf);
+				}
 				if (u->lineStack->size()) u->lineStack->pop();
 			}
 			// <l/> without eID or sID
@@ -452,31 +470,36 @@
 		// <title>
 		else if (!strcmp(tag.getName(), "title")) {
 			if ((!tag.isEndTag()) && (!tag.isEmpty())) {
+				SWBuf type = tag.getAttribute("type");
+				bool keepType = false;
+				if (type.size()) {
+					keepType = true;
+				}
 				VerseKey *vkey = SWDYNAMIC_CAST(VerseKey, u->key);
 				if (vkey && !vkey->getVerse()) {
 					if (!vkey->getChapter()) {
 						if (!vkey->getBook()) {
 							if (!vkey->getTestament()) {
-								buf += "<h1 class=\"moduleHeader\">";
+								buf += SWBuf("<h1 class=\"moduleHeader ") + (keepType ? type : "") + "\">";
 								tag.setAttribute("pushed", "h1");
 							}
 							else {
-								buf += "<h1 class=\"testamentHeader\">";
+								buf += SWBuf("<h1 class=\"testamentHeader ") + (keepType ? type : "") + "\">";
 								tag.setAttribute("pushed", "h1");
 							}
 						}
 						else {
-							buf += "<h1 class=\"bookHeader\">";
+							buf += SWBuf("<h1 class=\"bookHeader ") + (keepType ? type : "") + "\">";
 							tag.setAttribute("pushed", "h1");
 						}
 					}
 					else {
-						buf += "<h2 class=\"chapterHeader\">";
+						buf += SWBuf("<h2 class=\"chapterHeader ") + (keepType ? type : "") + "\">";
 						tag.setAttribute("pushed", "h2");
 					}
 				}
 				else {
-					buf += "<h3>";
+					buf += SWBuf("<h3 class=\"") + (keepType ? type : "") + "\">";
 					tag.setAttribute("pushed", "h3");
 				}
 				u->titleStack->push(tag.toString());
@@ -573,8 +596,10 @@
 				else if (type == "sub") {
 					outText("<sub>", buf, u);
 				}
-				else {	// all other types
+				else if (type == "i" || type == "italic") {
 					outText("<i>", buf, u);
+				} else {	// all other types
+					outText(SWBuf("<span class=\"") + type + SWBuf("\">"), buf, u);
 				}
 				u->hiStack->push(tag.toString());
 			}
@@ -598,8 +623,10 @@
 				else if (type == "sub") {
 					outText("</sub>", buf, u);
 				}
-				else {
+				else if (type == "i" || type == "italic") {
 					outText("</i>", buf, u);
+				} else {
+					outText("</span>", buf, u);
 				}
 			}
 		}




More information about the sword-cvs mailing list