node-sword-interface 1.0.102 → 1.0.104

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": "1.0.102",
3
+ "version": "1.0.104",
4
4
  "description": "Javascript (N-API) interface to SWORD library",
5
5
  "keywords": [
6
6
  "C++",
@@ -265,8 +265,15 @@ string TextProcessor::getCurrentChapterHeading(sword::SWModule* module, const st
265
265
  if (currentVerseKey.getVerse() == 1) { // X:1, set key to X:0
266
266
  // Include chapter/book/testament/module intros
267
267
  currentVerseKey.setIntros(true);
268
- currentVerseKey.setVerse(0);
269
268
 
269
+ // For chapter 1, always skip chapter 1:0 content here.
270
+ // getBookIntroduction() now always includes chapter 1:0 as part of the book intro,
271
+ // so we must not duplicate it here.
272
+ if (currentChapter == 1) {
273
+ return "";
274
+ }
275
+
276
+ currentVerseKey.setVerse(0);
270
277
  module->setKey(currentVerseKey);
271
278
 
272
279
  chapterHeading = string(module->getRawEntry());
@@ -552,7 +559,8 @@ string TextProcessor::getBookIntroduction(string moduleName, string bookCode)
552
559
  // Include chapter/book/testament/module intros
553
560
  verseKey.setIntros(true);
554
561
 
555
- // First try to get book intro from chapter 0, verse 0
562
+ // Get book intro from chapter 0, verse 0
563
+ // This may contain testament intro for first books (Genesis, Matthew)
556
564
  verseKey.setChapter(0);
557
565
  verseKey.setVerse(0);
558
566
  module->setKey(verseKey);
@@ -560,15 +568,23 @@ string TextProcessor::getBookIntroduction(string moduleName, string bookCode)
560
568
  bookIntroText = string(module->getRawEntry());
561
569
  StringHelper::trim(bookIntroText);
562
570
 
563
- // If book intro (0:0) is empty, also fetch chapter 1:0
564
- // Some modules (like NET) store book-level intro content in chapter 1:0
565
- if (bookIntroText.empty()) {
566
- verseKey.setChapter(1);
567
- verseKey.setVerse(0);
568
- module->setKey(verseKey);
571
+ // Also fetch chapter 1:0 content and append it
572
+ // Many modules store book-level intro content (images, titles) in chapter 1:0
573
+ // We always include this to handle both cases:
574
+ // - Modules where 0:0 is empty and 1:0 has book intro
575
+ // - First books of testaments where 0:0 has testament intro and 1:0 has book intro
576
+ verseKey.setChapter(1);
577
+ verseKey.setVerse(0);
578
+ module->setKey(verseKey);
569
579
 
570
- bookIntroText = string(module->getRawEntry());
571
- StringHelper::trim(bookIntroText);
580
+ string chapter1Intro = string(module->getRawEntry());
581
+ StringHelper::trim(chapter1Intro);
582
+
583
+ if (!chapter1Intro.empty()) {
584
+ if (!bookIntroText.empty()) {
585
+ bookIntroText += "\n";
586
+ }
587
+ bookIntroText += chapter1Intro;
572
588
  }
573
589
 
574
590
  static regex titleStartElementFilter = regex("<title");