4 releases

Uses old Rust 2015

0.1.3 Mar 28, 2019
0.1.2 Nov 5, 2018
0.1.1 Oct 31, 2018
0.1.0 Oct 22, 2018

#1536 in Text processing

Apache-2.0

12KB
205 lines

Bible Reference Parser

Extract Bible references from plain text in Rust.

Build Status Crates.io

Usage

let refs = parse(
    "Daily readings are Быт 1;\
     Исх 1:2,4;\
     1 Пет 1-4, 5.\
     Also take a look in:
     Rev 2,4;\
     John 1:2-4,7\
     Gen 1:1-2 2:2,5",
);
println!(refs);

Output:

[
    BibleReference {
        book: "Быт",
        locations: [VerseLocation { chapters: [1], verses: None }]
    },
    BibleReference {
        book: "Исх",
        locations: [VerseLocation { chapters: [1], verses: Some([2, 4]) }]
    },
    BibleReference {
        book: "1 Пет",
        locations: [VerseLocation { chapters: [1, 2, 3, 4, 5], verses: None }]
    },
    BibleReference {
        book: "Rev",
        locations: [VerseLocation { chapters: [2, 4], verses: None }]
    },
    BibleReference {
        book: "John",
        locations: [VerseLocation { chapters: [1], verses: Some([2, 3, 4, 7]) }]
    },
    BibleReference {
        book: "Gen",
        locations: [
            VerseLocation { chapters: [1], verses: Some([1, 2]) },
            VerseLocation { chapters: [2], verses: Some([2, 5]) }
        ]
    }
]

Notes

This library only parses references without validation of the book name because it's different in each language.

Dependencies

~2–3MB
~54K SLoC