Skip to content

Inconsistent VerseRef creation behavior #1474

Open

Description

@Enkidu93

You can create a verse ref whose ToString() is LUK 1:1, by setting VerseRef.Verse but new VerseRef("LUK 1:1,") throws an exception. VerseRef LUK1:1,'s AllVerses() includes LUK 1: which is not valid. It seems to me that either setting Verse to LUK 1:1, should throw an exception or LUK 1:1, should be understood as synonymous with LUK 1:1 not LUK 1:1, LUK 1:. What's the intended behavior? Happy to put in a PR to fix this if it'd be helpful.

I discovered this issue while investigating sillsdev/serval#796.

Activity

  1. tombogle commented on Oct 29, 2025

    @tombogle
    Contributor

    @FoolRunning Any idea whether this was/is intentional (seems unlikely) or whether fixing it one way or another would break something in Paratext? My inclination would be to say that setting Verse to LUK 1:1, should throw an exception, unless there are other cases where we try to be robust and trim off garbage. But to me it feels like it would be too hard to be sure that the trailing comma is just cruft that can be safely ignored as meaningless.

  2. Enkidu93 commented on Dec 5, 2025

    @Enkidu93
    Author

    Any updates on this?

  3. FoolRunning commented on Dec 5, 2025

    @FoolRunning
    Collaborator

    Sorry, I completely forgot about this.
    I doubt it is intentional, and it probably just happened to be that way.
    It's possible it has something to do with the way Paratext processes the text and it needed to allow invalid verses, but I doubt it.

  4. Enkidu93 commented on Dec 5, 2025

    @Enkidu93
    Author

    Sorry, I completely forgot about this. I doubt it is intentional, and it probably just happened to be that way. It's possible it has something to do with the way Paratext processes the text and it needed to allow invalid verses, but I doubt it.

    No worries! Thank you - how could I go about addressing this? I believe that our USFM parser in Machine was modeled on or even copied from Paratext (is that right, @ddaspit?) and we do hit this situation, so maybe changing the behavior to throw an exception would break something in Paratext?

    In the meantime, we've found a workaround on our end but it's a little cumbersome.

  5. tombogle commented on Dec 5, 2025

    @tombogle
    Contributor

    If @FoolRunning or someone on the Paratext 9 team can work with us to follow up and ensure that fixing this doesn't create a subtle bug (or even a really obvious one) in Paratext, I think it's easy enough to fix the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions