From 8d3fc864d094eeadc721f8e93436b37a5fab173e Mon Sep 17 00:00:00 2001 From: "Roberto C. Sanchez" Date: Sat, 29 Mar 2014 10:53:33 -0400 Subject: Imported Upstream version 1.5.3 --- src/modules/filters/gbfhtmlhref.cpp | 148 ++++++++++++++++++++++++++++++++++++ 1 file changed, 148 insertions(+) create mode 100644 src/modules/filters/gbfhtmlhref.cpp (limited to 'src/modules/filters/gbfhtmlhref.cpp') diff --git a/src/modules/filters/gbfhtmlhref.cpp b/src/modules/filters/gbfhtmlhref.cpp new file mode 100644 index 0000000..30b27ba --- /dev/null +++ b/src/modules/filters/gbfhtmlhref.cpp @@ -0,0 +1,148 @@ +/*************************************************************************** + gbfhtmlhref.cpp - GBF to HTML filter with hrefs + for strongs and morph tags + ------------------- + begin : 2001-09-03 + 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 +#include +#include + +GBFHTMLHREF::GBFHTMLHREF() { + setTokenStart("<"); + setTokenEnd(">"); + + setTokenCaseSensitive(true); + + addTokenSubstitute("Rf", ")"); + addTokenSubstitute("Rx", ""); + addTokenSubstitute("FI", ""); // italics begin + addTokenSubstitute("Fi", ""); + addTokenSubstitute("FB", ""); // bold begin + addTokenSubstitute("Fb", ""); + addTokenSubstitute("FR", ""); // words of Jesus begin + addTokenSubstitute("Fr", ""); + addTokenSubstitute("FU", ""); // underline begin + addTokenSubstitute("Fu", ""); + addTokenSubstitute("FO", ""); // Old Testament quote begin + addTokenSubstitute("Fo", ""); + addTokenSubstitute("FS", ""); // Superscript begin// Subscript begin + addTokenSubstitute("Fs", ""); + addTokenSubstitute("FV", ""); // Subscript begin + addTokenSubstitute("Fv", ""); + addTokenSubstitute("TT", ""); // Book title begin + addTokenSubstitute("Tt", ""); + addTokenSubstitute("PP", ""); // poetry begin + addTokenSubstitute("Pp", ""); + addTokenSubstitute("Fn", ""); // font end + addTokenSubstitute("CL", "
"); // new line + addTokenSubstitute("CM", "
"); // paragraph is a non showing comment that can be changed in the front end to

if desired + addTokenSubstitute("CG", ""); // ??? + addTokenSubstitute("CT", ""); // ??? + addTokenSubstitute("JR", "

"); // right align begin + addTokenSubstitute("JC", "
"); // center align begin + addTokenSubstitute("JL", "
"); // align end + +} + + +bool GBFHTMLHREF::handleToken(char **buf, const char *token, DualStringMap &userData) { + const char *tok; + + if (!substituteToken(buf, token)) { + if (!strncmp(token, "WG", 2) || !strncmp(token, "WH", 2)) { // strong's numbers + pushString(buf, " <>"); + } + + else if (!strncmp(token, "WTG", 3) || !strncmp(token, "WTH", 3)) { // strong's numbers tense + pushString(buf, " ()"); + } + + else if (!strncmp(token, "WT", 2) && strncmp(token, "WTH", 3) && strncmp(token, "WTG", 3)) { // morph tags + pushString(buf, " ()"); + } + + else if (!strncmp(token, "RX", 2)) { + pushString(buf, ""); + userData["hasFootnotePreTag"] = "true"; + } + + else if (!strncmp(token, "RF", 2)) { + if(userData["hasFootnotePreTag"] == "true") { + userData["hasFootnotePreTag"] = "false"; + pushString(buf, " "); + } + pushString(buf, " ("); + } + + else if (!strncmp(token, "FN", 2)) { + pushString(buf, "