Skip to content

Commit

Permalink
Add paragraphs around table rows (#786)
Browse files Browse the repository at this point in the history
There is a bug in Proskomma where the generation of events is messed up
if you have a series of table row markers \tr.  A work-around is to put
paragraph makers \p around the series of table row markers.
  • Loading branch information
chrisvire authored Jan 24, 2025
1 parent d93f4d9 commit 7646348
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion convert/convertBooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,10 @@ function isImageMissing(imageSource: string): boolean {
return !fs.existsSync(path.join('data', 'illustrations', imageSource));
}

function addParagraphMarkersAroundTableRows(text: string): string {
return text.replace(/((?:\\tr [^\n]*\n)+)/g, '\n\\p\n$1\\p\n');
}

type FilterFunction = (text: string, bcId: string, bookId: string) => string;

const usfmFilterFunctions: FilterFunction[] = [
Expand All @@ -199,7 +203,8 @@ const usfmFilterFunctions: FilterFunction[] = [
convertMarkdownsToMilestones,
handleNoCaptionFigures,
removeMissingFigures,
trimTrailingWhitespace
trimTrailingWhitespace,
addParagraphMarkersAroundTableRows
];

const htmlFilterFunctions: FilterFunction[] = [updateImgTags, trimTrailingWhitespace];
Expand Down

0 comments on commit 7646348

Please sign in to comment.