diff options
Diffstat (limited to 'src/backend/filters/osistohtml.cpp')
-rw-r--r-- | src/backend/filters/osistohtml.cpp | 39 |
1 files changed, 19 insertions, 20 deletions
diff --git a/src/backend/filters/osistohtml.cpp b/src/backend/filters/osistohtml.cpp index c04c820..3a8d65f 100644 --- a/src/backend/filters/osistohtml.cpp +++ b/src/backend/filters/osistohtml.cpp @@ -2,7 +2,7 @@ * * This file is part of BibleTime's source code, http://www.bibletime.info/. * -* Copyright 1999-2011 by the BibleTime developers. +* Copyright 1999-2014 by the BibleTime developers. * The BibleTime source code is licensed under the GNU General Public License version 2.0. * **********/ @@ -10,10 +10,11 @@ #include "backend/filters/osistohtml.h" #include <QString> -#include "backend/config/cbtconfig.h" +#include "backend/config/btconfig.h" #include "backend/drivers/cswordmoduleinfo.h" #include "backend/managers/clanguagemgr.h" #include "backend/managers/referencemanager.h" +#include "backend/managers/cswordbackend.h" // Sword includes: #include <swbuf.h> @@ -64,24 +65,22 @@ bool Filters::OsisToHtml::handleToken(sword::SWBuf &buf, const char *token, swor // <div> tag if (!strcmp(tag.getName(), "div")) { - //handle intro - - if ((!tag.isEmpty()) && (!tag.isEndTag())) { //start tag + if (tag.isEndTag()) { + buf.append("</div>"); + } else { sword::SWBuf type( tag.getAttribute("type") ); - if (type == "introduction") { - buf.append("<div class=\"introduction\">"); - } - else if (type == "chapter") { - buf.append("<div class=\"chapter\" />"); //don't open a div here, that would lead to a broken XML structure - } - else { + if (!tag.isEmpty()) + buf.append("<div class=\"introduction\">"); + } else if (type == "chapter") { + if (!tag.isEmpty()) + buf.append("<div class=\"chapter\" ></div>"); //don't open a div here, that would lead to a broken XML structure + } else if (type == "x-p") { + buf.append("<br/>"); + } else { buf.append("<div>"); } } - else if (tag.isEndTag()) { //end tag - buf.append("</div>"); - } } else if (!strcmp(tag.getName(), "w")) { if ((!tag.isEmpty()) && (!tag.isEndTag())) { //start tag @@ -192,7 +191,7 @@ bool Filters::OsisToHtml::handleToken(sword::SWBuf &buf, const char *token, swor } else { //no prefix given val = attrib; - const bool skipFirst = ((val[0] == 'T') && ((val[1] == 'H') || (val[1] == 'H'))); + const bool skipFirst = ((val[0] == 'T') && ((val[1] == 'H') || (val[1] == 'G'))); attrValue.append( skipFirst ? val + 1 : val ); } } @@ -237,7 +236,7 @@ bool Filters::OsisToHtml::handleToken(sword::SWBuf &buf, const char *token, swor buf.append("<span class=\"crossreference\">"); sword::SWBuf footnoteNumber = tag.getAttribute("swordFootnote"); sword::SWBuf footnoteBody = myUserData->entryAttributes["Footnote"][footnoteNumber]["body"]; - buf += myModule->RenderText(footnoteBody); + buf += myModule->renderText(footnoteBody); } /* else if (type == "explanation") { @@ -256,7 +255,7 @@ bool Filters::OsisToHtml::handleToken(sword::SWBuf &buf, const char *token, swor else { // qWarning("found note in %s", myUserData->key->getShortText()); buf.append(" <span class=\"footnote\" note=\""); - buf.append(myModule->Name()); + buf.append(myModule->getName()); buf.append('/'); buf.append(myUserData->key->getShortText()); buf.append('/'); @@ -553,7 +552,7 @@ void Filters::OsisToHtml::renderReference(const char *osisRef, sword::SWBuf &buf if (!mod || (mod->type() != CSwordModuleInfo::Bible && mod->type() != CSwordModuleInfo::Commentary)) { - mod = CBTConfig::get( CBTConfig::standardBible ); + mod = btConfig().getDefaultSwordModuleByType("standardBible"); } // Q_ASSERT(mod); There's no necessarily a module or standard Bible @@ -574,7 +573,7 @@ void Filters::OsisToHtml::renderReference(const char *osisRef, sword::SWBuf &buf ReferenceManager::ParseOptions options; options.refBase = QString::fromUtf8(myUserData->key->getText()); options.refDestinationModule = QString(mod->name()); - options.sourceLanguage = QString(myModule->Lang()); + options.sourceLanguage = QString(myModule->getLanguage()); options.destinationLanguage = QString("en"); buf.append("<a href=\""); |