diff options
Diffstat (limited to 'src/modules/filters/osisstrongs.cpp')
-rw-r--r-- | src/modules/filters/osisstrongs.cpp | 42 |
1 files changed, 37 insertions, 5 deletions
diff --git a/src/modules/filters/osisstrongs.cpp b/src/modules/filters/osisstrongs.cpp index 922f7fd..8c06b07 100644 --- a/src/modules/filters/osisstrongs.cpp +++ b/src/modules/filters/osisstrongs.cpp @@ -2,9 +2,24 @@ * * osisstrongs - SWFilter descendant to hide or show strongs number * in a OSIS module. + * + * + * Copyright 2009 CrossWire Bible Society (http://www.crosswire.org) + * CrossWire Bible Society + * P. O. Box 2528 + * Tempe, AZ 85280-2528 + * + * 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 version 2. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * */ - #include <stdlib.h> #include <stdio.h> #include <ctype.h> @@ -38,6 +53,7 @@ char OSISStrongs::processText(SWBuf &text, const SWKey *key, const SWModule *mod int wordNum = 1; char wordstr[5]; const char *wordStart = 0; + SWBuf page = ""; // some modules include <seg> page info, so we add these to the words const SWBuf orig = text; const char * from = orig.c_str(); @@ -50,6 +66,20 @@ char OSISStrongs::processText(SWBuf &text, const SWKey *key, const SWModule *mod } if (*from == '>') { // process tokens intoken = false; + + // possible page seg -------------------------------- + if (token.startsWith("seg ")) { + XMLTag stag(token); + SWBuf type = stag.getAttribute("type"); + if (type == "page") { + SWBuf number = stag.getAttribute("subtype"); + if (number.length()) { + page = number; + } + } + } + // --------------------------------------------------- + if (token.startsWith("w ")) { // Word XMLTag wtag(token); if (module->isProcessEntryAttributes()) { @@ -167,15 +197,17 @@ char OSISStrongs::processText(SWBuf &text, const SWKey *key, const SWModule *mod if (lemma.length()) - module->getEntryAttributes()["Word"][wordstr]["Lemma"] = lemma; + module->getEntryAttributes()["Word"][wordstr]["Lemma"] = lemma; if (lemmaClass.length()) - module->getEntryAttributes()["Word"][wordstr]["LemmaClass"] = lemmaClass; + module->getEntryAttributes()["Word"][wordstr]["LemmaClass"] = lemmaClass; if (morph.length()) - module->getEntryAttributes()["Word"][wordstr]["Morph"] = morph; + module->getEntryAttributes()["Word"][wordstr]["Morph"] = morph; if (morphClass.length()) - module->getEntryAttributes()["Word"][wordstr]["MorphClass"] = morphClass; + module->getEntryAttributes()["Word"][wordstr]["MorphClass"] = morphClass; if (src.length()) module->getEntryAttributes()["Word"][wordstr]["Src"] = src; + if (page.length()) + module->getEntryAttributes()["Word"][wordstr]["Page"] = page; if (wtag.isEmpty()) { int j; |