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/gbfthml.cpp | |
parent | 8c8aa6b07e595cfac56838b5964ab3e96051f1b2 (diff) |
Imported Upstream version 1.5.8
Diffstat (limited to 'src/modules/filters/gbfthml.cpp')
-rw-r--r-- | src/modules/filters/gbfthml.cpp | 216 |
1 files changed, 0 insertions, 216 deletions
diff --git a/src/modules/filters/gbfthml.cpp b/src/modules/filters/gbfthml.cpp deleted file mode 100644 index 03b8d8a..0000000 --- a/src/modules/filters/gbfthml.cpp +++ /dev/null @@ -1,216 +0,0 @@ -/*************************************************************************** - gbfthml.cpp - GBF to ThML filter - ------------------- - begin : 1999-10-27 - copyright : 2001 by CrossWire Bible Society - ***************************************************************************/ - -/*************************************************************************** - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - ***************************************************************************/ - -#include <stdlib.h> -#include <gbfthml.h> - -SWORD_NAMESPACE_START - -GBFThML::GBFThML() -{ -} - - -char GBFThML::processText(SWBuf &text, const SWKey *key, const SWModule *module) { - const char *from; - char token[2048]; - int tokpos = 0; - bool intoken = false; - int len; - const char *tok; - - SWBuf orig = text; - from = orig.c_str(); - - for (text = ""; *from; from++) { - if (*from == '<') { - intoken = true; - tokpos = 0; - token[0] = 0; - token[1] = 0; - token[2] = 0; - continue; - } - if (*from == '>') - { - intoken = false; - // process desired tokens - switch (*token) { - case 'W': // Strongs - switch(token[1]) { - case 'G': - case 'H': - text += "<sync type=\"Strongs\" value=\""; - for (tok = token + 1; *tok; tok++) - text += *tok; - text += "\" />"; - continue; - - case 'T': // Tense - text += "<sync type=\"Morph\" value=\""; - for (tok = token + 2; *tok; tok++) - text += *tok; - text += "\" />"; - continue; - } - break; - case 'R': - switch(token[1]) - { - case 'X': - text += "<a href=\""; - for (tok = token + 3; *tok; tok++) { - if(*tok != '<' && *tok+1 != 'R' && *tok+2 != 'x') { - text += *tok; - } - else { - break; - } - } - text += "\">"; - continue; - case 'x': - text += "</a>"; - continue; - case 'F': // footnote begin - text += "<note>"; - continue; - case 'f': // footnote end - text += "</note>"; - continue; - } - break; - case 'F': // font tags - switch(token[1]) - { - case 'N': - text += "<font face=\""; - for (tok = token + 2; *tok; tok++) - text += *tok; - text += "\">"; - continue; - case 'n': - text += "</font>"; - continue; - case 'I': // italic start - text += "<i>"; - continue; - case 'i': // italic end - text += "</i>"; - continue; - case 'B': // bold start - text += "<b>"; - continue; - case 'b': // bold end - text += "</b>"; - continue; - - case 'R': // words of Jesus begin - text += "<font color=\"#ff0000\">"; - continue; - case 'r': // words of Jesus end - text += "</font>"; - continue; - case 'U': // Underline start - text += "<u>"; - continue; - case 'u': // Underline end - text += "</u>"; - continue; - case 'O': // Old Testament quote begin - text += "<cite>"; - continue; - case 'o': // Old Testament quote end - text += "</cite>"; - continue; - case 'S': // Superscript begin - text += "<sup>"; - continue; - case 's': // Superscript end - text += "</sup>"; - continue; - case 'V': // Subscript begin - text += "<sub>"; - continue; - case 'v': // Subscript end - text += "</sub>"; - continue; - } - break; - case 'C': // special character tags - switch(token[1]) - { - case 'A': // ASCII value - text += (char)atoi(&token[2]); - continue; - case 'G': - //*to++ = ' '; - continue; - case 'L': // line break - text += "<br /> "; - continue; - case 'M': // new paragraph - text += "<p />"; - continue; - case 'T': - //*to++ = ' '; - continue; - } - break; - case 'T': // title formatting - switch(token[1]) - { - case 'T': // Book title begin - text += "<big>"; - continue; - case 't': - text += "</big>"; - continue; - case 'S': - text += "<div class=\"sechead\">"; - continue; - case 's': - text += "</div>"; - continue; - } - break; - - case 'P': // special formatting - switch(token[1]) { - case 'P': // Poetry begin - text += "<verse>"; - continue; - case 'p': - text += "</verse>"; - continue; - } - break; - } - continue; - } - if (intoken) { - if (tokpos < 2045) - token[tokpos++] = *from; - token[tokpos+2] = 0; - } - else text += *from; - } - return 0; -} - - - -SWORD_NAMESPACE_END |