openbibleinfo / Bible-Passage-Reference-Parser

Coffeescript to identify and understand Bible references like "John 3:16."
223 stars 65 forks source link

Spaces around chapter-verse-separator should not be ignored #38

Open renehamburger opened 6 years ago

renehamburger commented 6 years ago

When the comma is used as chapter-verse separator, as is the case in German Bible references, for example, it can easily be confused with the comma as a list-item separator. The universal practice is that the comma is followed by a space to signify the latter (e.g. Matt 1, 3 ) and that a comma without a space is used to signify the former (e.g. Matt 1,3).

The parser currently ignores any number of spaces before or after the chapter-verse-separator, which leads to completely wrong interpretations of a list of chapters or verses separated with ,. For example, Matt 1, 3-4, 6 refers to 'Matt.1,Matt.3-Matt.4,Matt.6' but is currently parsed as 'Matt.1.3-Matt.4.5'.

Is this something you would be able to fix?

alerque commented 6 years ago

I don't suppose it's any use asking all German publishers past and future to use a less ambiguous separator and stop depending only on white-space for semantic meaning? :smirk:

renehamburger commented 6 years ago

Yes, it's very unfortunate that this separator is so ambiguous! I'm sure it has a very long heritage. I've resolved this issue downstream now by converting those instances to ';' before passing them to the parser. I'd still leave this issue open as it would be great to resolve it here. (I personally found that part of this library too complicated to try to do it myself.)

But I would like to update the definitions for German references. Terms like 'Vers' (verse) and 'Kapitel' (chapter) need to be added with all possible case-number endings to work reliably.

@openbibleinfo, would you be prepared to accept such a PR?

renehamburger commented 6 years ago

I've created the PR: #40.