Javascript Bible Reference Parsing Object

0

In an effort to encourage the coding of a bible reference object (see previous post on my bible app), I though I would post some specifications in a clearer format than I had previously, along with some example inputs and outputs. Feel free to comment in the comments section, and if you build one, let me know, I would be more than happy to host it here with proper attribution of course. If we used a GPL type system, the library could become very robust. Thanks!

Bible Parsing Object Definition:

Input: String
Output: Object with attributes (book, bookname, chapter, startverse, endverse, [error])

Notes:

Reference: "Matthew"
Returns: error="Invalid Reference. Please include a chapter and/or verse range"

Reference: "Matthew 1"
Returns: book=’matthew’, bookname=’40’, chapter=’1′, startverse=’1′, endverse=’25’

Reference: "Matthew 1:1"
Returns: book=’matthew’, bookname=’40’, chapter=’1′, startverse=’1′, endverse=’1′

Reference: "Matthew 1:1-5"
Returns: book=’matthew’, bookname=’40’, chapter=’1′, startverse=’1′, endverse=’5′

Common Abbreviations should work, but the book should always return the full name.

Example Object:


function Reference(bibleRef) {

var book;
var bookname;
var chapter;
var startverse;
var endverse;

// A lot of parsing and stuff happend here. ;)

this.book=book;
this.bookname=bookname;
this.chapter=chapter;
this.startverse=startverse;
this.endverse=endverse;

}

Share.

About Author

I have been writing on the web since 2000. I am a christian , a photographer, an occasional poet, a recovering dreamer, an occasional philosopher, a software developer, an autodidact, and i resemble the INFP personality type.

Comments are closed.