openbibleinfo / Bible-Passage-Reference-Parser

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

Can't get sequence_combination_strategy: "separate" to work #20

Closed missioeric closed 8 years ago

missioeric commented 8 years ago

When I run the following code, the "separate" option doesn't work. It shows up as "combine" instead:

var bcv = new bcv_parser; var verses; var parsed_verses; bcv.include_apocrypha(true); bcv.set_options({ "osis_compaction_strategy": "bc", "consecutive_combination_strategy": "separate", "book_sequence_strategy": "ignore", "invalid_sequence_strategy": "ignore", "sequence_combination_strategy": "combine"}); verses = document.getElementById("dcycle_verse_list").value; parsed_verses = bcv.parse(verses).osis()

If I enter Matt 5-7, parsed_verses will equal Matt.5-Matt.7

openbibleinfo commented 8 years ago

This is a good question because the distinction is a little arcane; consecutive_combination_strategy doesn't affect ranges, only sequences:

bcv.set_options({consecutive_combination_strategy: "combine"});
bcv.parse("Matthew 5-7").osis(); // Matt.5-Matt.7
bcv.parse("Matthew 5, 6, 7").osis(); // Matt.5-Matt.7

bcv.set_options({consecutive_combination_strategy: "separate"});
bcv.parse("Matthew 5-7").osis(); // Matt.5-Matt.7
bcv.parse("Matthew 5, 6, 7").osis(); // Matt.5,Matt.6,Matt.7

The sequence_combination_strategy controls whether the results are returned as an array of osis references or as a comma-delimited string, which I don't think is related to your question.

If you're looking to separate a range into its component parts, you may want to see issue #6.

missioeric commented 8 years ago

Ok, thanks for the clarification.