Skip to content

UpdateUsfmParserHandler should look up rows by reference #232

@benjaminking

Description

@benjaminking

When USFM documents contain out-of-order verses, the rows that are passed to UpdateUsfmParserHandler may be sorted by verse reference (due to the way that other classes in Machine handle USFM rows). Since UpdateUsfmParserHandler processes rows in the order that they appear in the document, these rows can become misaligned. This can result in empty or misaligned verses being inserted into the USFM. This also causes a crash in SILNLP when using paragraph marker placement (sillsdev/silnlp#794).

Instead of assuming that the input rows are in the same order that the updater will encounter them, UpdateUsfmParserHandler should advance rows by creating a map from verse references to rows and using the verse reference to find the next input row. If this map ends up being prohibitively large, it should be possible to create per-chapter maps instead.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

Status

✅ Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions