[sword-devel] filter patches

Terry Biggs sword-devel@crosswire.org
25 Oct 2002 22:41:32 -0400


--=-2RH5UliDcWuJTPyu+/wR
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

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.

-- 
Terry

And from Jesus Christ, who is the faithful witness, and the first
begotten of the dead, and the prince of the kings of the earth. Unto him
that loved us, and washed us from our sins in his own blood. -
Revelation 1:5

<http://gnomesword.sf.net>

--=-2RH5UliDcWuJTPyu+/wR
Content-Disposition: attachment; filename=gbfhtmlhref.patch
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; name=gbfhtmlhref.patch; charset=ISO-8859-1

--- /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 @@
=20
 	if (!substituteToken(buf, token)) {
 		if (!strncmp(token, "WG", 2) || !strncmp(token, "WH", 2)) { // strong's =
numbers
-			pushString(buf, " <small><em>&lt;<a href=3D\"#");
+			pushString(buf, " <small><em>&lt;<a href=3D\"type=3DStrongs value=3D");
 			for (tok =3D token+1; *tok; tok++)
 				//if(token[i] !=3D '\"')
 					*(*buf)++ =3D *tok;
@@ -77,7 +77,7 @@
 		}
=20
 		else if (!strncmp(token, "WTG", 3) || !strncmp(token, "WTH", 3)) { // st=
rong's numbers tense
-			pushString(buf, " <small><em>(<A HREF=3D\"#");
+			pushString(buf, " <small><em>&lt;<a href=3D\"type=3DStrongs value=3D");
 			for (tok =3D token + 2; *tok; tok++)
 				if(*tok !=3D '\"')
 					*(*buf)++ =3D *tok;
@@ -90,7 +90,7 @@
 		}
=20
 		else if (!strncmp(token, "WT", 2) && strncmp(token, "WTH", 3) && strncmp=
(token, "WTG", 3)) { // morph tags
-			pushString(buf, " <small><em>(<a href=3D\"M");
+			pushString(buf, " <small><em>(<a href=3D\"type=3Dmorph class=3Dnone val=
ue=3D");
 			for (tok =3D token + 2; *tok; tok++)
 				if(*tok !=3D '\"')
 					*(*buf)++ =3D *tok;

--=-2RH5UliDcWuJTPyu+/wR
Content-Disposition: attachment; filename=thmlhtmlhref.patch
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; name=thmlhtmlhref.patch; charset=ISO-8859-1

--- /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=3D\"");
+			if(strstr(token,"type=3D\"morph\"")){
+				pushString(buf, "<small><em> (<a href=3D\"");
+			}			=09
+			else=20
+				pushString(buf, "<small><em> &lt;<a href=3D\"");
 			for (tok =3D token + 5; *(tok+1); tok++)
 				if(*tok !=3D '\"')
 					*(*buf)++ =3D *tok;
-			*(*buf)++ =3D '\"';
-			*(*buf)++ =3D '>';
-
+			pushString(buf, "\">");
+			=09
                         //scan for value and add it to the buffer
 			for (tok =3D token + 5; *tok; tok++) {
 				if (!strncmp(tok, "value=3D\"", 7)) {
-					tok +=3D 7;
+					if(strstr(token,"type=3D\"morph\""))=20
+						tok +=3D 7;
+					else
+						tok +=3D 8;
 					for (;*tok !=3D '\"'; tok++)
 						*(*buf)++ =3D *tok;
 					break;
 				}
 			}
-			pushString(buf, "</a>");
+			if(strstr(token,"type=3D\"morph\""))=20
+				pushString(buf, "</a>) </em></small>");
+			else 			=09
+				pushString(buf, "</a>&gt; </em></small>");
 		}
 	=09
 		else if (!strncmp(token, "scripture ", 10)) {
@@ -215,7 +224,7 @@
 				userData["SecHead"] =3D "false";
 			}
 		}
-
+/*
 		else if (!strncmp(token, "sync type=3D\"Strongs\" value=3D\"T", 28)) {
 			pushString(buf, "<a href=3D\"");
 			for (tok =3D token + 5; *(tok+1); tok++)			=09
@@ -228,6 +237,7 @@
 					*(*buf)++ =3D *tok;	=09
 			pushString(buf, "</a>");
 		}
+*/
 		else if (!strncmp(token, "img ", 4)) {
 			const char *src =3D strstr(token, "src");
 			if (!src)		// assert we have a src attribute

--=-2RH5UliDcWuJTPyu+/wR--