diff options
author | Roberto C. Sanchez <roberto@connexer.com> | 2014-03-29 10:54:01 -0400 |
---|---|---|
committer | Roberto C. Sanchez <roberto@connexer.com> | 2014-03-29 10:54:01 -0400 |
commit | 71a39f4652cd51df814c930dd268f3c9ad2aee86 (patch) | |
tree | 5994350a603908c4e4d660bc9d72c4ec43dd648e /src/modules/filters/thmlscripref.cpp | |
parent | 03134fa5f6f25d92724ce4c183f9bbe12a9e37dc (diff) |
Imported Upstream version 1.6.0+dfsg
Diffstat (limited to 'src/modules/filters/thmlscripref.cpp')
-rw-r--r-- | src/modules/filters/thmlscripref.cpp | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/src/modules/filters/thmlscripref.cpp b/src/modules/filters/thmlscripref.cpp index df2b3d2..e46d679 100644 --- a/src/modules/filters/thmlscripref.cpp +++ b/src/modules/filters/thmlscripref.cpp @@ -2,9 +2,24 @@ * * thmlscripref - SWFilter descendant to hide or show scripture * referebces in a ThML 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 <thmlscripref.h> @@ -38,7 +53,13 @@ char ThMLScripref::processText(SWBuf &text, const SWKey *key, const SWModule *mo SWBuf refs = ""; int footnoteNum = 1; char buf[254]; - VerseKey parser = key->getText(); + SWKey *p = (module) ? module->CreateKey() : (key) ? key->clone() : new VerseKey(); + VerseKey *parser = SWDYNAMIC_CAST(VerseKey, p); + if (!parser) { + delete p; + parser = new VerseKey(); + } + *parser = key->getText(); SWBuf orig = text; const char *from = orig.c_str(); @@ -77,8 +98,8 @@ char ThMLScripref::processText(SWBuf &text, const SWKey *key, const SWModule *mo startTag.setAttribute("swordFootnote", buf); SWBuf passage = startTag.getAttribute("passage"); if (passage.length()) - refs = parser.ParseVerseList(passage.c_str(), parser, true).getRangeText(); - else refs = parser.ParseVerseList(tagText.c_str(), parser, true).getRangeText(); + refs = parser->ParseVerseList(passage.c_str(), *parser, true).getRangeText(); + else refs = parser->ParseVerseList(tagText.c_str(), *parser, true).getRangeText(); module->getEntryAttributes()["Footnote"][buf]["refList"] = refs.c_str(); } hide = false; @@ -117,6 +138,7 @@ char ThMLScripref::processText(SWBuf &text, const SWKey *key, const SWModule *mo } else tagText += *from; } + delete parser; return 0; } |