/*************************************************************************** gbfcgi.cpp - GBF to Diatheke/CGI format ------------------- begin : 2001-11-12 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 "gbfcgi.h" GBFCGI::GBFCGI() { setTokenStart("<"); setTokenEnd(">"); setTokenCaseSensitive(true); addTokenSubstitute("Rf", ")"); 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 addTokenSubstitute("CG", ">"); // ??? addTokenSubstitute("CT", "<"); // ??? addTokenSubstitute("JR", "
"); // right align begin addTokenSubstitute("JC", "
"); // center align begin addTokenSubstitute("JL", "
"); // align end } bool GBFCGI::handleToken(char **buf, const char *token, DualStringMap &userData) { unsigned long i; 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)) { // morph tags pushString(buf, " ()"); } else if (!strncmp(token, "RB", 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, "