diff options
author | Roberto C. Sanchez <roberto@connexer.com> | 2014-05-12 08:21:30 -0400 |
---|---|---|
committer | Roberto C. Sanchez <roberto@connexer.com> | 2014-05-12 08:21:30 -0400 |
commit | 7a00574163029c0c2b649878c95d5acbd083564a (patch) | |
tree | c13cc5736025834df2874ed87ee8598070025ea6 /src/modules/filters/thmlwordjs.cpp | |
parent | b745315323de9f27538edac9453205ca70e6186e (diff) |
Imported Upstream version 1.7.2+dfsg
Diffstat (limited to 'src/modules/filters/thmlwordjs.cpp')
-rw-r--r-- | src/modules/filters/thmlwordjs.cpp | 43 |
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(); |