Skip to content

Commit

Permalink
fix: Append verses if split by section header
Browse files Browse the repository at this point in the history
  • Loading branch information
darcywong00 committed Aug 31, 2023
1 parent d529689 commit 7d74645
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/backTranslation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,13 @@ export async function updateObj(bookObj: books.objType, file: string, currentCha
bookObj.content[currentChapter].content.push(unit);
//console.log('verse ' + verseMatch[1] + ': ' + verseMatch[2]);
} else {
console.error('Error processing ' + bookObj.header.bookInfo.name + ' Ch: ' + currentChapter +
', verse ' + verseNum + ', verse is ' + verse);
// Parsing error. Possibly section header split a verse, so join with the last verse
let contentLength = bookObj.content[currentChapter].content.length;
if (contentLength > 1) {
bookObj.content[currentChapter].content[contentLength-2].text += ' (split section) ' + verse;
}
s.log('warn', `Stray verse, appending to previous verse in ${bookObj.header.bookInfo.name} ` +
`${currentChapter}:${verseNum} with: ${verse}`);
}
});

Expand Down
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ if (options.json) {
// Write SFM Console log to extra book file
s.writeLog();

console.log('All done processing');
////////////////////////////////////////////////////////////////////
// Processor functions
////////////////////////////////////////////////////////////////////
Expand Down

0 comments on commit 7d74645

Please sign in to comment.