node-sword-interface 0.248.0 → 0.251.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
package/src/node_sword_cli.cpp
CHANGED
|
@@ -214,13 +214,13 @@ int main(int argc, char** argv)
|
|
|
214
214
|
//string translation = sword_facade.getSwordTranslation(string("/usr/share/sword/locales.d"), string("de"), string("locales"));
|
|
215
215
|
//cout << translation << endl;
|
|
216
216
|
|
|
217
|
-
|
|
217
|
+
vector<Verse> searchResults = moduleSearch.getModuleSearchResults("GerNeUe", "Glaube", SearchType::multiWord, SearchScope::NT, true);
|
|
218
218
|
cout << "Got " << searchResults.size() << " results!" << endl;
|
|
219
219
|
for (unsigned int i=0; i < searchResults.size(); i++) {
|
|
220
220
|
cout << searchResults[i].reference << endl;
|
|
221
|
-
}
|
|
221
|
+
}
|
|
222
222
|
|
|
223
|
-
get_book_headers(textProcessor)
|
|
223
|
+
/*get_book_headers(textProcessor);*/
|
|
224
224
|
|
|
225
225
|
return 0;
|
|
226
226
|
}
|
|
@@ -70,14 +70,25 @@ bool ModuleHelper::moduleHasKeyValuePair(sword::SWModule* module, std::string ke
|
|
|
70
70
|
|
|
71
71
|
bool ModuleHelper::moduleHasBook(sword::SWModule* module, std::string bookCode)
|
|
72
72
|
{
|
|
73
|
-
bool hasBook;
|
|
73
|
+
bool hasBook = true;
|
|
74
74
|
stringstream key;
|
|
75
75
|
key << bookCode;
|
|
76
76
|
key << " 1:1";
|
|
77
77
|
|
|
78
78
|
module->setKey(key.str().c_str());
|
|
79
|
-
|
|
80
|
-
|
|
79
|
+
string moduleKeyText = string(module->getKey()->getShortText());
|
|
80
|
+
|
|
81
|
+
/* In case of apocryphal books the hasEntry method below is not enough.
|
|
82
|
+
Once we have set the key we need to compare the actual module key with the key we wanted to set.
|
|
83
|
+
For apocryphal books we may get "Rev 1:1" as actual module key and this will mismatch with the set key
|
|
84
|
+
and then indicate that the book is not existing. */
|
|
85
|
+
|
|
86
|
+
if (moduleKeyText != key.str()) {
|
|
87
|
+
hasBook = false;
|
|
88
|
+
} else {
|
|
89
|
+
hasBook = module->hasEntry(module->getKey());
|
|
90
|
+
}
|
|
91
|
+
|
|
81
92
|
return hasBook;
|
|
82
93
|
}
|
|
83
94
|
|
|
@@ -50,10 +50,17 @@
|
|
|
50
50
|
using namespace std;
|
|
51
51
|
using namespace sword;
|
|
52
52
|
|
|
53
|
-
ListKey ModuleSearch::getScopeKey(SearchScope scope)
|
|
53
|
+
ListKey ModuleSearch::getScopeKey(SWModule* module, SearchScope scope)
|
|
54
54
|
{
|
|
55
55
|
ListKey key;
|
|
56
56
|
|
|
57
|
+
if (module == 0) {
|
|
58
|
+
cerr << "ModuleSearch::getScopeKey / received 0 pointer for module!!!";
|
|
59
|
+
return key;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
VerseKey verseKey = module->getKey();
|
|
63
|
+
|
|
57
64
|
switch (scope) {
|
|
58
65
|
case SearchScope::OT:
|
|
59
66
|
{
|
|
@@ -63,7 +70,7 @@ ListKey ModuleSearch::getScopeKey(SearchScope scope)
|
|
|
63
70
|
"Isaiah;Jeremiah;Lamentations;Ezekiel;Daniel;Hosea;Joel;Amos;Obadiah;"
|
|
64
71
|
"Jonah;Micah;Nahum;Habakkuk;Zephaniah;Haggai;Zechariah;Malachi;";
|
|
65
72
|
|
|
66
|
-
key =
|
|
73
|
+
key = verseKey.parseVerseList(otBooks, "", true);
|
|
67
74
|
break;
|
|
68
75
|
}
|
|
69
76
|
|
|
@@ -74,7 +81,7 @@ ListKey ModuleSearch::getScopeKey(SearchScope scope)
|
|
|
74
81
|
"I Timothy;II Timothy;Titus;Philemon;Hebrews;James;I Peter;II Peter;"
|
|
75
82
|
"I John;II John;III John;Jude;Revelation of John;";
|
|
76
83
|
|
|
77
|
-
key =
|
|
84
|
+
key = verseKey.parseVerseList(ntBooks, "", true);
|
|
78
85
|
break;
|
|
79
86
|
}
|
|
80
87
|
|
|
@@ -119,7 +126,7 @@ vector<Verse> ModuleSearch::getModuleSearchResults(string moduleName,
|
|
|
119
126
|
ListKey scopeKey;
|
|
120
127
|
|
|
121
128
|
if (searchScope != SearchScope::BIBLE) {
|
|
122
|
-
scopeKey = this->getScopeKey(searchScope);
|
|
129
|
+
scopeKey = this->getScopeKey(module, searchScope);
|
|
123
130
|
scope = &scopeKey;
|
|
124
131
|
}
|
|
125
132
|
|
|
@@ -430,12 +430,13 @@ string TextProcessor::getBookIntroduction(string moduleName, string bookCode)
|
|
|
430
430
|
if (module == 0) {
|
|
431
431
|
cerr << "getLocalModule returned zero pointer for " << moduleName << endl;
|
|
432
432
|
} else {
|
|
433
|
-
|
|
433
|
+
module->setKeyText(bookCode.c_str());
|
|
434
|
+
VerseKey *verseKey = (VerseKey *)module->getKey();
|
|
434
435
|
|
|
435
436
|
// Include chapter/book/testament/module intros
|
|
436
|
-
verseKey
|
|
437
|
-
verseKey
|
|
438
|
-
verseKey
|
|
437
|
+
verseKey->setIntros(true);
|
|
438
|
+
verseKey->setChapter(0);
|
|
439
|
+
verseKey->setVerse(0);
|
|
439
440
|
module->setKey(verseKey);
|
|
440
441
|
|
|
441
442
|
bookIntroText = string(module->getRawEntry());
|