Skip to content

Commit 7646348

Browse files
authored
Add paragraphs around table rows (#786)
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.
1 parent d93f4d9 commit 7646348

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

convert/convertBooks.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,10 @@ function isImageMissing(imageSource: string): boolean {
190190
return !fs.existsSync(path.join('data', 'illustrations', imageSource));
191191
}
192192

193+
function addParagraphMarkersAroundTableRows(text: string): string {
194+
return text.replace(/((?:\\tr [^\n]*\n)+)/g, '\n\\p\n$1\\p\n');
195+
}
196+
193197
type FilterFunction = (text: string, bcId: string, bookId: string) => string;
194198

195199
const usfmFilterFunctions: FilterFunction[] = [
@@ -199,7 +203,8 @@ const usfmFilterFunctions: FilterFunction[] = [
199203
convertMarkdownsToMilestones,
200204
handleNoCaptionFigures,
201205
removeMissingFigures,
202-
trimTrailingWhitespace
206+
trimTrailingWhitespace,
207+
addParagraphMarkersAroundTableRows
203208
];
204209

205210
const htmlFilterFunctions: FilterFunction[] = [updateImgTags, trimTrailingWhitespace];

0 commit comments

Comments
 (0)