Repository navigation
Tt 7873 multi verse marker incorrect after auto transcribe - #879
sarahentzel wants to merge 2 commits into
Conversation
…ng existing to be one verse
gtryus
left a comment
There was a problem hiding this comment.
- Duplicated pattern: the new verse-marker regex
/\\v (\d+[a-f]?-?\d*[a-f]?)\s?/repeats one in parseTranscription.ts:8, and the two already handle spaces differently. One shared constant would keep them in step. - Missing test for empty input: nothing tests
trans = ''. It currently returnsundefinedonly because'x'.includes('')is true. - Names:
appendAutoTranscriptionsounds like it changes something, but it only returns the text to add.autoTranscriptionToAppendwould say that.mcould beverseMarker. - Comment is wrong: the doc comment says "leading verse marker", but the regex has no
^, so it matches the first marker anywhere in the text. Either anchor it or reword the comment.
(c) Implemented but looks wrong
-
Wrong cut point: in appendAutoTranscription.ts,
index = m[0].lengthshould bem.index + m[0].length. When the transcription doesn't start with a marker, the cut lands in the wrong place, e.g.foo \v 3 barbecomesv 3 bar. This was already in the old code. -
Only the first marker is checked: if the pane already has
\v 1-5 \v 6-7, the transcription is appended whole and\v 6-7appears twice. -
Chapter is ignored:
curTrans.includes(m[0])can match chapter 6's\v 1when looking for chapter 7's\v 1. This becomes a problem once Scenario 2 is fixed. -
Newline after the marker: if the pane has
\v 1-5\n, the match requires a trailing space, so the marker gets duplicated. -
Moving the logic into a separate testable helper is a reasonable refactor.
No description provided.