The lib module contains all the library functionality for the bibles plugin.

class openlp.plugins.bibles.lib.BibleStrings[source]

Bases: builtins.object

Provide standard strings for objects to use.

class openlp.plugins.bibles.lib.DisplayStyle[source]

Bases: builtins.object

An enumeration for bible text bracket display styles.

Curly = 2
NoBrackets = 0
Round = 1
Square = 3
class openlp.plugins.bibles.lib.LanguageSelection[source]

Bases: builtins.object

An enumeration for bible bookname language. And standard strings for use throughout the bibles plugin.

Application = 1
Bible = 0
English = 2
class openlp.plugins.bibles.lib.LayoutStyle[source]

Bases: builtins.object

An enumeration for bible screen layout styles.

Continuous = 2
VersePerLine = 1
VersePerSlide = 0
class openlp.plugins.bibles.lib.SearchResults(book, chapter, verse_list)[source]

Bases: builtins.object

Encapsulate a set of search results. This is Bible-type independent.


Returns whether or not the verse list contains verses.


Provides matches for parsing scripture references strings.

Parameters:match_type – The type of match is range_separator, range or full.

Provides separators for parsing and formatting scripture references.

Parameters:separator_type – The role and format of the separator.
openlp.plugins.bibles.lib.parse_reference(reference, bible, language_selection, book_ref_id=False)[source]

This is the next generation über-awesome function that takes a person’s typed in string and converts it to a list of references to be queried from the Bible database files.

  • reference – A string. The Bible reference to parse.
  • bible – A object. The Bible database object.
  • language_selection – An int. The language selection the user has chosen in settings section.
  • book_ref_id – A string. The book reference id.

The reference list is a list of tuples, with each tuple structured like this:

(book, chapter, from_verse, to_verse)

For example:

[('John', 3, 16, 18), ('John', 4, 1, 1)]

Reference string details:

Each reference starts with the book name and a chapter number. These are both mandatory.

  • John 3 refers to Gospel of John chapter 3

A reference range can be given after a range separator.

  • John 3-5 refers to John chapters 3 to 5

Single verses can be addressed after a verse separator.

  • John 3:16 refers to John chapter 3 verse 16
  • John 3:16-4:3 refers to John chapter 3 verse 16 to chapter 4 verse 3

After a verse reference all further single values are treat as verse in the last selected chapter.

  • John 3:16-18 refers to John chapter 3 verses 16 to 18

After a list separator it is possible to refer to additional verses. They are build analog to the first ones. This way it is possible to define each number of verse references. It is not possible to refer to verses in additional books.

  • John 3:16,18 refers to John chapter 3 verses 16 and 18
  • John 3:16-18,20 refers to John chapter 3 verses 16 to 18 and 20
  • John 3:16-18,4:1 refers to John chapter 3 verses 16 to 18 and chapter 4 verse 1

If there is a range separator without further verse declaration the last refered chapter is addressed until the end.

range_regex is a regular expression which matches for verse range declarations:

It starts with a optional chapter reference from_chapter followed by a verse separator.
The verse reference from_verse is manditory
(?P<range_to>%(sep_r)s(?: ... |%(sep_e)s)?)?
A range_to declaration is optional. It starts with a range separator and contains optional a chapter and verse declaration or a end separator.
The to_chapter reference with separator is equivalent to group 1.
The to_verse reference is equivalent to group 2.

The full reference is matched against get_reference_match(‘full’). This regular expression looks like this:

The book group starts with the first non-whitespace character. There are optional leading digits followed by non-digits. The group ends before the whitspace in front of the next digit.
The second group contains all ranges. This can be multiple declarations of range_regex separated by a list separator.

Updates separators and matches for parsing and formating scripture references.