From 148bd343f3e7e32d141f66b5b5c9b98b2975b0b3 Mon Sep 17 00:00:00 2001 From: "Roberto C. Sanchez" Date: Sat, 29 Mar 2014 10:53:52 -0400 Subject: Imported Upstream version 1.5.8 --- src/modules/filters/osisheadings.cpp | 118 ----------------------------------- 1 file changed, 118 deletions(-) delete mode 100644 src/modules/filters/osisheadings.cpp (limited to 'src/modules/filters/osisheadings.cpp') diff --git a/src/modules/filters/osisheadings.cpp b/src/modules/filters/osisheadings.cpp deleted file mode 100644 index 8ec9ce3..0000000 --- a/src/modules/filters/osisheadings.cpp +++ /dev/null @@ -1,118 +0,0 @@ -/****************************************************************************** - * - *osisheadings - SWFilter descendant to hide or show headings - * in an OSIS module. - */ - - -#include -#include -#include -#include -#ifndef __GNUC__ -#else -#include -#endif - -SWORD_NAMESPACE_START - -const char oName[] = "Headings"; -const char oTip[] = "Toggles Headings On and Off if they exist"; - -const SWBuf choices[3] = {"On", "Off", ""}; -const StringList oValues(&choices[0], &choices[2]); - -OSISHeadings::OSISHeadings() : SWOptionFilter(oName, oTip, &oValues) { - setOptionValue("Off"); -} - - -OSISHeadings::~OSISHeadings() { -} - - -char OSISHeadings::processText(SWBuf &text, const SWKey *key, const SWModule *module) { - SWBuf token; - bool intoken = false; - bool hide = false; - bool preverse = false; - SWBuf header; - int headerNum = 0; - int pvHeaderNum = 0; - char buf[254]; - - SWBuf orig = text; - const char *from = orig.c_str(); - - for (text = ""; *from; from++) { - if (*from == '<') { - intoken = true; - token = ""; - continue; - } - if (*from == '>') { // process tokens - intoken = false; - - XMLTag tag(token); - if (!stricmp(tag.getName(), "title")) { - if ((tag.getAttribute("subtype")) && (!stricmp(tag.getAttribute("subtype"), "x-preverse"))) { - hide = true; - preverse = true; - header = ""; - continue; - } - if (!tag.isEndTag()) { - hide = true; - header = ""; - if (option) { // we want the tag in the text - text += '<'; - text.append(token); - text += '>'; - } - continue; - } - if (hide && tag.isEndTag()) { - - if (module->isProcessEntryAttributes() && option) { - if (preverse) { - sprintf(buf, "%i", pvHeaderNum++); - module->getEntryAttributes()["Heading"]["Preverse"][buf] = header; - } - else { - sprintf(buf, "%i", headerNum++); - module->getEntryAttributes()["Heading"]["Interverse"][buf] = header; - if (option) { // we want the tag in the text - text.append(header); - } - } - } - hide = false; - if ((!option) || (preverse)) { // we don't want the tag in the text anymore - preverse = false; - continue; - } - preverse = false; - } - } - - // if not a heading token, keep token in text - if (!hide) { - text += '<'; - text.append(token); - text += '>'; - } - continue; - } - if (intoken) { //copy token - token += *from; - } - else if (!hide) { //copy text which is not inside a token - text += *from; - } - else header += *from; - } - return 0; -} - -SWORD_NAMESPACE_END - -- cgit v1.2.3