TehShrike / verse-reference-regex

A regular expression that matches Bible verse references and ranges
8 stars 3 forks source link

Allow passing in a custom book array #1

Closed TehShrike closed 6 years ago

TehShrike commented 6 years ago

So @vypr has a fork of this library at https://github.com/vypr/verse-reference-regex , mostly to use a custom list of books.

I already moved the list of books out of this repo and into its own at books-of-the-bible.

It makes sense to allow consumers to pass their own array of books into createRegex.

What do you think @vypr - would that eliminate the need for your fork?

SeraphimRP commented 6 years ago

I could, in theory, make a PR on books-of-the-bible with more book names. There isn't much to lose with it. You'd have more abbreviations and book names from multiple languages (eventually once I work through all of them), that's really the only reason why I have the fork anyways.

This would remove the need for a custom book array, especially if it covers essentially all bases (besides some nuances people might have here and there). I don't see people needing to pass it as an argument unless they're using this project for something that isn't referencing Bible verses.

A couple of other reasons why I have the fork too (besides book names) is:

TehShrike commented 6 years ago

I would love to get pull requests to books-of-the-bible adding more abbreviations, but I only care about the canon, I'm not interested in maintaining a list of the apocrypha.

Since it looks like your use includes the apocrypha, it makes sense to allow passing in arbitrary lists of books.

I purposefully wanted to avoid doing too much validation in this library. It's a deep rabbit hole (somewhere in there, you have to start validating that the chapter numbers actually exist in the given book, and that the chapters contain the given verse numbers).

This library is for finding potential verse references, nothing else - whether or not invalid verses should be a thrown error (if you're making a sermon linter or something) or just something the app ignores is up to whatever app is using this library.

SeraphimRP commented 6 years ago

It's important to look at use cases here, besides the apocrypha/deuterocanon, what else would it be used for?

TehShrike commented 6 years ago

I'm not enough of a scholar to have a ton of examples, but I know there are some other old often-translated books that use some kind of similar phrase-identification scheme, like Josephus's books.

SeraphimRP commented 6 years ago

Right, the early Christian writings, 1/2 Clement and that. I don't think adding the deuterocanon to books-of-the-bible would hurt, just for the sake of covering all the bases (because the Roman Catholic, Eastern Orthodox, etc. churches use these). But as for these early Christian writings (that aren't considered canon by any Christian organization), maybe an optional parameter for a custom book array?

TehShrike commented 6 years ago

I want to maintain the books-of-the-bible repo as a list of the books in the canon, specifically, not a list of all books that could be associated with chapter/verse references.

As such, it seems like a good default data set for this verse-reference-regex library, but it would be good to accommodate other data for other uses.

SeraphimRP commented 6 years ago

Yes, but the Catholics, Eastern Orthodox, etc, consider the apocrypha/deuterocanon (that being the OT apocryphal books of Tobit, Judith, Additions to Esther, Wisdom, Sirach (Ecclesiasticus), Baruch, Prayer of Azariah, Susanna, Bel and the Dragon, 1 Maccabees, 2 Maccabees) to be canonical. Even though I myself am a Lutheran, this will be very applicable.

TehShrike commented 6 years ago

Sure, I think that's a good argument for allowing consumers to pass in custom book data structures.

SeraphimRP commented 6 years ago

I mean as in, we should have those OT apocryphal books in books-of-the-bible, then have the optional book structure argument for anything else.

TehShrike commented 6 years ago

No, books-of-the-bible is specifically a repository that contains only the canon books. We could change the default in this verse-reference-regex repo to be a larger list of books, but I'm not personally interested in doing that. I don't want to maintain data for anything besides the canon.

This feature (passing in the books structure to createRegex and extractRangeFromMatch) has been published in 1.2.0.

SeraphimRP commented 6 years ago

but the catholics and eastern orthodox (the largest Christian organizations) consider the books as canon, that's why i'm saying they should go in there

TehShrike commented 6 years ago

I consider the Roman church to be heretical, so I wouldn't consider their evaluation of the canon to be authoritative. You may be interested in this booklet on the canon.