diff options
author | Roberto C. Sanchez <roberto@connexer.com> | 2014-03-29 10:53:52 -0400 |
---|---|---|
committer | Roberto C. Sanchez <roberto@connexer.com> | 2014-03-29 10:53:52 -0400 |
commit | 148bd343f3e7e32d141f66b5b5c9b98b2975b0b3 (patch) | |
tree | 31078963b85110d57310759016e60e8d26ccb1e6 /src/modules/filters/gbfredletterwords.cpp | |
parent | 8c8aa6b07e595cfac56838b5964ab3e96051f1b2 (diff) |
Imported Upstream version 1.5.8
Diffstat (limited to 'src/modules/filters/gbfredletterwords.cpp')
-rw-r--r-- | src/modules/filters/gbfredletterwords.cpp | 98 |
1 files changed, 0 insertions, 98 deletions
diff --git a/src/modules/filters/gbfredletterwords.cpp b/src/modules/filters/gbfredletterwords.cpp deleted file mode 100644 index df7438d..0000000 --- a/src/modules/filters/gbfredletterwords.cpp +++ /dev/null @@ -1,98 +0,0 @@ -/****************************************************************************** - * - * GBFRedLetterWords - SWFilter descendant to toggle red coloring of words of - * Christ in a GBF module. - */ - - -#include <stdlib.h> -#include <gbfredletterwords.h> -#include <swmodule.h> -#ifndef __GNUC__ -#else -#include <unixstr.h> -#endif -#include <ctype.h> - -SWORD_NAMESPACE_START - -const char oName[] = "Words of Christ in Red"; -const char oTip[] = "Toggles Red Coloring for Words of Christ On and Off if they are marked"; - -const SWBuf choices[3] = {"On", "Off", ""}; -const StringList oValues(&choices[0], &choices[2]); - -GBFRedLetterWords::GBFRedLetterWords() : SWOptionFilter(oName, oTip, &oValues) { - setOptionValue("Off"); -} - - -GBFRedLetterWords::~GBFRedLetterWords() { -} - - -char GBFRedLetterWords::processText(SWBuf &text, const SWKey *key, const SWModule *module) { -/** This function removes the red letter words in Bible like the WEB -* The words are marked by <FR> as start and <Fr> as end tag. -*/ - if (!option) { // if we don't want footnotes - char token[4096]; // cheese. Fix. - int tokpos = 0; - bool intoken = false; - int len; - bool hide = false; - - const char *from; - SWBuf orig = text; - from = orig.c_str(); - for (text = ""; *from; from++) { - if (*from == '<') { - intoken = true; - tokpos = 0; -// memset(token, 0, 4096); - token[0] = 0; - token[1] = 0; - token[2] = 0; - continue; - } - if (*from == '>') { // process tokens - intoken = false; - /*switch (*token) { - case 'F': // Font attribute - switch(token[1]) { - case 'R': // Begin red letter words - hide = true; - break; - case 'r': // end red letter words - hide = false; - break; - } - continue; // skip token - }*/ - - //hide the token if either FR or Fr was detected - hide = (token[0] == 'F' && ( (token[1] == 'R') || (token[1] == 'r') )); - - // if not a red letter word token, keep token in text - if (!hide) { - text += '<'; - for (char *tok = token; *tok; tok++) - text += *tok; - text += '>'; - } - continue; - } - if (intoken) { - if (tokpos < 4090) - token[tokpos++] = *from; - token[tokpos+2] = 0; // +2 cuz we init token with 2 extra '0' because of switch statement - } - else { - text += *from; - } - } - } - return 0; -} - -SWORD_NAMESPACE_END |