View Source BibleEx.RefParser (bible_ex v0.1.0)

Parses any general string for Bible references.

Link to this section Summary

Functions

use the parse_references() function to retrieve all the Bible references found in a string.

Link to this section Functions

Link to this function

parse_references(string)

View Source

use the parse_references() function to retrieve all the Bible references found in a string.

examples

Examples

iex> alias BibleEx.RefParser
iex> RefParser.parse_references("John 3:16")

[
  %BibleEx.Reference{
    book: "John",
    book_names: %{abbr: "JOH", name: "John", osis: "John", short: "Jn"},
    book_number: 43,
    reference: "John 3:16",
    reference_type: :verse,
    ...
  }
]

iex> RefParser.parse_references("I hope Matt 2:4 and James 5:1-5 get parsed")

[
  %BibleEx.Reference{
    book: "Matthew",
    book_names: %{abbr: "MAT", name: "Matthew", osis: "Matt", short: "Mt"},
    book_number: 40,
    reference: "Matthew 2:4",
    reference_type: :verse,
    ...
  },
  %BibleEx.Reference{
    book: "James",
    book_names: %{abbr: "JAM", name: "James", osis: "Jas", short: "Jas"},
    book_number: 59,
    reference: "James 5:1-5",
    reference_type: :verse_range,
    ...
  }
]

iex> RefParser.parse_references("This sentence contains two references. One that spans chapters, John 3:16-4:3, found in the book of John, and another one in the same book.")

[
  %BibleEx.Reference{
    book: "John",
    book_names: %{abbr: "JOH", name: "John", osis: "John", short: "Jn"},
    book_number: 43,
    reference: "John 3:16 - 4:3",
    reference_type: :chapter_range,
    ...
  },
  %BibleEx.Reference{
    book: "John",
    book_names: %{abbr: "JOH", name: "John", osis: "John", short: "Jn"},
    book_number: 43,
    reference: "John",
    reference_type: :chapter_range,
    ...
  }
]