[sword-svn] r1740 - in trunk: bindings/corba/orbitcpp src/modules/filters

scribe at crosswire.org scribe at crosswire.org
Fri Mar 11 05:31:33 MST 2005


Author: scribe
Date: 2005-03-11 05:31:32 -0700 (Fri, 11 Mar 2005)
New Revision: 1740

Modified:
   trunk/bindings/corba/orbitcpp/testclient.cpp
   trunk/src/modules/filters/osishtmlhref.cpp
   trunk/src/modules/filters/osiswordjs.cpp
   trunk/src/modules/filters/thmlwordjs.cpp
Log:
Fixed to work better with js


Modified: trunk/bindings/corba/orbitcpp/testclient.cpp
===================================================================
--- trunk/bindings/corba/orbitcpp/testclient.cpp	2005-03-08 20:16:17 UTC (rev 1739)
+++ trunk/bindings/corba/orbitcpp/testclient.cpp	2005-03-11 12:31:32 UTC (rev 1740)
@@ -47,9 +47,10 @@
 		mgr->setJavascript(true);
 		mgr->setGlobalOption("Textual Variants", "Secondary Reading");
 		module = mgr->getModuleByName("NASB");
-		for (module->setKeyText("mat.1.1"); !module->error(); module->next()) {
+		for (module->setKeyText("jas.1.1"); !module->error(); module->next()) {
 			std::cout << "KeyText: " << module->getKeyText() << "\n";
 			std::cout << "Text: " << module->getRenderText() << "\n";
+			break;
 		}
 /*
 		swordorb::SearchHitList *searchResults;

Modified: trunk/src/modules/filters/osishtmlhref.cpp
===================================================================
--- trunk/src/modules/filters/osishtmlhref.cpp	2005-03-08 20:16:17 UTC (rev 1739)
+++ trunk/src/modules/filters/osishtmlhref.cpp	2005-03-11 12:31:32 UTC (rev 1740)
@@ -84,12 +84,14 @@
 				if (attrib = tag.getAttribute("xlit")) {
 					val = strchr(attrib, ':');
 					val = (val) ? (val + 1) : attrib;
-					buf.appendFormatted(" %s", val);
+					if (!u->suspendTextPassThru)
+						buf.appendFormatted(" %s", val);
 				}
 				if (attrib = tag.getAttribute("gloss")) {
 					val = strchr(attrib, ':');
 					val = (val) ? (val + 1) : attrib;
-					buf.appendFormatted(" %s", val);
+					if (!u->suspendTextPassThru)
+						buf.appendFormatted(" %s", val);
 				}
 				if (attrib = tag.getAttribute("lemma")) {
 					int count = tag.getAttributePartCount("lemma");
@@ -109,10 +111,13 @@
 							val2++;
 						if ((!strcmp(val2, "3588")) && (lastText.length() < 1))
 							show = false;
-						else buf.appendFormatted(" <small><em>&lt;<a href=\"passagestudy.jsp?action=showStrongs&type=%s&value=%s\">%s</a>&gt;</em></small> ", 
-							(gh.length()) ? gh.c_str() : "", 
-							URL::encode(val2).c_str(), 
-							val2);
+						else {
+							if (!u->suspendTextPassThru)
+								buf.appendFormatted(" <small><em>&lt;<a href=\"passagestudy.jsp?action=showStrongs&type=%s&value=%s\">%s</a>&gt;</em></small> ", 
+										(gh.length()) ? gh.c_str() : "", 
+										URL::encode(val2).c_str(), 
+										val2);
+						}
 						
 					} while (++i < count);
 				}
@@ -131,17 +136,19 @@
 							const char *val2 = val;
 							if ((*val == 'T') && (strchr("GH", val[1])) && (isdigit(val[2])))
 								val2+=2;
-							buf.appendFormatted(" <small><em>(<a href=\"passagestudy.jsp?action=showMorph&type=%s&value=%s\">%s</a>)</em></small> ", 
-								URL::encode(tag.getAttribute("morph")).c_str(),
-								URL::encode(val).c_str(), 
-								val2);
+							if (!u->suspendTextPassThru)
+								buf.appendFormatted(" <small><em>(<a href=\"passagestudy.jsp?action=showMorph&type=%s&value=%s\">%s</a>)</em></small> ", 
+										URL::encode(tag.getAttribute("morph")).c_str(),
+										URL::encode(val).c_str(), 
+										val2);
 						} while (++i < count);
 					}
 				}
 				if (attrib = tag.getAttribute("POS")) {
 					val = strchr(attrib, ':');
 					val = (val) ? (val + 1) : attrib;
-					buf.appendFormatted(" %s", val);
+					if (!u->suspendTextPassThru)
+						buf.appendFormatted(" %s", val);
 				}
 
 				/*if (endTag)
@@ -185,14 +192,17 @@
 		// <p> paragraph tag
 		else if (!strcmp(tag.getName(), "p")) {
 			if ((!tag.isEndTag()) && (!tag.isEmpty())) {	// non-empty start tag
-				buf += "<!P><br />";
+				if (!u->suspendTextPassThru)
+					buf += "<!P><br />";
 			}
 			else if (tag.isEndTag()) {	// end tag
-				buf += "<!/P><br />";
+				if (!u->suspendTextPassThru)
+					buf += "<!/P><br />";
 				userData->supressAdjacentWhitespace = true;
 			}
 			else {					// empty paragraph break marker
-				buf += "<!P><br />";
+				if (!u->suspendTextPassThru)
+					buf += "<!P><br />";
 				userData->supressAdjacentWhitespace = true;
 			}
 		}
@@ -200,39 +210,47 @@
 		// <reference> tag
 		else if (!strcmp(tag.getName(), "reference")) {			
 			if ((!tag.isEndTag()) && (!tag.isEmpty())) {
-				buf += "<a href=\"\">";
+				if (!u->suspendTextPassThru)
+					buf += "<a href=\"\">";
 			}
 			else if (tag.isEndTag()) {
-				buf += "</a>";
+				if (!u->suspendTextPassThru)
+					buf += "</a>";
 			}
 		}
 
 		// <l> poetry, etc
 		else if (!strcmp(tag.getName(), "l")) {
 			if (tag.isEmpty()) {
-				buf += "<br />";
+				if (!u->suspendTextPassThru)
+					buf += "<br />";
 			}
 			else if (tag.isEndTag()) {
-				buf += "<br />";
+				if (!u->suspendTextPassThru)
+					buf += "<br />";
 			}
 			else if (tag.getAttribute("sID")) {	// empty line marker
-				buf += "<br />";
+				if (!u->suspendTextPassThru)
+					buf += "<br />";
 			}
 		}
 
 		// <milestone type="line"/>
 		else if ((!strcmp(tag.getName(), "milestone")) && (tag.getAttribute("type")) && (!strcmp(tag.getAttribute("type"), "line"))) {
-			buf += "<br />";
+			if (!u->suspendTextPassThru)
+				buf += "<br />";
 			userData->supressAdjacentWhitespace = true;
 		}
 
 		// <title>
 		else if (!strcmp(tag.getName(), "title")) {
 			if ((!tag.isEndTag()) && (!tag.isEmpty())) {
-				buf += "<b>";
+				if (!u->suspendTextPassThru)
+					buf += "<b>";
 			}
 			else if (tag.isEndTag()) {
-				buf += "</b><br />";
+				if (!u->suspendTextPassThru)
+					buf += "</b><br />";
 			}
 		}
 
@@ -241,21 +259,25 @@
 			SWBuf type = tag.getAttribute("type");
 			if ((!tag.isEndTag()) && (!tag.isEmpty())) {
 				if (type == "b" || type == "x-b") {
-					buf += "<b> ";
+					if (!u->suspendTextPassThru)
+						buf += "<b> ";
 					u->inBold = true;
 				}
 				else {	// all other types
-					buf += "<i> ";
+					if (!u->suspendTextPassThru)
+						buf += "<i> ";
 					u->inBold = false;
 				}
 			}
 			else if (tag.isEndTag()) {
 				if(u->inBold) {
-					buf += "</b>";
+					if (!u->suspendTextPassThru)
+						buf += "</b>";
 					u->inBold = false;
 				}
 				else
-				      buf += "</i>";
+					if (!u->suspendTextPassThru)
+						 buf += "</i>";
 			}
 			else {	// empty hi marker
 				// what to do?  is this even valid?
@@ -274,22 +296,26 @@
 
 				//alternate " and '
 				if (u->osisQToTick)
-					buf += (level % 2) ? '\"' : '\'';
+					if (!u->suspendTextPassThru)
+						buf += (level % 2) ? '\"' : '\'';
 				
 				if (who == "Jesus") {
-					buf += "<font color=\"red\"> ";
+					if (!u->suspendTextPassThru)
+						buf += "<font color=\"red\"> ";
 				}
 			}
 			else if (tag.isEndTag()) {
 				//alternate " and '
 				if (u->osisQToTick)
-					buf += (level % 2) ? '\"' : '\'';
+					if (!u->suspendTextPassThru)
+						buf += (level % 2) ? '\"' : '\'';
 				//buf += "</font>";
 			}
 			else {	// empty quote marker
 				//alternate " and '
 				if (u->osisQToTick)
-					buf += (level % 2) ? '\"' : '\'';
+					if (!u->suspendTextPassThru)
+						buf += (level % 2) ? '\"' : '\'';
 			}
 		}
 
@@ -301,10 +327,12 @@
 
 // just do all transChange tags this way for now
 //				if (type == "supplied")
-					buf += "<i>";
+					if (!u->suspendTextPassThru)
+						buf += "<i>";
 			}
 			else if (tag.isEndTag()) {
-				buf += "</i>";
+				if (!u->suspendTextPassThru)
+					buf += "</i>";
 			}
 			else {	// empty transChange marker?
 			}
@@ -322,9 +350,11 @@
 			strcat(filepath, src);
 
 // we do this because BibleCS looks for this EXACT format for an image tag
-			buf+="<image src=\"";
-			buf+=filepath;
-			buf+="\" />";
+				if (!u->suspendTextPassThru) {
+					buf+="<image src=\"";
+					buf+=filepath;
+					buf+="\" />";
+				}
 /*
 			char imgc;
 			for (c = filepath + strlen(filepath); c > filepath && *c != '.'; c--);

Modified: trunk/src/modules/filters/osiswordjs.cpp
===================================================================
--- trunk/src/modules/filters/osiswordjs.cpp	2005-03-08 20:16:17 UTC (rev 1739)
+++ trunk/src/modules/filters/osiswordjs.cpp	2005-03-11 12:31:32 UTC (rev 1740)
@@ -76,6 +76,7 @@
 					if (key) {
 						vkey = SWDYNAMIC_CAST(VerseKey, key);
 					}
+					SWBuf lexName = "";
 					if ((!strncmp(lemma.c_str(), "x-Strongs:", 10)) || (!strncmp(lemma.c_str(), "strong:", 7))) {
 						char *num = strstr(lemma.c_str(), ":");
 						num++;
@@ -95,18 +96,30 @@
 							sLex = defaultHebLex;
 						}
 						if (sLex) {
-							sLex->setKey(strong.c_str());
-							strong = sLex->RenderText();
+							// we can pass the real lex name in, but we have some
+							// aliases in the javascript to optimize bandwidth
+							lexName = sLex->Name();
+							if (lexName == "StrongsGreek")
+								lexName = "G";
+							if (lexName == "StrongsHebrew")
+								lexName = "H";
 						}
 					}
-					SWBuf layer = (vkey)?vkey->getOSISRef():key->getText();
+					SWBuf layer;
+					if (vkey) {
+						// optimize for bandwidth and use only the verse as the unique entry id
+						layer.appendFormatted("%d", vkey->Verse());
+					}
+					else {
+						layer = key->getText();
+					}
 					for (int i = 0; i < layer.size(); i++) {
 						if ((!isdigit(layer[i])) && (!isalpha(layer[i]))) {
 							layer[i] = '_';
 						}
 					}
-					text.appendFormatted("<div id=\"%s_%d\" class=\"word-layer\">%s<br/>%s</div>", layer.c_str(), wordNum, strong.c_str(), morph.c_str());
-					text.appendFormatted("<span onclick=\"wordInfo(\'%s_%d\', \'image0002\');\" >", layer.c_str(), wordNum);
+					// 'p' = 'fillpop' to save bandwidth
+					text.appendFormatted("<span onclick=\"p(\'%s\', \'%s\', '%s_%d', '%s');\" >", lexName.c_str(), strong.c_str(), layer.c_str(),wordNum,morph.c_str());
 					wordNum++;
 
 

Modified: trunk/src/modules/filters/thmlwordjs.cpp
===================================================================
--- trunk/src/modules/filters/thmlwordjs.cpp	2005-03-08 20:16:17 UTC (rev 1739)
+++ trunk/src/modules/filters/thmlwordjs.cpp	2005-03-11 12:31:32 UTC (rev 1740)
@@ -159,11 +159,24 @@
 						if (gh == 'H') {
 							sLex = defaultHebLex;
 						}
+						SWBuf lexName = "";
 						if (sLex) {
-							sLex->setKey(strong.c_str());
-							strong = sLex->RenderText();
+							// we can pass the real lex name in, but we have some
+							// aliases in the javascript to optimize bandwidth
+							lexName = sLex->Name();
+							if (lexName == "StrongsGreek")
+								lexName = "G";
+							if (lexName == "StrongsHebrew")
+								lexName = "H";
 						}
-						SWBuf layer = (vkey)?vkey->getOSISRef():key->getText();
+						SWBuf layer;
+						if (vkey) {
+							// optimize for bandwidth and use only the verse as the unique entry id
+							layer.appendFormatted("%d", vkey->Verse());
+						}
+						else {
+							layer = key->getText();
+						}
 						for (int i = 0; i < layer.size(); i++) {
 							if ((!isdigit(layer[i])) && (!isalpha(layer[i]))) {
 								layer[i] = '_';
@@ -173,8 +186,8 @@
 							int textStr = atoi(textSt.c_str());
 							textStr += lastAppendLen;
 							SWBuf spanStart = "";
-							spanStart.appendFormatted("<div id=\"%s_%s\" class=\"word-layer\">%s<br/>%s</div>", layer.c_str(), wstr, strong.c_str(), morph.c_str());
-							spanStart.appendFormatted("<span onclick=\"wordInfo(\'%s_%s\', \'i2\');\" >", layer.c_str(), wstr);
+							// 'p' = 'fillpop' to save bandwidth
+							spanStart.appendFormatted("<span onclick=\"p(\'%s\', \'%s\', '%s_%s', '%s');\" >", lexName.c_str(), strong.c_str(), layer.c_str(), wstr, morph.c_str());
 							text.insert(textStr, spanStart);
 							lastAppendLen = spanStart.length();
 						}
@@ -223,11 +236,24 @@
 			if (gh == 'H') {
 				sLex = defaultHebLex;
 			}
+			SWBuf lexName = "";
 			if (sLex) {
-				sLex->setKey(strong.c_str());
-				strong = sLex->RenderText();
+				// we can pass the real lex name in, but we have some
+				// aliases in the javascript to optimize bandwidth
+				lexName = sLex->Name();
+				if (lexName == "StrongsGreek")
+					lexName = "G";
+				if (lexName == "StrongsHebrew")
+					lexName = "H";
 			}
-			SWBuf layer = (vkey)?vkey->getOSISRef():key->getText();
+			SWBuf layer;
+			if (vkey) {
+				// optimize for bandwidth and use only the verse as the unique entry id
+				layer.appendFormatted("%d", vkey->Verse());
+			}
+			else {
+				layer = key->getText();
+			}
 			for (int i = 0; i < layer.size(); i++) {
 				if ((!isdigit(layer[i])) && (!isalpha(layer[i]))) {
 					layer[i] = '_';
@@ -237,8 +263,8 @@
 				int textStr = atoi(textSt.c_str());
 				textStr += lastAppendLen;
 				SWBuf spanStart = "";
-				spanStart.appendFormatted("<div id=\"%s_%s\" class=\"word-layer\">%s<br/>%s</div>", layer.c_str(), wstr, strong.c_str(), morph.c_str());
-				spanStart.appendFormatted("<span onclick=\"wordInfo(\'%s_%s\', \'i2\');\" >", layer.c_str(), wstr);
+				// 'p' = 'fillpop' to save bandwidth
+				spanStart.appendFormatted("<span onclick=\"p(\'%s\', \'%s\', '%s_%s', '%s');\" >", lexName.c_str(), strong.c_str(), layer.c_str(), wstr, morph.c_str());
 				text.insert(textStr, spanStart);
 			}
 		}



More information about the sword-cvs mailing list