[sword-cvs] sword/src/modules/filters thmlhtmlhref.cpp,1.23,1.24 thmlhtml.cpp,1.23,1.24

sword@www.crosswire.org sword@www.crosswire.org
Thu, 20 Feb 2003 20:29:03 -0700


Update of /usr/local/cvsroot/sword/src/modules/filters
In directory www:/tmp/cvs-serv2484

Modified Files:
	thmlhtmlhref.cpp thmlhtml.cpp 
Log Message:
filter updates

Index: thmlhtmlhref.cpp
===================================================================
RCS file: /usr/local/cvsroot/sword/src/modules/filters/thmlhtmlhref.cpp,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -d -r1.23 -r1.24
*** thmlhtmlhref.cpp	10 Jan 2003 20:15:14 -0000	1.23
--- thmlhtmlhref.cpp	21 Feb 2003 03:29:01 -0000	1.24
***************
*** 136,140 ****
  
  
! bool ThMLHTMLHREF::handleToken(char **buf, const char *token, DualStringMap &userData) {
  	const char *tok;
  	if (!substituteToken(buf, token)) {
--- 136,140 ----
  
  
! bool ThMLHTMLHREF::handleToken(SWBuf &buf, const char *token, DualStringMap &userData) {
  	const char *tok;
  	if (!substituteToken(buf, token)) {
***************
*** 142,153 ****
  		if (!strncmp(token, "sync ", 5)) {
  			if(strstr(token,"type=\"morph\"")){
! 				pushString(buf, "<small><em> (<a href=\"");
  			}				
  			else 
! 				pushString(buf, "<small><em> &lt;<a href=\"");
  			for (tok = token + 5; *(tok+1); tok++)
  				if(*tok != '\"')
! 					*(*buf)++ = *tok;
! 			pushString(buf, "\">");
  				
                          //scan for value and add it to the buffer
--- 142,153 ----
  		if (!strncmp(token, "sync ", 5)) {
  			if(strstr(token,"type=\"morph\"")){
! 				buf += "<small><em> (<a href=\"";
  			}				
  			else 
! 				buf += "<small><em> &lt;<a href=\"";
  			for (tok = token + 5; *(tok+1); tok++)
  				if(*tok != '\"')
! 					buf += *tok;
! 			buf += "\">";
  				
                          //scan for value and add it to the buffer
***************
*** 159,185 ****
  						tok += 8;
  					for (;*tok != '\"'; tok++)
! 						*(*buf)++ = *tok;
  					break;
  				}
  			}
  			if(strstr(token,"type=\"morph\"")) 
! 				pushString(buf, "</a>) </em></small>");
  			else 				
! 				pushString(buf, "</a>&gt; </em></small>");
  		}
  		
  		else if (!strncmp(token, "scripture ", 10)) {
  			userData["inscriptRef"] = "true";
! 			pushString(buf, "<i>");
  		} 
  
  		else if (!strncmp(token, "scripRef p", 10) || !strncmp(token, "scripRef v", 10)) {
  			userData["inscriptRef"] = "true";
! 			pushString(buf, "<a href=\"");
  			for (const char *tok = token + 9; *(tok+1); tok++)				
  				if(*tok != '\"') 			
! 					*(*buf)++ = *tok;
! 			*(*buf)++ = '\"';
! 			*(*buf)++ = '>';
  		} 
  
--- 159,185 ----
  						tok += 8;
  					for (;*tok != '\"'; tok++)
! 						buf += *tok;
  					break;
  				}
  			}
  			if(strstr(token,"type=\"morph\"")) 
! 				buf += "</a>) </em></small>";
  			else 				
! 				buf += "</a>&gt; </em></small>";
  		}
  		
  		else if (!strncmp(token, "scripture ", 10)) {
  			userData["inscriptRef"] = "true";
! 			buf += "<i>";
  		} 
  
  		else if (!strncmp(token, "scripRef p", 10) || !strncmp(token, "scripRef v", 10)) {
  			userData["inscriptRef"] = "true";
! 			buf += "<a href=\"";
  			for (const char *tok = token + 9; *(tok+1); tok++)				
  				if(*tok != '\"') 			
! 					buf += *tok;
! 			buf += '\"';
! 			buf += '>';
  		} 
  
***************
*** 195,211 ****
  			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=\"passage=");
  				//char *strbuf = (char *)userData["lastTextNode"].c_str();
! 				pushString(buf, userData["lastTextNode"].c_str());
! 				*(*buf)++ = '\"';
! 				*(*buf)++ = '>';
! 				pushString(buf, userData["lastTextNode"].c_str());
  				// let's let text resume to output again
  				userData["suspendTextPassThru"] = "false";	
