[sword-svn] r1810 - trunk/src/modules/filters
scribe at crosswire.org
scribe at crosswire.org
Sat May 14 22:14:18 MST 2005
Author: scribe
Date: 2005-05-14 22:14:18 -0700 (Sat, 14 May 2005)
New Revision: 1810
Modified:
trunk/src/modules/filters/osiswordjs.cpp
trunk/src/modules/filters/swoptfilter.cpp
trunk/src/modules/filters/thmlwordjs.cpp
Log:
updates for interlinear support
Modified: trunk/src/modules/filters/osiswordjs.cpp
===================================================================
--- trunk/src/modules/filters/osiswordjs.cpp 2005-05-13 02:44:28 UTC (rev 1809)
+++ trunk/src/modules/filters/osiswordjs.cpp 2005-05-15 05:14:18 UTC (rev 1810)
@@ -10,6 +10,7 @@
#include <swmodule.h>
#include <ctype.h>
#include <utilxml.h>
+#include <utilstr.h>
#include <versekey.h>
SWORD_NAMESPACE_START
@@ -46,8 +47,10 @@
char val[128];
char *valto;
char *ch;
+ SWBuf modName = (module)?module->Name():"";
+ // add TR to w src in KJV then remove this next line
+ SWBuf wordSrcPrefix = (modName == "KJV")?"TR":modName;
-
const SWBuf orig = text;
const char * from = orig.c_str();
@@ -67,6 +70,9 @@
SWBuf lemma = wtag.getAttribute("lemma");
SWBuf strong = "";
SWBuf morph = wtag.getAttribute("morph");
+ SWBuf src = wtag.getAttribute("src");
+ if (!src.length()) src.appendFormatted("%d", wordNum);
+ src.insert(0, wordSrcPrefix);
char gh = 0;
VerseKey *vkey = 0;
if (key) {
@@ -101,21 +107,25 @@
lexName = "H";
}
}
- SWBuf layer;
+ SWBuf wordID;
if (vkey) {
// optimize for bandwidth and use only the verse as the unique entry id
- layer.appendFormatted("%d", vkey->Verse());
+ wordID.appendFormatted("%d", vkey->Verse());
}
else {
- layer = key->getText();
+ wordID = key->getText();
}
- for (int i = 0; i < layer.size(); i++) {
- if ((!isdigit(layer[i])) && (!isalpha(layer[i]))) {
- layer[i] = '_';
+ for (int i = 0; i < wordID.size(); i++) {
+ if ((!isdigit(wordID[i])) && (!isalpha(wordID[i]))) {
+ wordID[i] = '_';
}
}
+ wordID.appendFormatted("_%s", src.c_str());
// 'p' = 'fillpop' to save bandwidth
- text.appendFormatted("<span onclick=\"p(\'%s\', \'%s\', '%s_%d', '%s');\" >", lexName.c_str(), strong.c_str(), layer.c_str(),wordNum,morph.c_str());
+ const char *m = strchr(morph.c_str(), ':');
+ if (m) m++;
+ else m = morph.c_str();
+ text.appendFormatted("<span onclick=\"p(\'%s\', \'%s\', '%s', '%s');\" >", lexName.c_str(), strong.c_str(), wordID.c_str(), m);
wordNum++;
Modified: trunk/src/modules/filters/swoptfilter.cpp
===================================================================
--- trunk/src/modules/filters/swoptfilter.cpp 2005-05-13 02:44:28 UTC (rev 1809)
+++ trunk/src/modules/filters/swoptfilter.cpp 2005-05-15 05:14:18 UTC (rev 1810)
@@ -25,7 +25,7 @@
for (StringList::const_iterator loop = optValues->begin(); loop != optValues->end(); loop++) {
if (!stricmp(loop->c_str(), ival)) {
optionValue = *loop;
- option = (!stricmp(ival, "On")); // convenience for boolean filters
+ option = (!strnicmp(ival, "On", 2)); // convenience for boolean filters
break;
}
}
Modified: trunk/src/modules/filters/thmlwordjs.cpp
===================================================================
--- trunk/src/modules/filters/thmlwordjs.cpp 2005-05-13 02:44:28 UTC (rev 1809)
+++ trunk/src/modules/filters/thmlwordjs.cpp 2005-05-15 05:14:18 UTC (rev 1810)
@@ -54,8 +54,9 @@
bool newText = false;
bool needWordOut = false;
AttributeValue *wordAttrs = 0;
+ SWBuf modName = (module)?module->Name():"";
+ SWBuf wordSrcPrefix = modName;
-
const SWBuf orig = text;
const char * from = orig.c_str();
VerseKey *vkey = 0;
@@ -169,19 +170,20 @@
if (lexName == "StrongsHebrew")
lexName = "H";
}
- SWBuf layer;
+ SWBuf wordID;
if (vkey) {
// optimize for bandwidth and use only the verse as the unique entry id
- layer.appendFormatted("%d", vkey->Verse());
+ wordID.appendFormatted("%d", vkey->Verse());
}
else {
- layer = key->getText();
+ wordID = key->getText();
}
- for (int i = 0; i < layer.size(); i++) {
- if ((!isdigit(layer[i])) && (!isalpha(layer[i]))) {
- layer[i] = '_';
+ for (int i = 0; i < wordID.size(); i++) {
+ if ((!isdigit(wordID[i])) && (!isalpha(wordID[i]))) {
+ wordID[i] = '_';
}
}
+ wordID.appendFormatted("_%s%d", wordSrcPrefix.c_str(), atoi(wstr));
if (textSt.size()) {
int textStr = atoi(textSt.c_str());
textStr += lastAppendLen;
@@ -192,15 +194,16 @@
/*
if (sMorph) {
SWBuf popMorph = "<a onclick=\"";
- popMorph.appendFormatted("p(\'%s\',\'%s\','%s_%s','');\" >%s</a>", sMorph->Name(), morph.c_str(), layer.c_str(), wstr, morph.c_str());
+ popMorph.appendFormatted("p(\'%s\',\'%s\','%s','');\" >%s</a>", sMorph->Name(), morph.c_str(), wordID.c_str(), morph.c_str());
morph = popMorph;
}
*/
-
-
// 'p' = 'fillpop' to save bandwidth
- spanStart.appendFormatted("<span onclick=\"p(\'%s\',\'%s\','%s_%s','%s');\" >", lexName.c_str(), strong.c_str(), layer.c_str(), wstr, morph.c_str());
+ const char *m = strchr(morph.c_str(), ':');
+ if (m) m++;
+ else m = morph.c_str();
+ spanStart.appendFormatted("<span onclick=\"p(\'%s\',\'%s\','%s','%s');\" >", lexName.c_str(), strong.c_str(), wordID.c_str(), m);
text.insert(textStr, spanStart);
lastAppendLen = spanStart.length();
}
@@ -259,25 +262,29 @@
if (lexName == "StrongsHebrew")
lexName = "H";
}
- SWBuf layer;
+ SWBuf wordID;
if (vkey) {
// optimize for bandwidth and use only the verse as the unique entry id
- layer.appendFormatted("%d", vkey->Verse());
+ wordID.appendFormatted("%d", vkey->Verse());
}
else {
- layer = key->getText();
+ wordID = key->getText();
}
- for (int i = 0; i < layer.size(); i++) {
- if ((!isdigit(layer[i])) && (!isalpha(layer[i]))) {
- layer[i] = '_';
+ for (int i = 0; i < wordID.size(); i++) {
+ if ((!isdigit(wordID[i])) && (!isalpha(wordID[i]))) {
+ wordID[i] = '_';
}
}
+ wordID.appendFormatted("_%s%d", wordSrcPrefix.c_str(), atoi(wstr));
if (textSt.size()) {
int textStr = atoi(textSt.c_str());
textStr += lastAppendLen;
SWBuf spanStart = "";
// 'p' = 'fillpop' to save bandwidth
- spanStart.appendFormatted("<span onclick=\"p(\'%s\', \'%s\', '%s_%s', '%s');\" >", lexName.c_str(), strong.c_str(), layer.c_str(), wstr, morph.c_str());
+ const char *m = strchr(morph.c_str(), ':');
+ if (m) m++;
+ else m = morph.c_str();
+ spanStart.appendFormatted("<span onclick=\"p(\'%s\',\'%s\','%s','%s');\" >", lexName.c_str(), strong.c_str(), wordID.c_str(), m);
text.insert(textStr, spanStart);
}
}
More information about the sword-cvs
mailing list