diff options
Diffstat (limited to 'src/modules/filters/osisosis.cpp')
-rw-r--r-- | src/modules/filters/osisosis.cpp | 53 |
1 files changed, 25 insertions, 28 deletions
diff --git a/src/modules/filters/osisosis.cpp b/src/modules/filters/osisosis.cpp index 2bc5cbb..f3dca3a 100644 --- a/src/modules/filters/osisosis.cpp +++ b/src/modules/filters/osisosis.cpp @@ -2,7 +2,7 @@ * * osisosis.cpp - internal OSIS to public OSIS filter * - * $Id: osisosis.cpp 2833 2013-06-29 06:40:28Z chrislit $ + * $Id: osisosis.cpp 3338 2015-03-12 20:04:06Z refdoc $ * * Copyright 2004-2013 CrossWire Bible Society (http://www.crosswire.org) * CrossWire Bible Society @@ -58,39 +58,28 @@ char OSISOSIS::processText(SWBuf &text, const SWKey *key, const SWModule *module char status = SWBasicFilter::processText(text, key, module); VerseKey *vkey = SWDYNAMIC_CAST(VerseKey, key); if (vkey) { - SWBuf ref = ""; if (vkey->getVerse()) { - ref.appendFormatted("\t\t<verse osisID=\"%s\">", vkey->getOSISRef()); - } - - if (ref.length() > 0) { - - text = ref + text; - - if (vkey->getVerse()) { - VerseKey *tmp = (VerseKey *)vkey->clone(); - *tmp = *vkey; - tmp->setAutoNormalize(false); - tmp->setIntros(true); - - text += "</verse>"; - + VerseKey *tmp = (VerseKey *)vkey->clone(); + *tmp = *vkey; + tmp->setAutoNormalize(false); + tmp->setIntros(true); + + *tmp = MAXVERSE; + if (*vkey == *tmp) { + tmp->setVerse(0); +// sprintf(ref, "\t</div>"); +// pushString(&to, ref); + *tmp = MAXCHAPTER; *tmp = MAXVERSE; if (*vkey == *tmp) { + tmp->setChapter(0); tmp->setVerse(0); // sprintf(ref, "\t</div>"); // pushString(&to, ref); - *tmp = MAXCHAPTER; - *tmp = MAXVERSE; - if (*vkey == *tmp) { - tmp->setChapter(0); - tmp->setVerse(0); -// sprintf(ref, "\t</div>"); -// pushString(&to, ref); - } } - delete tmp; } + delete tmp; + } // // else if (vkey->Chapter()) { @@ -98,7 +87,7 @@ char OSISOSIS::processText(SWBuf &text, const SWKey *key, const SWModule *module // } // else sprintf(ref, "\t<div type=\"book\" osisID=\"%s\">", vkey->getOSISRef()); // - } + } return status; } @@ -149,11 +138,12 @@ bool OSISOSIS::handleToken(SWBuf &buf, const char *token, BasicFilterUserData *u else if (!strcmp(tag.getName(), "note")) { if (!tag.isEndTag()) { SWBuf type = tag.getAttribute("type"); + bool strongsMarkup = (type == "x-strongsMarkup" || type == "strongsMarkup"); // the latter is deprecated if (strongsMarkup) { tag.setEmpty(false); // handle bug in KJV2003 module where some note open tags were <note ... /> } - + if (!tag.isEmpty()) { tag.setAttribute("swordFootnote", 0); @@ -162,6 +152,13 @@ bool OSISOSIS::handleToken(SWBuf &buf, const char *token, BasicFilterUserData *u } else u->suspendTextPassThru = true; } + + if (u->module) { + XMLTag tag = token; + SWBuf swordFootnote = tag.getAttribute("swordFootnote"); + SWBuf footnoteBody = u->module->getEntryAttributes()["Footnote"][swordFootnote]["body"]; + buf.append(u->module->renderText(footnoteBody)); + } } if (tag.isEndTag()) { if (u->suspendTextPassThru == false) |