diff --git a/biblerefparsingtests.html b/biblerefparsingtests.html index dbcce60c..c69f9166 100644 --- a/biblerefparsingtests.html +++ b/biblerefparsingtests.html @@ -50,7 +50,14 @@ ["John 1-2", "John 1:1 - 2:*"], ["John 1 - 2", "John 1:1 - 2:*"], ["1 John 1-2", "1 John 1:1 - 2:*"], - ["1 John 1 - 2 ", "1 John 1:1 - 2:*"] + ["1 John 1 - 2 ", "1 John 1:1 - 2:*"], + ["John 3", "John 3:1 - 3:*"], + ["John 2:1-John 3:3", "John 2:1 - 3:3"], + ["John 2 : 1 - John 3 : 3 ", "John 2:1 - 3:3"], + ["John 3-4", "John 3:1 - 4:*"], + ["John 4 - 7", "John 4:1 - 7:*"], + ["1 John 4-6", "1 John 4:1 - 6:*"], + ["1 John 4 - 5 ", "1 John 4:1 - 5:*"] ]; var b = $("body"); var passed = 0; diff --git a/js/bible_ref_parsing.js b/js/bible_ref_parsing.js index 26dc4c62..252787cf 100644 --- a/js/bible_ref_parsing.js +++ b/js/bible_ref_parsing.js @@ -528,7 +528,7 @@ function maybeParseRangeSep(ref, r, errAcc) { function Reference(ref) { - r = { + var r = { start: { first: '', second: '' @@ -565,7 +565,7 @@ function Reference(ref) // Determine end chapter and verse if (r.end.first == '') { if (r.start.second == '' || typeof r.end.book != 'undefined') { - this.endchapter = r.end.second || '1'; + this.endchapter = r.end.second || r.start.first; this.endverse = '*'; } } else {