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/thmlfootnotes.cpp | |
parent | 03134fa5f6f25d92724ce4c183f9bbe12a9e37dc (diff) |
Imported Upstream version 1.6.0+dfsg
Diffstat (limited to 'src/modules/filters/thmlfootnotes.cpp')
-rw-r--r-- | src/modules/filters/thmlfootnotes.cpp | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/src/modules/filters/thmlfootnotes.cpp b/src/modules/filters/thmlfootnotes.cpp index 23c43b4..e75311a 100644 --- a/src/modules/filters/thmlfootnotes.cpp +++ b/src/modules/filters/thmlfootnotes.cpp @@ -2,9 +2,26 @@ * * thmlfootnotes - SWFilter descendant to hide or show footnotes * 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 <thmlfootnotes.h> @@ -39,7 +56,13 @@ char ThMLFootnotes::processText(SWBuf &text, const SWKey *key, const SWModule *m 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(); @@ -78,7 +101,7 @@ char ThMLFootnotes::processText(SWBuf &text, const SWKey *key, const SWModule *m startTag.setAttribute("swordFootnote", buf); if ((startTag.getAttribute("type")) && (!strcmp(startTag.getAttribute("type"), "crossReference"))) { if (!refs.length()) - refs = parser.ParseVerseList(tagText.c_str(), parser, true).getRangeText(); + refs = parser->ParseVerseList(tagText.c_str(), *parser, true).getRangeText(); module->getEntryAttributes()["Footnote"][buf]["refList"] = refs.c_str(); } } @@ -118,6 +141,7 @@ char ThMLFootnotes::processText(SWBuf &text, const SWKey *key, const SWModule *m } else tagText += *from; } + delete parser; return 0; } |