node-sword-interface 1.0.42 → 1.0.43

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/API.md CHANGED
@@ -692,6 +692,7 @@ An object representation of a SWORD module.
692
692
  | shortCopyright | <code>String</code> | The short copyright information of the SWORD module |
693
693
  | version | <code>String</code> | The version of the SWORD module |
694
694
  | lastUpdate | <code>String</code> | The date of the last version update of the SWORD module |
695
+ | history | <code>Array.&lt;String&gt;</code> | The history of the SWORD module. A list of strings where each looks like this: <version>=<version-info> |
695
696
  | category | <code>String</code> | The category of the SWORD module |
696
697
  | repository | <code>String</code> | The repository of the SWORD module |
697
698
  | about | <code>String</code> | Extended description of the SWORD module |
package/index.js CHANGED
@@ -43,6 +43,7 @@ const nodeSwordInterfaceModule = require('./build/Release/node_sword_interface.n
43
43
  * @property {String} shortCopyright - The short copyright information of the SWORD module
44
44
  * @property {String} version - The version of the SWORD module
45
45
  * @property {String} lastUpdate - The date of the last version update of the SWORD module
46
+ * @property {String[]} history - The history of the SWORD module. A list of strings where each looks like this: <version>=<version-info>
46
47
  * @property {String} category - The category of the SWORD module
47
48
  * @property {String} repository - The repository of the SWORD module
48
49
  * @property {String} about - Extended description of the SWORD module
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-sword-interface",
3
- "version": "1.0.42",
3
+ "version": "1.0.43",
4
4
  "description": "Javascript (N-API) interface to SWORD library",
5
5
  "keywords": [
6
6
  "C++",
@@ -128,6 +128,10 @@ void NapiSwordHelper::swordModuleToNapiObject(const Napi::Env& env, SWModule* sw
128
128
 
129
129
  object["hasGreekStrongsKeys"] = Napi::Boolean::New(env, this->_moduleHelper.moduleHasFeature(swModule, "GreekDef"));
130
130
  object["hasHebrewStrongsKeys"] = Napi::Boolean::New(env, this->_moduleHelper.moduleHasFeature(swModule, "HebrewDef"));
131
+
132
+ // Add module history entries
133
+ std::vector<std::string> historyEntries = this->_moduleHelper.getModuleHistoryEntries(swModule);
134
+ object["history"] = this->getNapiArrayFromStringVector(env, historyEntries);
131
135
  }
132
136
 
133
137
  Napi::String NapiSwordHelper::getConfigEntry(sword::SWModule* swModule, std::string key, const Napi::Env& env)
@@ -198,6 +198,45 @@ map<string, int> ModuleHelper::getAbsoluteVerseNumberMap(SWModule* module, vecto
198
198
  return absoluteVerseNumbers;
199
199
  }
200
200
 
201
+ vector<string> ModuleHelper::getModuleConfigEntries(sword::SWModule* module)
202
+ {
203
+ vector<string> configEntries;
204
+
205
+ const ConfigEntMap& config = module->getConfig();
206
+
207
+ for (ConfigEntMap::const_iterator it = config.begin(); it != config.end(); ++it) {
208
+ configEntries.push_back(it->first.c_str());
209
+ }
210
+
211
+ return configEntries;
212
+ }
213
+
214
+ std::vector<std::string> ModuleHelper::getModuleHistoryEntries(sword::SWModule* module)
215
+ {
216
+ std::vector<std::string> historyEntries;
217
+
218
+ if (module == 0) {
219
+ cerr << "module is 0! Cannot get history entries!" << endl;
220
+ return historyEntries;
221
+ }
222
+
223
+ // Get all config entries
224
+ const ConfigEntMap& config = module->getConfig();
225
+
226
+ // Find all entries that start with "History_"
227
+ for (ConfigEntMap::const_iterator it = config.begin(); it != config.end(); ++it) {
228
+ std::string key = it->first.c_str();
229
+ if (key.find("History_") == 0) {
230
+ std::string value = it->second.c_str();
231
+ std::string version = key.substr(8); // Remove "History_" prefix
232
+ std::string entry = version + "=" + value;
233
+ historyEntries.push_back(entry);
234
+ }
235
+ }
236
+
237
+ return historyEntries;
238
+ }
239
+
201
240
  bool ModuleHelper::isBrokenMarkupModule(std::string moduleName)
202
241
  {
203
242
  return std::find(this->_brokenMarkupModules.begin(),
@@ -50,6 +50,8 @@ public:
50
50
  std::map<std::string, int> getAbsoluteVerseNumberMap(sword::SWModule* module, std::vector<std::string> bookList={});
51
51
  bool isBrokenMarkupModule(std::string moduleName);
52
52
  bool isInconsistentClosingEndDivModule(std::string moduleName);
53
+ std::vector<std::string> getModuleConfigEntries(sword::SWModule* module);
54
+ std::vector<std::string> getModuleHistoryEntries(sword::SWModule* module);
53
55
 
54
56
  private:
55
57
  bool moduleHasKeyValuePair(sword::SWModule* module, std::string key, std::string value);