bible-reference-rs

Crates.iobible-reference-rs
lib.rsbible-reference-rs
version0.1.3
sourcesrc
created_at2018-10-22 13:58:19.544029
updated_at2019-03-28 19:12:55.868428
descriptionExtract Bible references from plain text
homepage
repositoryhttps://github.com/avdyushin/bible-reference-rs.git
max_upload_size
id91982
size23,463
Grigory Avdyushin (avdyushin)

documentation

README

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.

Commit count: 8

cargo fmt