node-sword-interface 0.249.0 → 0.250.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
|
@@ -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
|
|