node-sword-interface 1.0.103 → 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.103",
3
+ "version": "1.0.104",
4
4
  "description": "Javascript (N-API) interface to SWORD library",
5
5
  "keywords": [
6
6
  "C++",
@@ -266,26 +266,11 @@ string TextProcessor::getCurrentChapterHeading(sword::SWModule* module, const st
266
266
  // Include chapter/book/testament/module intros
267
267
  currentVerseKey.setIntros(true);
268
268
 
269
- // For chapter 1, check if the book intro (0:0) is empty.
270
- // If so, chapter 1:0 content is being used as book intro in getBookIntroduction()
271
- // and should be skipped here to avoid duplication.
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
272
  if (currentChapter == 1) {
273
- VerseKey bookIntroKey = currentVerseKey;
274
- bookIntroKey.setChapter(0);
275
- bookIntroKey.setVerse(0);
276
- module->setKey(bookIntroKey);
277
-
278
- string bookIntro = string(module->getRawEntry());
279
- StringHelper::trim(bookIntro);
280
-
281
- // Restore the key
282
- module->setKey(currentVerseKey);
283
-
284
- // If book intro is empty, chapter 1:0 is used as book intro
285
- // so we should not include it here as chapter heading
286
- if (bookIntro.empty()) {
287
- return "";
288
- }
273
+ return "";
289
274
  }
290
275
 
291
276
  currentVerseKey.setVerse(0);
@@ -574,7 +559,8 @@ string TextProcessor::getBookIntroduction(string moduleName, string bookCode)
574
559
  // Include chapter/book/testament/module intros
575
560
  verseKey.setIntros(true);
576
561
 
577
- // 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)
578
564
  verseKey.setChapter(0);
579
565
  verseKey.setVerse(0);
580
566
  module->setKey(verseKey);
@@ -582,15 +568,23 @@ string TextProcessor::getBookIntroduction(string moduleName, string bookCode)
582
568
  bookIntroText = string(module->getRawEntry());
583
569
  StringHelper::trim(bookIntroText);
584
570
 
585
- // If book intro (0:0) is empty, also fetch chapter 1:0
586
- // Some modules (like NET) store book-level intro content in chapter 1:0
587
- if (bookIntroText.empty()) {
588
- verseKey.setChapter(1);
589
- verseKey.setVerse(0);
590
- 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);
591
579
 
592
- bookIntroText = string(module->getRawEntry());
593
- 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;
594
588
  }
595
589
 
596
590
  static regex titleStartElementFilter = regex("<title");