! 				pushString(buf, "</a>");
  			}
  		}
--- 195,211 ----
  			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=\"passage=");
  				//char *strbuf = (char *)userData["lastTextNode"].c_str();
! 				buf += userData["lastTextNode"].c_str();
! 				buf += '\"';
! 				buf += '>';
! 				buf += userData["lastTextNode"].c_str();
  				// let's let text resume to output again
  				userData["suspendTextPassThru"] = "false";	
! 				buf += "</a>";
  			}
  		}
***************
*** 213,225 ****
  		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";
  			}
--- 213,225 ----
  		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";
  			}
***************
*** 227,231 ****
  /*
  		else if (!strncmp(token, "sync type=\"Strongs\" value=\"T", 28)) {
! 			pushString(buf, "<a href=\"");
  			for (tok = token + 5; *(tok+1); tok++)				
  				if(*tok != '\"') 			
--- 227,231 ----
  /*
  		else if (!strncmp(token, "sync type=\"Strongs\" value=\"T", 28)) {
! 			buf +="<a href=\"");
  			for (tok = token + 5; *(tok+1); tok++)				
  				if(*tok != '\"') 			
***************
*** 236,240 ****
  				if(*tok != '\"') 			
  					*(*buf)++ = *tok;		
! 			pushString(buf, "</a>");
  		}
  */
--- 236,240 ----
  				if(*tok != '\"') 			
  					*(*buf)++ = *tok;		
! 			buf +="</a>");
  		}
  */
***************
*** 244,276 ****
  				return false;
  
! 			*(*buf)++ = '<';
  			for (const char *c = token; *c; c++) {
  				if (c == src) {
  					for (;((*c) && (*c != '"')); c++)
! 						*(*buf)++ = *c;
  
  					if (!*c) { c--; continue; }
  
! 					*(*buf)++ = '"';
  					if (*(c+1) == '/') {
! 						pushString(buf, "file:");
! 						pushString(buf, module->getConfigEntry("AbsoluteDataPath"));
! 						if (*((*buf)-1) == '/')
  							c++;		// skip '/'
  					}
  					continue;
  				}
! 				*(*buf)++ = *c;
  			}
! 			*(*buf)++ = '>';
  		}
  		else if (!strncmp(token, "note", 4)) {
! 			pushString(buf, " <small><font color=\"#800000\">(");
  		}                
  		else {
! 			*(*buf)++ = '<';
  			for (const char *tok = token; *tok; tok++)
! 				*(*buf)++ = *tok;
! 			*(*buf)++ = '>';
  			//return false;  // we still didn't handle token
  		}
--- 244,276 ----
  				return false;
  
! 			buf += '<';
  			for (const char *c = token; *c; c++) {
  				if (c == src) {
  					for (;((*c) && (*c != '"')); c++)
! 						buf += *c;
  
  					if (!*c) { c--; continue; }
  
! 					buf += '"';
  					if (*(c+1) == '/') {
! 						buf += "file:";
! 						buf += module->getConfigEntry("AbsoluteDataPath");
! 						if (buf[buf.length()-2] == '/')
  							c++;		// skip '/'
  					}
  					continue;
  				}
! 				buf += *c;
  			}
! 			buf += '>';
  		}
  		else if (!strncmp(token, "note", 4)) {
! 			buf += " <small><font color=\"#800000\">(";
  		}                
  		else {
! 			buf += '<';
  			for (const char *tok = token; *tok; tok++)
! 				buf += *tok;
! 			buf += '>';
  			//return false;  // we still didn't handle token
  		}

