node-sword-interface 0.245.0 → 0.246.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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-sword-interface",
3
- "version": "0.245.0",
3
+ "version": "0.246.0",
4
4
  "description": "Javascript (N-API) interface to SWORD library",
5
5
  "keywords": [
6
6
  "C++",
@@ -114,6 +114,14 @@ void get_book_list(ModuleHelper& module_helper)
114
114
  }
115
115
  }
116
116
 
117
+ void get_book_headers(TextProcessor& text_processor)
118
+ {
119
+ vector<Verse> headerList = text_processor.getBookHeaderList("NASB", "John");
120
+ for (int i = 0; i < headerList.size(); i++) {
121
+ cout << headerList[i].content << endl;
122
+ }
123
+ }
124
+
117
125
  void test_unlock_key(ModuleInstaller& module_installer, ModuleStore& module_store, TextProcessor& text_processor)
118
126
  {
119
127
  module_installer.uninstallModule("NA28");
@@ -206,11 +214,13 @@ int main(int argc, char** argv)
206
214
  //string translation = sword_facade.getSwordTranslation(string("/usr/share/sword/locales.d"), string("de"), string("locales"));
207
215
  //cout << translation << endl;
208
216
 
209
- vector<Verse> searchResults = moduleSearch.getModuleSearchResults("NASB", "faith", SearchType::multiWord, SearchScope::NT, true);
217
+ /*vector<Verse> searchResults = moduleSearch.getModuleSearchResults("NASB", "faith", SearchType::multiWord, SearchScope::NT, true);
210
218
  cout << "Got " << searchResults.size() << " results!" << endl;
211
219
  for (unsigned int i=0; i < searchResults.size(); i++) {
212
220
  cout << searchResults[i].reference << endl;
213
- }
221
+ }*/
222
+
223
+ get_book_headers(textProcessor);
214
224
 
215
225
  return 0;
216
226
  }
@@ -36,8 +36,6 @@
36
36
  using namespace std;
37
37
  using namespace sword;
38
38
 
39
- #define SEARCHTYPE_ENTRYATTR -3L
40
-
41
39
  TextProcessor::TextProcessor(ModuleStore& moduleStore, ModuleHelper& moduleHelper)
42
40
  : _moduleStore(moduleStore), _moduleHelper(moduleHelper)
43
41
  {
@@ -475,7 +473,7 @@ vector<Verse> TextProcessor::getBookHeaderList(string moduleName, string bookCod
475
473
  ListKey scopeList = VerseKey().parseVerseList(bookCode.c_str(), "", true);
476
474
  SWKey* scope = &scopeList;
477
475
 
478
- ListKey resultKey = module->search("/Heading", SEARCHTYPE_ENTRYATTR, 0, scope);
476
+ ListKey resultKey = module->search("/Heading", SWModule::SEARCHTYPE_ENTRYATTR, 0, scope);
479
477
 
480
478
  static string titleStartElementFilter = "<title";
481
479
  static string titleEndElementFilter = "</title>";
@@ -484,6 +482,8 @@ vector<Verse> TextProcessor::getBookHeaderList(string moduleName, string bookCod
484
482
 
485
483
  for (resultKey = TOP; !resultKey.popError(); resultKey++) {
486
484
  module->setKey(resultKey);
485
+ module->renderText();
486
+
487
487
  VerseKey currentKey(resultKey.getShortText());
488
488
 
489
489
  // get both Preverse and Interverse Headings and just merge them into the same map