[sword-devel] filter patches

Troy A. Griffitts sword-devel@crosswire.org
Tue, 29 Oct 2002 19:02:37 -0700


Thanks Terry!
	Applied.



Terry Biggs wrote:
> Troy,
> 
> Here are a couple of patches for the gbfhtmlhref and thmlhtmlhref
> filters. They output the same html tags for Strongs numbers so the front
> end only has to handle one set of tags.
> 
> 
> 
> ------------------------------------------------------------------------
> 
> --- /tmp/gedit-1035572643-10895-1	Fri Oct 25 15:04:03 2002
> +++ /tmp/gedit-1035572643-10895-2	Fri Oct 25 15:04:03 2002
> @@ -64,7 +64,7 @@
>  
>  	if (!substituteToken(buf, token)) {
>  		if (!strncmp(token, "WG", 2) || !strncmp(token, "WH", 2)) { // strong's numbers
> -			pushString(buf, " <small><em>&lt;<a href=\"#");
> +			pushString(buf, " <small><em>&lt;<a href=\"type=Strongs value=");
>  			for (tok = token+1; *tok; tok++)
>  				//if(token[i] != '\"')
>  					*(*buf)++ = *tok;
> @@ -77,7 +77,7 @@
>  		}
>  
>  		else if (!strncmp(token, "WTG", 3) || !strncmp(token, "WTH", 3)) { // strong's numbers tense
> -			pushString(buf, " <small><em>(<A HREF=\"#");
> +			pushString(buf, " <small><em>&lt;<a href=\"type=Strongs value=");
>  			for (tok = token + 2; *tok; tok++)
>  				if(*tok != '\"')
>  					*(*buf)++ = *tok;
> @@ -90,7 +90,7 @@
>  		}
>  
>  		else if (!strncmp(token, "WT", 2) && strncmp(token, "WTH", 3) && strncmp(token, "WTG", 3)) { // morph tags
> -			pushString(buf, " <small><em>(<a href=\"M");
> +			pushString(buf, " <small><em>(<a href=\"type=morph class=none value=");
>  			for (tok = token + 2; *tok; tok++)
>  				if(*tok != '\"')
>  					*(*buf)++ = *tok;
> 
> 
> ------------------------------------------------------------------------
> 
> --- /tmp/gedit-1035572740-10895-1	Fri Oct 25 15:05:40 2002
> +++ /tmp/gedit-1035572740-10895-2	Fri Oct 25 15:05:40 2002
> @@ -140,23 +140,32 @@
>  	if (!substituteToken(buf, token)) {
>  	// manually process if it wasn't a simple substitution
>  		if (!strncmp(token, "sync ", 5)) {
> -			pushString(buf, "<a href=\"");
> +			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;
> -			*(*buf)++ = '\"';
> -			*(*buf)++ = '>';
> -
> +			pushString(buf, "\">");
> +				
>                          //scan for value and add it to the buffer
>  			for (tok = token + 5; *tok; tok++) {
>  				if (!strncmp(tok, "value=\"", 7)) {
> -					tok += 7;
> +					if(strstr(token,"type=\"morph\"")) 
> +						tok += 7;
> +					else
> +						tok += 8;
>  					for (;*tok != '\"'; tok++)
>  						*(*buf)++ = *tok;
>  					break;
>  				}
>  			}
> -			pushString(buf, "</a>");
> +			if(strstr(token,"type=\"morph\"")) 
> +				pushString(buf, "</a>) </em></small>");
> +			else 				
> +				pushString(buf, "</a>&gt; </em></small>");
>  		}
>  		
>  		else if (!strncmp(token, "scripture ", 10)) {
> @@ -215,7 +224,7 @@
>  				userData["SecHead"] = "false";
>  			}
>  		}
> -
> +/*
>  		else if (!strncmp(token, "sync type=\"Strongs\" value=\"T", 28)) {
>  			pushString(buf, "<a href=\"");
>  			for (tok = token + 5; *(tok+1); tok++)				
> @@ -228,6 +237,7 @@
>  					*(*buf)++ = *tok;		
>  			pushString(buf, "</a>");
>  		}
> +*/
>  		else if (!strncmp(token, "img ", 4)) {
>  			const char *src = strstr(token, "src");
>  			if (!src)		// assert we have a src attribute