Index: thmlhtml.cpp
===================================================================
RCS file: /usr/local/cvsroot/sword/src/modules/filters/thmlhtml.cpp,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -d -r1.23 -r1.24
*** thmlhtml.cpp	1 Oct 2002 19:52:40 -0000	1.23
--- thmlhtml.cpp	21 Feb 2003 03:29:01 -0000	1.24
***************
*** 136,176 ****
  
  
! bool ThMLHTML::handleToken(char **buf, const char *token, DualStringMap &userData) {
  	if (!substituteToken(buf, token)) {
  	// manually process if it wasn't a simple substitution
  		if (!strncmp(token, "sync type=\"Strongs\" value=\"", 27)) {
                          if (token[27] == 'H' || token[27] == 'G' || token[27] == 'A') {
!         			pushString(buf, "<small><em>");
  	        		for (const char *tok = token + 5; *tok; tok++)
  		        		if(*tok != '\"')
! 			        		*(*buf)++ = *tok;
!         			pushString(buf, "</em></small>");
                          }
                          else if (token[27] == 'T') {
!         			pushString(buf, "<small><i>");
          			for (unsigned int i = 29; token[i] != '\"'; i++)
!         				*(*buf)++ = token[i];
!         			pushString(buf, "</i></small>");
                          }
  		}
  		else if (!strncmp(token, "sync type=\"morph\" value=\"", 25)) {
! 			pushString(buf, "<small><em>");
  			for (unsigned int i = 25; token[i] != '\"'; i++)
! 				*(*buf)++ = token[i];
! 			pushString(buf, "</em></small>");
  		}
  		else if (!strncmp(token, "sync type=\"lemma\" value=\"", 25)) {
! 			pushString(buf, "<small><em>(");
  			for (unsigned int i = 25; token[i] != '\"'; i++)
! 				*(*buf)++ = token[i];
! 			pushString(buf, ")</em></small>");
  		}
  		else if (!strncmp(token, "scripRef", 8)) {
! 			pushString(buf, "<a href=\"");
  			for (const char *tok = token + 9; *tok; tok++)
  				if(*tok != '\"')
! 					*(*buf)++ = *tok;
! 			*(*buf)++ = '\"';
! 			*(*buf)++ = '>';
  		}
  		else if (!strncmp(token, "img ", 4)) {
--- 136,176 ----
  
  
! bool ThMLHTML::handleToken(SWBuf &buf, const char *token, DualStringMap &userData) {
  	if (!substituteToken(buf, token)) {
  	// manually process if it wasn't a simple substitution
  		if (!strncmp(token, "sync type=\"Strongs\" value=\"", 27)) {
                          if (token[27] == 'H' || token[27] == 'G' || token[27] == 'A') {
!         			buf += "<small><em>";
  	        		for (const char *tok = token + 5; *tok; tok++)
  		        		if(*tok != '\"')
! 			        		buf += *tok;
!         			buf += "</em></small>";
                          }
                          else if (token[27] == 'T') {
!         			buf += "<small><i>";
          			for (unsigned int i = 29; token[i] != '\"'; i++)
!         				buf += token[i];
!         			buf += "</i></small>";
                          }
  		}
  		else if (!strncmp(token, "sync type=\"morph\" value=\"", 25)) {
! 			buf += "<small><em>";
  			for (unsigned int i = 25; token[i] != '\"'; i++)
! 				buf += token[i];
! 			buf += "</em></small>";
  		}
  		else if (!strncmp(token, "sync type=\"lemma\" value=\"", 25)) {
! 			buf += "<small><em>(";
  			for (unsigned int i = 25; token[i] != '\"'; i++)
! 				buf += token[i];
! 			buf += ")</em></small>";
  		}
  		else if (!strncmp(token, "scripRef", 8)) {
! 			buf += "<a href=\"";
  			for (const char *tok = token + 9; *tok; tok++)
  				if(*tok != '\"')
! 					buf += *tok;
! 			buf += '\"';
! 			buf += '>';
  		}
  		else if (!strncmp(token, "img ", 4)) {
***************
*** 179,205 ****
  				return false;
  
! 			*(*buf)++ = '<';
  			for (const char *c = token; *c; c++) {
  				if (c == src) {
  					for (;((*c) && (*c != '"')); c++)
! 						*(*buf)++ = *c;
  
  					if (!*c) { c--; continue; }
  
! 					*(*buf)++ = '"';
  					if (*(c+1) == '/') {
! 						pushString(buf, "file:");
! 						pushString(buf, module->getConfigEntry("AbsoluteDataPath"));
! 						if (*((*buf)-1) == '/')
  							c++;		// skip '/'
  					}
  					continue;
  				}
! 				*(*buf)++ = *c;
  			}
! 			*(*buf)++ = '>';
  		}
  		else if(!strncmp(token, "note", 4)) {
!                         pushString(buf, " <font color=\"#800000\"><small>(");
                  }
  
--- 179,205 ----
  				return false;
  
! 			buf += '<';
  			for (const char *c = token; *c; c++) {
  				if (c == src) {
  					for (;((*c) && (*c != '"')); c++)
! 						buf += *c;
  
  					if (!*c) { c--; continue; }
  
! 					buf += '"';
  					if (*(c+1) == '/') {
! 						buf += "file:";
! 						buf += module->getConfigEntry("AbsoluteDataPath");
! 						if (buf[buf.length()-2] == '/')
  							c++;		// skip '/'
  					}
  					continue;
  				}
! 				buf += *c;
  			}
! 			buf += '>';
  		}
  		else if(!strncmp(token, "note", 4)) {
!                         buf += " <font color=\"#800000\"><small>(";
                  }