writings
The Bahá’í Sacred Writings for use in Rust projects and APIs.
Source
All of the Writings are downloaded directly from https://www.bahai.org/library.
The downloaded HTML is included in the html folder.
Structure
Each type of Writings has its own struct, e.g. HiddenWord, PrayerParagraph,
and GleaningsParagraph, which are hopefully explanatory of the unit the struct
represents. In this way, an excerpt from the Writings can be precisely referenced.
The ref_id in each struct represents the exact reference ID at which the struct
points to at https://www.bahai.org/r/`ref_id`. For example, Persian Hidden Word #3
can be accessed directly at https://www.bahai.org/r/607855955. Hence, its struct
will have ref_id == "607855955". This is a String, not a u32 or other
integer type, because www.bahai.org currently requires leading zeroes, and to ensure
future compatibility, it is not assumed integers of a fixed length will always be used.
The text field of each struct is the exact plain text as extracted from the downloaded HTML.
Other fields of each struct have their own documentation, depending on the type.
Usage
Embed All
When ::all() is invoked on one of the structs implementing the EmbedAllTrait,
the HTML for that Work is parsed into the relevant structs once (very fast)
and stored in a LazyLock<T>.
Example: Hidden Words
use ;
let hw = all
.iter
.find
.cloned
.unwrap;
assert_eq!;
Example: Gleanings
use ;
let gleanings = all
.iter
.filter
.cloned
.;
assert_eq!;
let results = gleanings.iter.map.;
assert_eq!;
assert!;
Example: Prayers
use ;
let prayer = all
.iter
.find
.cloned
.unwrap;
assert_eq!;
Languages
Currently, only English is available in this crate. If reliable authoritative sources can be found for other languages, it is hoped they will be added. عربي (Arabic) and فارسی (Farsi / Persian) will be added if there is demand and someone versed in these languages can help ensure the accuracy of the implementation.
TODO: More docs...
License: MIT AND Bahá’í International Community License