aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYour Name <you@example.com>2021-08-10 12:29:46 -0400
committerYour Name <you@example.com>2021-08-10 12:29:46 -0400
commit350a11b05c6496b3628dd18704b9f7e0b3f29403 (patch)
treecd406ff9a27113ab0f27386e1051ff4254c7c295
parentab2668a4b0e6eebd80668aea9110f6fb86aed5a4 (diff)
downloadlibbible-350a11b05c6496b3628dd18704b9f7e0b3f29403.tar.gz
libbible-350a11b05c6496b3628dd18704b9f7e0b3f29403.tar.bz2
libbible-350a11b05c6496b3628dd18704b9f7e0b3f29403.zip
Fixed handling of titles
-rw-r--r--bible.cc16
-rw-r--r--libbible.cc14
2 files changed, 17 insertions, 13 deletions
diff --git a/bible.cc b/bible.cc
index ef9c1e4..943d6d0 100644
--- a/bible.cc
+++ b/bible.cc
@@ -244,9 +244,9 @@ int main(int argc, char* argv[]) {
bool isIndent = false;
bool isDivineName = false;
bool isJesus = false;
- bool isFootnote = false;
bool isTitle = false;
bool isParallel = false;
+ bool isPreverse = false;
for(string modifier : tex.modifiers) {
if(modifier == "paragraph") {
isParagraph = true;
@@ -256,23 +256,15 @@ int main(int argc, char* argv[]) {
isDivineName = true;
} else if (modifier == "wordsOfJesus") {
isJesus = true;
- } else if (modifier == "n") {
- isFootnote = true;
} else if (modifier == "title") {
isTitle = true;
} else if (modifier == "parallel") {
isParallel = true;
+ } else if (modifier == "preverse") {
+ isPreverse = true;
}
}
- if(isFootnote) {
- // Someday maybe we add this, but for now, omit
- tex.text = "";
- }
- if(isTitle) {
- // Someday maybe we add this, but for now, omit
- tex.text = "";
- }
- if(isParallel) {
+ if(isPreverse or isTitle or isParallel) {
// Someday maybe we add this, but for now, omit
tex.text = "";
}
diff --git a/libbible.cc b/libbible.cc
index 12e45a0..c9acb7d 100644
--- a/libbible.cc
+++ b/libbible.cc
@@ -3,12 +3,14 @@
#include <sword/markupfiltmgr.h>
#include <sword/swmodule.h>
#include <sword/swmgr.h>
+#include <sword/osisfootnotes.h>
#include <algorithm>
using namespace sword;
using namespace std;
SWMgr library(new MarkupFilterMgr(FMT_XHTML));
+OSISFootnotes filter;
vector<string> getBooks(SWModule *target) {
vector<string> books;
@@ -145,6 +147,8 @@ libbible::passage libbible::getPassage(string modName, string reference) {
vector<libbible::text> libbible::getText(libbible::passage pass) {
vector<libbible::text> 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::text> libbible::getText(libbible::passage pass) {
}
}
}
+ if(*i == '\n') {
+ continue; // We add newlines with <br />
+ }
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::text> libbible::getText(libbible::passage pass) {
size_t end = span.find("\"", start);
spans.push_back(std::pair<string, string>(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<string, string>(tag, "preverse"));
+ } else if(span == "<br />" || span == "<br/>") {
+ texts.back().text += '\n';
}
break;
}