From 350a11b05c6496b3628dd18704b9f7e0b3f29403 Mon Sep 17 00:00:00 2001 From: Your Name Date: Tue, 10 Aug 2021 12:29:46 -0400 Subject: Fixed handling of titles --- libbible.cc | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'libbible.cc') diff --git a/libbible.cc b/libbible.cc index 12e45a0..c9acb7d 100644 --- a/libbible.cc +++ b/libbible.cc @@ -3,12 +3,14 @@ #include #include #include +#include #include using namespace sword; using namespace std; SWMgr library(new MarkupFilterMgr(FMT_XHTML)); +OSISFootnotes filter; vector getBooks(SWModule *target) { vector books; @@ -145,6 +147,8 @@ libbible::passage libbible::getPassage(string modName, string reference) { vector libbible::getText(libbible::passage pass) { vector texts; SWModule *target = library.getModule(pass.modName.c_str()); + filter.setOptionValue("Off"); + target->addOptionFilter(&filter); if(target == nullptr) { // Module doesn't exist return texts; @@ -196,10 +200,13 @@ vector libbible::getText(libbible::passage pass) { } } } + if(*i == '\n') { + continue; // We add newlines with
+ } if(! hasAddedText && (*i == ' ' || *i == '\t')) { continue; } - if(*i == "¶"[0] && *(i+1) == "¶"[1]) { + if(*i == "¶"[0] && i+1 != text.end() && *(i+1) == "¶"[1]) { i++; if(hasAddedText) { texts.back().text += '\n'; @@ -238,6 +245,11 @@ vector libbible::getText(libbible::passage pass) { size_t end = span.find("\"", start); spans.push_back(std::pair(tag, span.substr(start, end-start))); spansChanged = true; + } else if(span.find("preverse") != string::npos) { + string tag = span.substr(1, span.find(" ")-1); + spans.push_back(std::pair(tag, "preverse")); + } else if(span == "
" || span == "
") { + texts.back().text += '\n'; } break; } -- cgit v1.2.3