node-sword-interface 1.0.102 → 1.0.103

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.103",
4
4
  "description": "Javascript (N-API) interface to SWORD library",
5
5
  "keywords": [
6
6
  "C++",
@@ -265,8 +265,30 @@ 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, 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.
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
+ }
289
+ }
290
+
291
+ currentVerseKey.setVerse(0);
270
292
  module->setKey(currentVerseKey);
271
293
 
272
294
  chapterHeading = string(module->getRawEntry());