[sword-cvs] sword/src/modules/filters gbfthml.cpp,1.16,1.17

sword@www.crosswire.org sword@www.crosswire.org
Tue, 25 Feb 2003 19:17:05 -0700


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

Modified Files:
	gbfthml.cpp 
Log Message:
no message

Index: gbfthml.cpp
===================================================================
RCS file: /usr/local/cvsroot/sword/src/modules/filters/gbfthml.cpp,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** gbfthml.cpp	26 Jan 2003 07:49:10 -0000	1.16
--- gbfthml.cpp	26 Feb 2003 02:17:03 -0000	1.17
***************
*** 26,32 ****
  
  
! char GBFThML::ProcessText(char *text, int maxlen)
! {
! 	char *to, *from, token[2048];
  	int tokpos = 0;
  	bool intoken 	= false;
--- 26,32 ----
  
  
! char GBFThML::processText(SWBuf &text, const SWKey *key, const SWModule *module) {
! 	const char *from;
! 	char token[2048];
  	int tokpos = 0;
  	bool intoken 	= false;
***************
*** 34,46 ****
  	const char *tok;
  
! 	len = strlen(text) + 1;						// shift string to right of buffer
! 	if (len < maxlen) {
! 		memmove(&text[maxlen - len], text, len);
! 		from = &text[maxlen - len];
! 	}
! 	else	from = text;							// -------------------------------
  
! 	for (to = text; *from; from++)
! 	{
  		if (*from == '<') {
  			intoken = true;
--- 34,41 ----
  	const char *tok;
  
! 	SWBuf orig = text;
! 	from = orig.c_str();
  
! 	for (text = ""; *from; from++) {
  		if (*from == '<') {
  			intoken = true;
***************
*** 60,132 ****
  			  case 'G':
  			  case 'H':			    
! 			    *to++ = '<';
! 			    *to++ = 's';
! 			    *to++ = 'y';
! 			    *to++ = 'n';
! 			    *to++ = 'c';
! 			    *to++ = ' ';
! 			    *to++ = 't';
! 			    *to++ = 'y';
! 			    *to++ = 'p';
! 			    *to++ = 'e';
! 			    *to++ = '=';
! 			    *to++ = '"';
! 			    *to++ = 'S';
! 			    *to++ = 't';
! 			    *to++ = 'r';
! 			    *to++ = 'o';
! 			    *to++ = 'n';
! 			    *to++ = 'g';
! 			    *to++ = 's';
! 			    *to++ = '"';
! 			    *to++ = ' ';
! 			    *to++ = 'v';
! 			    *to++ = 'a';
! 			    *to++ = 'l';
! 			    *to++ = 'u';
! 			    *to++ = 'e';
! 			    *to++ = '=';
! 			    *to++ = '"';
  			    for (tok = token + 1; *tok; tok++)
! 			      *to++ = *tok;
! 			    *to++ = '"';
! 			    *to++ = ' ';
! 			    *to++ = '/';
! 			    *to++ = '>';
  			    continue;
  			    
  			  case 'T':               // Tense
! 			    *to++ = '<';
! 			    *to++ = 's';
! 			    *to++ = 'y';
! 			    *to++ = 'n';
! 			    *to++ = 'c';
! 			    *to++ = ' ';
! 			    *to++ = 't';
! 			    *to++ = 'y';
! 			    *to++ = 'p';
! 			    *to++ = 'e';
! 			    *to++ = '=';
! 			    *to++ = '"';
! 			    *to++ = 'M';
! 			    *to++ = 'o';
! 			    *to++ = 'r';
! 			    *to++ = 'p';
! 			    *to++ = 'h';
! 			    *to++ = '"';
! 			    *to++ = ' ';
! 			    *to++ = 'v';
! 			    *to++ = 'a';
! 			    *to++ = 'l';
! 			    *to++ = 'u';
! 			    *to++ = 'e';
! 			    *to++ = '=';
! 			    *to++ = '"';
  			    for (tok = token + 2; *tok; tok++)
! 			      *to++ = *tok;
! 			    *to++ = '"';
! 			    *to++ = ' ';
! 			    *to++ = '/';
! 			    *to++ = '>';
  			    continue;
  				}
--- 55,69 ----
  			  case 'G':
  			  case 'H':			    
! 			    text += "<sync type=\"Strongs\" value=\"";
  			    for (tok = token + 1; *tok; tok++)
! 				 text += *tok;
! 			    text += "\" />";
  			    continue;
  			    
  			  case 'T':               // Tense
! 			    text += "<sync type=\"Morph\" value=\"";
  			    for (tok = token + 2; *tok; tok++)
! 				 text += *tok;
! 			    text += "\" />";
  			    continue;
  				}
***************
*** 136,182 ****
  			    {
  			    case 'X':
! 			      *to++ = '<';
! 			      *to++ = 'a';
! 			      *to++ = ' ';
! 			      *to++ = 'h';
! 			      *to++ = 'r';
! 			      *to++ = 'e';
! 			      *to++ = 'f';
! 			      *to++ = '=';
! 			      *to++ = '\"';
! 			      for (tok = token + 3; *tok; tok++) {
  				if(*tok != '<' && *tok+1 != 'R' && *tok+2 != 'x') {
! 				  *to++ = *tok;
  				}
  				else {
  				  break;
  				}
! 			      }
! 			      *to++ = '\"';
! 			      *to++ = '>';
! 			      continue;
  			    case 'x':
! 			      *to++ = '<';
! 			      *to++ = '/';
! 			      *to++ = 'a';
! 			      *to++ = '>';
! 			      continue;
  			    case 'F':               // footnote begin
! 			      *to++ = '<';
! 			      *to++ = 'n';
! 			      *to++ = 'o';
! 			      *to++ = 't';
! 			      *to++ = 'e';
! 			      *to++ = '>';
! 			      continue;
  			    case 'f':               // footnote end
! 			      *to++ = '<';
! 			      *to++ = '/';
! 			      *to++ = 'n';
! 			      *to++ = 'o';
! 			      *to++ = 't';
! 			      *to++ = 'e';
! 			      *to++ = '>';
! 			      continue;
  			    }
  			  break;
--- 73,96 ----
  			    {
  			    case 'X':
! 				 text += "<a href=\"";
! 				 for (tok = token + 3; *tok; tok++) {
  				if(*tok != '<' && *tok+1 != 'R' && *tok+2 != 'x') {
! 				  text += *tok;
  				}
  				else {
  				  break;
  				}
! 				 }
! 				 text += "\">";
! 				 continue;
  			    case 'x':
! 				 text += "</a>";
! 				 continue;
  			    case 'F':               // footnote begin
! 				 text += "<note>";
! 				 continue;
  			    case 'f':               // footnote end
! 				 text += "</note>";
! 				 continue;
  			    }
  			  break;
***************
*** 185,328 ****
  			    {
  			    case 'N':
! 			      *to++ = '<';
! 			      *to++ = 'f';
! 			      *to++ = 'o';
! 			      *to++ = 'n';
! 			      *to++ = 't';
! 			      *to++ = ' ';
! 			      *to++ = 'f';
! 			      *to++ = 'a';
! 			      *to++ = 'c';
! 			      *to++ = 'e';
! 			      *to++ = '=';
! 			      *to++ = '"';		
! 			      for (tok = token + 2; *tok; tok++)
! 				*to++ = *tok;
! 			      *to++ = '"';
! 			      *to++ = '>';
! 			      continue;
  			    case 'n':
! 			      *to++ = '<';
! 			      *to++ = '/';
! 			      *to++ = 'f';
! 			      *to++ = 'o';
! 			      *to++ = 'n';
! 			      *to++ = 't';
! 			      *to++ = '>';
! 			      continue;
  			    case 'I':		// italic start
! 			      *to++ = '<';
! 			      *to++ = 'i';
! 			      *to++ = '>';
! 			      continue;
  			    case 'i':		// italic end
! 			      *to++ = '<';
! 			      *to++ = '/';
! 			      *to++ = 'i';
! 			      *to++ = '>';
! 			      continue;
  			    case 'B':		// bold start
! 			      *to++ = '<';
! 			      *to++ = 'b';
! 			      *to++ = '>';
! 			      continue;
  			    case 'b':		// bold end
! 			      *to++ = '<';
! 			      *to++ = '/';
! 			      *to++ = 'b';
! 			      *to++ = '>';
! 			      continue;
  
  			    case 'R':		// words of Jesus begin
! 			      *to++ = '<';
! 			      *to++ = 'f';
! 			      *to++ = 'o';
! 			      *to++ = 'n';
! 			      *to++ = 't';
! 			      *to++ = ' ';
! 			      *to++ = 'c';
! 			      *to++ = 'o';
! 			      *to++ = 'l';
! 			      *to++ = 'o';
! 			      *to++ = 'r';
! 			      *to++ = '=';
! 			      *to++ = '\"';
! 			      *to++ = '#';
! 			      *to++ = 'f';
! 			      *to++ = 'f';
! 			      *to++ = '0';
! 			      *to++ = '0';
! 			      *to++ = '0';
! 			      *to++ = '0';
! 			      *to++ = '\"';
! 			      *to++ = '>';
! 			      continue;
  			    case 'r':		// words of Jesus end
! 			      *to++ = '<';
! 			      *to++ = '/';
! 			      *to++ = 'f';
! 			      *to++ = 'o';
! 			      *to++ = 'n';
! 			      *to++ = 't';
! 			      *to++ = '>';
! 			      continue;
  			    case 'U':		// Underline start
! 			      *to++ = '<';
! 			      *to++ = 'u';
! 			      *to++ = '>';
! 			      continue;
  			    case 'u':		// Underline end
! 			      *to++ = '<';
! 			      *to++ = '/';
! 			      *to++ = 'u';
! 			      *to++ = '>';
! 			      continue;
  			    case 'O':		// Old Testament quote begin
! 			      *to++ = '<';
! 			      *to++ = 'c';
! 			      *to++ = 'i';
! 			      *to++ = 't';
! 			      *to++ = 'e';
! 			      *to++ = '>';
! 			      continue;
  			    case 'o':		// Old Testament quote end
! 			      *to++ = '<';
! 			      *to++ = '/';
! 			      *to++ = 'c';
! 			      *to++ = 'i';
! 			      *to++ = 't';
! 			      *to++ = 'e';
! 			      *to++ = '>';
! 			      continue;
  			    case 'S':		// Superscript begin
! 			      *to++ = '<';
! 			      *to++ = 's';
! 			      *to++ = 'u';
! 			      *to++ = 'p';
! 			      *to++ = '>';
! 			      continue;
  			    case 's':		// Superscript end
! 			      *to++ = '<';
! 			      *to++ = '/';
! 			      *to++ = 's';
! 			      *to++ = 'u';
! 			      *to++ = 'p';
! 			      *to++ = '>';
! 			      continue;
  			    case 'V':		// Subscript begin
! 			      *to++ = '<';
! 			      *to++ = 's';
! 			      *to++ = 'u';
! 			      *to++ = 'b';
! 			      *to++ = '>';
! 			      continue;
  			    case 'v':		// Subscript end
! 			      *to++ = '<';
! 			      *to++ = '/';
! 			      *to++ = 's';
! 			      *to++ = 'u';
! 			      *to++ = 'b';
! 			      *to++ = '>';
! 			      continue;
  			    }
  			  break;
--- 99,153 ----
  			    {
  			    case 'N':
! 				 text += "<font face=\"";
! 				 for (tok = token + 2; *tok; tok++)
! 					text += *tok;
! 				text += "\">";
! 				 continue;
  			    case 'n':
! 				 text += "</font>";
! 				 continue;
  			    case 'I':		// italic start
! 				 text += "<i>";
! 				 continue;
  			    case 'i':		// italic end
! 				 text += "</i>";
! 				 continue;
  			    case 'B':		// bold start
! 				 text += "<b>";
! 				 continue;
  			    case 'b':		// bold end
! 				 text += "</b>";
! 				 continue;
  
  			    case 'R':		// words of Jesus begin
! 				 text += "<font color=\"#ff0000\">";
! 				 continue;
  			    case 'r':		// words of Jesus end
! 				 text += "</font>";
! 				 continue;
  			    case 'U':		// Underline start
! 				 text += "<u>";
! 				 continue;
  			    case 'u':		// Underline end
! 				 text += "</u>";
! 				 continue;
  			    case 'O':		// Old Testament quote begin
! 				 text += "<cite>";
! 				 continue;
  			    case 'o':		// Old Testament quote end
! 				 text += "</cite>";
! 				 continue;
  			    case 'S':		// Superscript begin
! 				 text += "<sup>";
! 				 continue;
  			    case 's':		// Superscript end
! 				 text += "</sup>";
! 				 continue;
  			    case 'V':		// Subscript begin
! 				 text += "<sub>";
! 				 continue;
  			    case 'v':		// Subscript end
! 				 text += "</sub>";
! 				 continue;
  			    }
  			  break;
***************
*** 331,335 ****
  				{
  				case 'A':               // ASCII value
! 				  *to++ = (char)atoi(&token[2]);
  				  continue;
  				case 'G':
--- 156,160 ----
  				{
  				case 'A':               // ASCII value
! 				  text += (char)atoi(&token[2]);
  				  continue;
  				case 'G':
***************
*** 337,354 ****
  				  continue;
  				case 'L':               // line break
! 				  *to++ = '<';
! 				  *to++ = 'b';
! 				  *to++ = 'r';
! 				  *to++ = ' ';
! 				  *to++ = '/';
! 				  *to++ = '>';
! 				  *to++ = ' ';
  				  continue;
  				case 'M':               // new paragraph
! 				  *to++ = '<';
! 				  *to++ = 'p';
! 				  *to++ = ' ';
! 				  *to++ = '/';
! 				  *to++ = '>';
  				  continue;
  				case 'T':
--- 162,169 ----
  				  continue;
  				case 'L':               // line break
! 				 text += "<br /> ";
  				  continue;
  				case 'M':               // new paragraph
! 				 text += "<p />";
  				  continue;
  				case 'T':
***************
*** 361,434 ****
  			    {
  			    case 'T':               // Book title begin
! 			      *to++ = '<';
! 			      *to++ = 'b';
! 			      *to++ = 'i';
! 			      *to++ = 'g';
! 			      *to++ = '>';
! 			      continue;
  			    case 't':
! 			      *to++ = '<';
! 			      *to++ = '/';
! 			      *to++ = 'b';
! 			      *to++ = 'i';
! 			      *to++ = 'g';
! 			      *to++ = '>';
! 			      continue;
  			    case 'S':
! 			      *to++ = '<';
! 			      *to++ = 'd';
! 			      *to++ = 'i';
! 			      *to++ = 'v';
! 			      *to++ = ' ';
! 			      *to++ = 'c';
! 			      *to++ = 'l';
! 			      *to++ = 'a';
! 			      *to++ = 's';
! 			      *to++ = 's';
! 			      *to++ = '=';
! 			      *to++ = '\"';
! 			      *to++ = 's';
! 			      *to++ = 'e';
! 			      *to++ = 'c';
! 			      *to++ = 'h';
! 			      *to++ = 'e';
! 			      *to++ = 'a';
! 			      *to++ = 'd';
! 			      *to++ = '\"';
! 			      *to++ = '>';
! 			      continue;
  			    case 's':
! 			      *to++ = '<';
! 			      *to++ = '/';
! 			      *to++ = 'd';
! 			      *to++ = 'i';
! 			      *to++ = 'v';
! 			      *to++ = '>';
! 			      continue;
  			    }
  			  break;
  
  			case 'P':			// special formatting
! 			  switch(token[1])
! 			    {
  			    case 'P':               // Poetry begin
! 			      *to++ = '<';
! 			      *to++ = 'v';
! 			      *to++ = 'e';
! 			      *to++ = 'r';
! 			      *to++ = 's';
! 			      *to++ = 'e';
! 			      *to++ = '>';
! 			      continue;
  			    case 'p':
! 			      *to++ = '<';
! 			      *to++ = '/';
! 			      *to++ = 'v';
! 			      *to++ = 'e';
! 			      *to++ = 'r';
! 			      *to++ = 's';
! 			      *to++ = 'e';
! 			      *to++ = '>';
! 			      continue;
  			    }
  			  break;
--- 176,201 ----
  			    {
  			    case 'T':               // Book title begin
! 				 text += "<big>";
! 				 continue;
  			    case 't':
! 				 text += "</big>";
! 				 continue;
  			    case 'S':
! 				 text += "<div class=\"sechead\">";
! 				 continue;
  			    case 's':
! 				 text += "</div>";
! 				 continue;
  			    }
  			  break;
  
  			case 'P':			// special formatting
! 			  switch(token[1]) {
  			    case 'P':               // Poetry begin
! 				 text += "<verse>";
! 				 continue;
  			    case 'p':
! 				 text += "</verse>";
! 				 continue;
  			    }
  			  break;
***************
*** 441,448 ****
  				token[tokpos+2] = 0;
  		}
! 		else	*to++ = *from;
  	}
- 	*to++ = 0;
- 	*to = 0;
  	return 0;
  }
--- 208,213 ----
  				token[tokpos+2] = 0;
  		}
! 		else	text += *from;
  	}
  	return 0;
  }