[sword-cvs] sword/apps/console/diatheke gbfcgi.cpp,1.3,1.4 gbfcgi.h,1.2,1.3 thmlcgi.cpp,1.4,1.5 thmlcgi.h,1.2,1.3

sword@www.crosswire.org sword@www.crosswire.org
Thu, 27 Feb 2003 01:17:08 -0700


Update of /usr/local/cvsroot/sword/apps/console/diatheke
In directory www:/tmp/cvs-serv30117/apps/console/diatheke

Modified Files:
	gbfcgi.cpp gbfcgi.h thmlcgi.cpp thmlcgi.h 
Log Message:


Index: gbfcgi.cpp
===================================================================
RCS file: /usr/local/cvsroot/sword/apps/console/diatheke/gbfcgi.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** gbfcgi.cpp	1 Oct 2002 19:52:40 -0000	1.3
--- gbfcgi.cpp	27 Feb 2003 08:17:05 -0000	1.4
***************
*** 58,113 ****
  
  
! bool GBFCGI::handleToken(char **buf, const char *token, DualStringMap &userData) {
  	unsigned long i;
  	if (!substituteToken(buf, token)) {
  		if (!strncmp(token, "WG", 2) || !strncmp(token, "WH", 2)) { // strong's numbers
! 			pushString(buf, " <small><em>&lt;<a href=\"!DIATHEKE_URL!");
  			if (token[1] == 'H') {
! 			  pushString(buf, "BDB");
  			}
  			else if (token[1] == 'G') {
! 			  pushString(buf, "Thayer");
  			}
! 			pushString(buf, "=on&verse=");
  			for (i = 2; i < strlen(token); i++)
! 			  *(*buf)++ = token[i];
! 			*(*buf)++ = '\"';
! 			*(*buf)++ = '>';
  			for (i = 2; i < strlen(token); i++)
! 			  *(*buf)++ = token[i];
! 			pushString(buf, "</a>&gt;</em></small>");
  		}
  
  		else if (!strncmp(token, "WTG", 3) || !strncmp(token, "WTH", 3)) { // strong's numbers tense
! 			pushString(buf, " <small><em>&lt;<a href=\"!DIATHEKE_URL!");
  			if (token[2] == 'H') {
! 			  pushString(buf, "BDB");
  			}
  			else if (token[2] == 'G') {
! 			  pushString(buf, "Thayer");
  			}
! 			pushString(buf, "=on&verse=");
  			for (i = 3; i < strlen(token); i++)
! 			  *(*buf)++ = token[i];
! 			*(*buf)++ = '\"';
! 			*(*buf)++ = '>';
  			for (i = 3; i < strlen(token); i++)
! 			  *(*buf)++ = token[i];
! 			pushString(buf, "</a>&gt;</em></small>");
  		}
  
  		else if (!strncmp(token, "WT", 2)) { // morph tags
! 			pushString(buf, " <small><em>(<a href=\"!DIATHEKE_URL!Packard=on&verse=");
  			for (i = 1; i < strlen(token); i++)
! 			  *(*buf)++ = token[i];
! 			*(*buf)++ = '\"';
! 			*(*buf)++ = '>';
  			for (i = 1; i < strlen(token); i++)
! 			  *(*buf)++ = token[i];		
! 			pushString(buf, "</a>)</em></small>");
  		}
  
  		else if (!strncmp(token, "RB", 2)) {
! 			pushString(buf, "<i>");
  			userData["hasFootnotePreTag"] = "true";
  		}
--- 58,110 ----
  
  
! bool GBFCGI::handleToken(SWBuf &buf, const char *token, DualStringMap &userData) {
  	unsigned long i;
  	if (!substituteToken(buf, token)) {
  		if (!strncmp(token, "WG", 2) || !strncmp(token, "WH", 2)) { // strong's numbers
! 			buf += " <small><em>&lt;<a href=\"!DIATHEKE_URL!";
  			if (token[1] == 'H') {
! 			  buf += "BDB";
  			}
  			else if (token[1] == 'G') {
! 			  buf += "Thayer";
  			}
! 			buf += "=on&verse=";
  			for (i = 2; i < strlen(token); i++)
! 			  buf += token[i];
! 			buf += "\">";
  			for (i = 2; i < strlen(token); i++)
! 			  buf += token[i];
! 			buf += "</a>&gt;</em></small>";
  		}
  
  		else if (!strncmp(token, "WTG", 3) || !strncmp(token, "WTH", 3)) { // strong's numbers tense
! 			buf += " <small><em>&lt;<a href=\"!DIATHEKE_URL!";
  			if (token[2] == 'H') {
! 			  buf += "BDB";
  			}
  			else if (token[2] == 'G') {
! 			  buf += "Thayer";
  			}
! 			buf += "=on&verse=";
  			for (i = 3; i < strlen(token); i++)
! 			  buf += token[i];
! 			buf += "\">";
  			for (i = 3; i < strlen(token); i++)
! 			  buf += token[i];
! 			buf += "</a>&gt;</em></small>";
  		}
  
  		else if (!strncmp(token, "WT", 2)) { // morph tags
! 			buf += " <small><em>(<a href=\"!DIATHEKE_URL!Packard=on&verse=";
  			for (i = 1; i < strlen(token); i++)
! 			  buf += token[i];
! 			buf += "\">";
  			for (i = 1; i < strlen(token); i++)
! 			  buf += token[i];		
! 			buf += "</a>)</em></small>";
  		}
  
  		else if (!strncmp(token, "RB", 2)) {
! 			buf += "<i>";
  			userData["hasFootnotePreTag"] = "true";
  		}
***************
*** 116,134 ****
  			if(userData["hasFootnotePreTag"] == "true") {
  				userData["hasFootnotePreTag"] = "false";
! 				pushString(buf, "</i> ");
  			}
! 			pushString(buf, "<font color=\"#800000\"><small> (");
  		}
  
  		else if (!strncmp(token, "FN", 2)) {
! 			pushString(buf, "<font face=\"");
  			for (i = 2; i < strlen(token); i++)		       
! 			  *(*buf)++ = token[i];
! 			*(*buf)++ = '\"';
! 			*(*buf)++ = '>';
  		}
  
  		else if (!strncmp(token, "CA", 2)) {	// ASCII value
! 			*(*buf)++ = (char)atoi(&token[2]);
  		}
  		
--- 113,130 ----
  			if(userData["hasFootnotePreTag"] == "true") {
  				userData["hasFootnotePreTag"] = "false";
! 				buf += "</i> ";
  			}
! 			buf += "<font color=\"#800000\"><small> (";
  		}
  
  		else if (!strncmp(token, "FN", 2)) {
! 			buf += "<font face=\"";
  			for (i = 2; i < strlen(token); i++)		       
! 			  buf += token[i];
! 			buf += "\">";
  		}
  
  		else if (!strncmp(token, "CA", 2)) {	// ASCII value
! 			buf += (char)atoi(&token[2]);
  		}
  		

Index: gbfcgi.h
===================================================================
RCS file: /usr/local/cvsroot/sword/apps/console/diatheke/gbfcgi.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** gbfcgi.h	1 Oct 2002 19:52:40 -0000	1.2
--- gbfcgi.h	27 Feb 2003 08:17:05 -0000	1.3
***************
*** 19,23 ****
  
  #include <swbasicfilter.h>
! 
  #include <defs.h>
  
--- 19,23 ----
  
  #include <swbasicfilter.h>
! #include <swbuf.h>
  #include <defs.h>
  
***************
*** 28,32 ****
  class SWDLLEXPORT GBFCGI : public SWBasicFilter {
  protected:
! 	virtual bool handleToken(char **buf, const char *token, DualStringMap &userData);
  public:
    GBFCGI ();
--- 28,32 ----
  class SWDLLEXPORT GBFCGI : public SWBasicFilter {
  protected:
! 	virtual bool handleToken(SWBuf &buf, const char *token, DualStringMap &userData);
  public:
    GBFCGI ();

Index: thmlcgi.cpp
===================================================================
RCS file: /usr/local/cvsroot/sword/apps/console/diatheke/thmlcgi.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** thmlcgi.cpp	1 Oct 2002 19:52:40 -0000	1.4
--- thmlcgi.cpp	27 Feb 2003 08:17:05 -0000	1.5
***************
*** 32,41 ****
  
  
! bool ThMLCGI::handleToken(char **buf, const char *token, DualStringMap &userData) {
  	unsigned long i;
  	if (!substituteToken(buf, token)) {
  	// manually process if it wasn't a simple substitution
  		if (!strncmp(token, "sync ", 5)) {
! 			pushString(buf, "<a href=\"!DIATHEKE_URL!");
  			char* pbuf;
  			char typ[32]; typ[0] = 0;
--- 32,41 ----
  
  
! bool ThMLCGI::handleToken(SWBuf &buf, const char *token, DualStringMap &userData) {
  	unsigned long i;
  	if (!substituteToken(buf, token)) {
  	// manually process if it wasn't a simple substitution
  		if (!strncmp(token, "sync ", 5)) {
! 			buf += "<a href=\"!DIATHEKE_URL!";
  			char* pbuf;
  			char typ[32]; typ[0] = 0;
***************
*** 66,78 ****
                          }
  			if (*cls && *val) {
! 			        pushString(buf, "%s=on&verse=%s", cls, val);
  			}
  			else if (*typ && *val) {
  			  if (!strnicmp(typ, "Strongs", 7)) {
  			    if (*val == 'G') {
! 			      pushString(buf, "Thayer=on&verse=%s", val + 1);
  			    }
  			    else if (*val == 'H') {
! 			      pushString(buf, "BDB=on&verse=%s", val + 1);
  			    }
  			  }
--- 66,78 ----
                          }
  			if (*cls && *val) {
! 			        buf.appendFormatted("%s=on&verse=%s", cls, val);
  			}
  			else if (*typ && *val) {
  			  if (!strnicmp(typ, "Strongs", 7)) {
  			    if (*val == 'G') {
! 			      buf.appendFormatted("Thayer=on&verse=%s", val + 1);
  			    }
  			    else if (*val == 'H') {
! 			      buf.appendFormatted("BDB=on&verse=%s", val + 1);
  			    }
  			  }
***************
*** 80,127 ****
  			  else if (!strnicmp(typ, "Morph", 5)) {
  			    if (*val == 'G') {
! 			      pushString(buf, "Thayer=on&verse=%s", val + 1);
  			    }
  			    else if (*val == 'H') {
! 			      pushString(buf, "BDB=on&verse=%s", val + 1);
  			    }
  			    else {
! 			      pushString(buf, "Packard=on&verse=%s", val);
  			    }
  			  }
  			  else {
! 			    pushString(buf, "%s=on&verse=%s", typ, val);
  			  }
  			}
! 			*(*buf)++ = '\"';
! 			*(*buf)++ = '>';
  			
  			if (*val) {
! 			        pushString(buf, val);
  			}
! 			pushString(buf, "</a>");
  		}
  
  		else if (!strncmp(token, "scripRef p", 10) || !strncmp(token, "scripRef v", 10)) {
          		userData["inscriptRef"] = "true";
! 			pushString(buf, "<a href=\"!DIATHEKE_URL!");
  			for (i = 9; i < strlen(token); i++) {
  			  if (!strncmp(token+i, "version=\"", 9)) {
  			    i += 9;
  			    for (;token[i] != '\"'; i++)
! 			      *(*buf)++ = token[i];
! 			    pushString(buf, "=on&");
  			  }
  			  if (!strncmp(token+i, "passage=\"", 9)) {
  			    i += 9;
! 			    pushString(buf, "verse=");
  			    for (;token[i] != '\"'; i++) {
! 			      if (token[i] == ' ') *(*buf)++ = '+';
! 			      else *(*buf)++ = token[i];
  			    }
! 			    *(*buf)++ = '&';
  			  }
  			}
! 			*(*buf)++ = '\"';
! 			*(*buf)++ = '>';
  		} 
  
--- 80,125 ----
  			  else if (!strnicmp(typ, "Morph", 5)) {
  			    if (*val == 'G') {
! 			      buf.appendFormatted("Thayer=on&verse=%s", val + 1);
  			    }
  			    else if (*val == 'H') {
! 			      buf.appendFormatted("BDB=on&verse=%s", val + 1);
  			    }
  			    else {
! 			      buf.appendFormatted("Packard=on&verse=%s", val);
  			    }
  			  }
  			  else {
! 			    buf.appendFormatted("%s=on&verse=%s", typ, val);
  			  }
  			}
! 			buf += "\">";
  			
  			if (*val) {
! 			        buf += val;
  			}
! 			buf += "</a>";
  		}
  
  		else if (!strncmp(token, "scripRef p", 10) || !strncmp(token, "scripRef v", 10)) {
          		userData["inscriptRef"] = "true";
! 			buf += "<a href=\"!DIATHEKE_URL!";
  			for (i = 9; i < strlen(token); i++) {
  			  if (!strncmp(token+i, "version=\"", 9)) {
  			    i += 9;
  			    for (;token[i] != '\"'; i++)
! 			      buf += token[i];
! 			    buf += "=on&";
  			  }
  			  if (!strncmp(token+i, "passage=\"", 9)) {
  			    i += 9;
! 			    buf += "verse=";
  			    for (;token[i] != '\"'; i++) {
! 			      if (token[i] == ' ') buf += '+';
! 			      else buf += token[i];
  			    }
! 			    buf += '&';
  			  }
  			}
! 			buf += "\">";
  		} 
  
***************
*** 137,158 ****
  			if (userData["inscriptRef"] == "true") { // like  "<scripRef passage="John 3:16">John 3:16</scripRef>"
  				userData["inscriptRef"] = "false";
! 				pushString(buf, "</a>");
  			}
  			
  			else { // like "<scripRef>John 3:16</scripRef>"
! 				pushString(buf, "<a href=\"!DIATHEKE_URL!verse=");
  
  				char* vref = (char*)userData["lastTextNode"].c_str();
  				while (*vref) {
! 				  if (*vref == ' ') *(*buf)++ = '+';
! 				  else *(*buf)++ = *vref;
  				  vref++;
  				}
! 				*(*buf)++ = '\"';
! 				*(*buf)++ = '>';
! 				pushString(buf, userData["lastTextNode"].c_str());
  				// let's let text resume to output again
  				userData["suspendTextPassThru"] = "false";	
! 				pushString(buf, "</a>");
  			}
  		}
--- 135,155 ----
  			if (userData["inscriptRef"] == "true") { // like  "<scripRef passage="John 3:16">John 3:16</scripRef>"
  				userData["inscriptRef"] = "false";
! 				buf += "</a>";
  			}
  			
  			else { // like "<scripRef>John 3:16</scripRef>"
! 				buf += "<a href=\"!DIATHEKE_URL!verse=";
  
  				char* vref = (char*)userData["lastTextNode"].c_str();
  				while (*vref) {
! 				  if (*vref == ' ') buf += '+';
! 				  else buf += *vref;
  				  vref++;
  				}
! 				buf += "\">";
! 				buf += userData["lastTextNode"].c_str();
  				// let's let text resume to output again
  				userData["suspendTextPassThru"] = "false";	
! 				buf += "</a>";
  			}
  		}
***************
*** 160,172 ****
  		else if (!strncmp(token, "div class=\"sechead\"", 19)) {
  		        userData["SecHead"] = "true";
! 			pushString(buf, "<br /><b><i>");
  		}
  		else if (!strncmp(token, "div class=\"title\"", 19)) {
  		        userData["SecHead"] = "true";
! 			pushString(buf, "<br /><b><i>");
  		}
  		else if (!strncmp(token, "/div", 4)) {
  		        if (userData["SecHead"] == "true") {
! 			        pushString(buf, "</i></b><br />");
  				userData["SecHead"] = "false";
  			}
--- 157,169 ----
  		else if (!strncmp(token, "div class=\"sechead\"", 19)) {
  		        userData["SecHead"] = "true";
! 			buf += "<br /><b><i>";
  		}
  		else if (!strncmp(token, "div class=\"title\"", 19)) {
  		        userData["SecHead"] = "true";
! 			buf += "<br /><b><i>";
  		}
  		else if (!strncmp(token, "/div", 4)) {
  		        if (userData["SecHead"] == "true") {
! 			        buf += "</i></b><br />";
  				userData["SecHead"] = "false";
  			}
***************
*** 174,185 ****
  
                  else if(!strncmp(token, "note", 4)) {
!                         pushString(buf, " <small><font color=\"#008000\">{");
                  }                
  
  		else {
! 			*(*buf)++ = '<';
  			for (i = 0; i < strlen(token); i++)
! 				*(*buf)++ = token[i];
! 				*(*buf)++ = '>';
  			//return false;  // we still didn't handle token
  		}
--- 171,182 ----
  
                  else if(!strncmp(token, "note", 4)) {
!                         buf += " <small><font color=\"#008000\">{";
                  }                
  
  		else {
! 			buf += '<';
  			for (i = 0; i < strlen(token); i++)
! 				buf += token[i];
! 				buf += '>';
  			//return false;  // we still didn't handle token
  		}

Index: thmlcgi.h
===================================================================
RCS file: /usr/local/cvsroot/sword/apps/console/diatheke/thmlcgi.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** thmlcgi.h	1 Oct 2002 19:52:40 -0000	1.2
--- thmlcgi.h	27 Feb 2003 08:17:05 -0000	1.3
***************
*** 28,32 ****
  class SWDLLEXPORT ThMLCGI : public SWBasicFilter {
  protected:
! 	virtual bool handleToken(char **buf, const char *token, DualStringMap &userData);
  public:
  	ThMLCGI();
--- 28,32 ----
  class SWDLLEXPORT ThMLCGI : public SWBasicFilter {
  protected:
! 	virtual bool handleToken(SWBuf &buf, const char *token, DualStringMap &userData);
  public:
  	ThMLCGI();