summaryrefslogtreecommitdiff
path: root/src/modules/filters/thmlwordjs.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules/filters/thmlwordjs.cpp')
-rw-r--r--src/modules/filters/thmlwordjs.cpp43
1 files changed, 24 insertions, 19 deletions
diff --git a/src/modules/filters/thmlwordjs.cpp b/src/modules/filters/thmlwordjs.cpp
index 12fbeb1..7d80a00 100644
--- a/src/modules/filters/thmlwordjs.cpp
+++ b/src/modules/filters/thmlwordjs.cpp
@@ -1,10 +1,10 @@
/******************************************************************************
*
- * thmlstrongs - SWFilter descendant to hide or show strongs number
- * in a ThML module.
+ * thmlwordjs.cpp - SWFilter descendant to ???
*
+ * $Id: thmlwordjs.cpp 2980 2013-09-14 21:51:47Z scribe $
*
- * Copyright 2009 CrossWire Bible Society (http://www.crosswire.org)
+ * Copyright 2005-2013 CrossWire Bible Society (http://www.crosswire.org)
* CrossWire Bible Society
* P. O. Box 2528
* Tempe, AZ 85280-2528
@@ -29,17 +29,23 @@
#include <utilstr.h>
#include <versekey.h>
+
SWORD_NAMESPACE_START
-const char oName[] = "Word Javascript";
-const char oTip[] = "Toggles Word Javascript data";
+namespace {
+
+ static const char oName[] = "Word Javascript";
+ static const char oTip[] = "Toggles Word Javascript data";
-const SWBuf choices[3] = {"Off", "On", ""};
-const StringList oValues(&choices[0], &choices[2]);
+ static const StringList *oValues() {
+ static const SWBuf choices[3] = {"Off", "On", ""};
+ static const StringList oVals(&choices[0], &choices[2]);
+ return &oVals;
+ }
+}
-ThMLWordJS::ThMLWordJS() : SWOptionFilter(oName, oTip, &oValues) {
- setOptionValue("Off");
+ThMLWordJS::ThMLWordJS() : SWOptionFilter(oName, oTip, oValues()) {
defaultGreekLex = 0;
defaultHebLex = 0;
@@ -58,7 +64,6 @@ char ThMLWordJS::processText(SWBuf &text, const SWKey *key, const SWModule *modu
char token[2112]; // cheese. Fix.
int tokpos = 0;
bool intoken = false;
- bool lastspace = false;
int word = 1;
char val[128];
char *valto;
@@ -69,7 +74,7 @@ char ThMLWordJS::processText(SWBuf &text, const SWKey *key, const SWModule *modu
bool newText = false;
bool needWordOut = false;
AttributeValue *wordAttrs = 0;
- SWBuf modName = (module)?module->Name():"";
+ SWBuf modName = (module)?module->getName():"";
SWBuf wordSrcPrefix = modName;
const SWBuf orig = text;
@@ -160,7 +165,7 @@ char ThMLWordJS::processText(SWBuf &text, const SWKey *key, const SWModule *modu
gh = isdigit(strong[0]) ? 0:strong[0];
if (!gh) {
if (vkey) {
- gh = vkey->Testament() ? 'H' : 'G';
+ gh = vkey->getTestament() ? 'H' : 'G';
}
}
else strong << 1;
@@ -179,7 +184,7 @@ char ThMLWordJS::processText(SWBuf &text, const SWKey *key, const SWModule *modu
if (sLex) {
// we can pass the real lex name in, but we have some
// aliases in the javascript to optimize bandwidth
- lexName = sLex->Name();
+ lexName = sLex->getName();
if (lexName == "StrongsGreek")
lexName = "G";
if (lexName == "StrongsHebrew")
@@ -188,7 +193,7 @@ char ThMLWordJS::processText(SWBuf &text, const SWKey *key, const SWModule *modu
SWBuf wordID;
if (vkey) {
// optimize for bandwidth and use only the verse as the unique entry id
- wordID.appendFormatted("%d", vkey->Verse());
+ wordID.appendFormatted("%d", vkey->getVerse());
}
else {
wordID = key->getText();
@@ -206,10 +211,11 @@ char ThMLWordJS::processText(SWBuf &text, const SWKey *key, const SWModule *modu
+ if (!sMorph) sMorph = 0; // avoid unused warnings for now
/*
if (sMorph) {
SWBuf popMorph = "<a onclick=\"";
- popMorph.appendFormatted("p(\'%s\',\'%s\','%s','');\" >%s</a>", sMorph->Name(), morph.c_str(), wordID.c_str(), morph.c_str());
+ popMorph.appendFormatted("p(\'%s\',\'%s\','%s','');\" >%s</a>", sMorph->getName(), morph.c_str(), wordID.c_str(), morph.c_str());
morph = popMorph;
}
*/
@@ -237,7 +243,6 @@ char ThMLWordJS::processText(SWBuf &text, const SWKey *key, const SWModule *modu
}
else {
text += *from;
- lastspace = (*from == ' ');
}
}
@@ -255,7 +260,7 @@ char ThMLWordJS::processText(SWBuf &text, const SWKey *key, const SWModule *modu
gh = isdigit(strong[0]) ? 0:strong[0];
if (!gh) {
if (vkey) {
- gh = vkey->Testament() ? 'H' : 'G';
+ gh = vkey->getTestament() ? 'H' : 'G';
}
}
else strong << 1;
@@ -271,7 +276,7 @@ char ThMLWordJS::processText(SWBuf &text, const SWKey *key, const SWModule *modu
if (sLex) {
// we can pass the real lex name in, but we have some
// aliases in the javascript to optimize bandwidth
- lexName = sLex->Name();
+ lexName = sLex->getName();
if (lexName == "StrongsGreek")
lexName = "G";
if (lexName == "StrongsHebrew")
@@ -280,7 +285,7 @@ char ThMLWordJS::processText(SWBuf &text, const SWKey *key, const SWModule *modu
SWBuf wordID;
if (vkey) {
// optimize for bandwidth and use only the verse as the unique entry id
- wordID.appendFormatted("%d", vkey->Verse());
+ wordID.appendFormatted("%d", vkey->getVerse());
}
else {
wordID = key->getText();