Though the necessary processing for ThML lemma options handling has been
in place, the needed code actually to provide the information in the
display stream has been just plain AWOL.  This patch is a fix for that.

The first part of the patch, to thmllemma.cpp, was because I realized
that the existing thmllemma.cpp was a close derivative of thmlmorph.cpp,
but that they had diverged somewhat.  So that part simply re-derives
lemma support from morph support.  The second (smaller) part of the
patch is what actually gets lemma information into the HTML stream.

--karl

Index: src/modules/filters/thmllemma.cpp
===================================================================
--- src/modules/filters/thmllemma.cpp	(revision 2125)
+++ src/modules/filters/thmllemma.cpp	(working copy)
@@ -7,7 +7,6 @@
 
 #include <stdlib.h>
 #include <thmllemma.h>
-#include <utilstr.h>
 
 SWORD_NAMESPACE_START
 
@@ -36,28 +35,28 @@
 		for (text = ""; *from; from++) {
 			if (*from == '<') {
 				intoken = true;
-                                token = "";
+				token = "";
 				continue;
 			}
-			else if (*from == '>') {	// process tokens
+			if (*from == '>') {	// process tokens
 				intoken = false;
-				if (!strnicmp(token.c_str(), "sync", 4) && strstr(token.c_str(), " type=\"lemma\"")) {	// Lemma
-					continue;
+				if (!strncmp(token.c_str(), "sync ", 5) && strstr(token.c_str(), "type=\"lemma\"")) {	// Lemma
+				  continue;
 				}
-				
+
 				// if not a lemma token, keep token in text
 				text += '<';
-                                text.append(token);
-      				text += '>';
+				text += token;
+				text += '>';
 				continue;
 			}
-			
+
 			if (intoken) {
 				token += *from;
 			}
-			else {
-                                text += *from;
-       			}
+			else	{
+				text += *from;
+			}
 		}
 	}
 	return 0;
Index: src/modules/filters/thmlhtmlhref.cpp
===================================================================
--- src/modules/filters/thmlhtmlhref.cpp	(revision 2125)
+++ src/modules/filters/thmlhtmlhref.cpp	(working copy)
@@ -171,6 +171,13 @@
 						URL::encode(value.c_str()).c_str(),
 						value.c_str());
 			}
+			else if (tag.getAttribute("type") && !strcmp(tag.getAttribute("type"), "lemma")) { //&gt;
+				if(value.length())
+					// empty "type=" is deliberate.
+					buf.appendFormatted("<small><em>&lt;<a href=\"passagestudy.jsp?action=showStrongs&type=&value=%s\">%s</a>&gt;</em></small>", 
+						URL::encode(value.c_str()).c_str(),
+						value.c_str());
+			}
 			else if (tag.getAttribute("type") && !strcmp(tag.getAttribute("type"), "Strongs")) {
 				char ch = *value;
 				value<<1;
_______________________________________________
sword-devel mailing list: [email protected]
http://www.crosswire.org/mailman/listinfo/sword-devel
Instructions to unsubscribe/change your settings at above page

Reply via email to