pub struct Prepyrus {}Expand description
Main API interface for the Prepyrus tool. It contains methods for building the configuration, retrieving bibliography entries, retrieving MDX file paths, verifying MDX files, and processing MDX files. There is an intended usage of these methods, but you are free to mix and match as you like.
Implementations§
Source§impl Prepyrus
impl Prepyrus
pub fn parse_cli() -> Cli
Sourcepub fn build_config(
cli: Cli,
test_mode: Option<LoadOrCreateSettingsTestMode>,
) -> Result<Config, &'static str>
pub fn build_config( cli: Cli, test_mode: Option<LoadOrCreateSettingsTestMode>, ) -> Result<Config, &'static str>
Build a configuration object from the command line arguments.
- The first argument is the program index.
- The second argument is the path to the bibliography file.
- The third argument is the target path (directory or file).
- The fourth argument is the mode (“verify” or “process”).
- The fifth argument is the optional ignore paths (separate with commas if multiple).
- Optionally, a test mode can be passed to simulate the creation of a settings file.
Sourcepub fn get_all_bib_entries(
bib_file: &str,
) -> Result<Vec<Entry>, BibliographyError>
pub fn get_all_bib_entries( bib_file: &str, ) -> Result<Vec<Entry>, BibliographyError>
Retrieve all bibliography entries from the bibliography file.
Returns a vector of biblatex::Entry.
Sourcepub fn get_mdx_paths(
target_path: &str,
ignore_paths: Option<Vec<String>>,
) -> Result<Vec<String>, Box<dyn Error>>
pub fn get_mdx_paths( target_path: &str, ignore_paths: Option<Vec<String>>, ) -> Result<Vec<String>, Box<dyn Error>>
Retrieve all MDX file paths from the target directory. Optionally, ignore paths can be passed to exclude certain paths.
Sourcepub fn verify(
mdx_paths: Vec<String>,
all_entries: &Vec<Entry>,
) -> Result<Vec<ArticleFileData>, Error>
pub fn verify( mdx_paths: Vec<String>, all_entries: &Vec<Entry>, ) -> Result<Vec<ArticleFileData>, Error>
Verify the MDX files and their citations and match them against the bibliography entries. Will throw if any of these fail.
Sourcepub fn process(all_articles: Vec<ArticleFileData>)
pub fn process(all_articles: Vec<ArticleFileData>)
Process the MDX files by injecting bibliography and other details into the MDX files.
pub fn gen_index_to_file( all_articles: Vec<ArticleFileData>, index_file_path: String, rewrite: Option<&(String, String)>, )
Auto Trait Implementations§
impl Freeze for Prepyrus
impl RefUnwindSafe for Prepyrus
impl Send for Prepyrus
impl Sync for Prepyrus
impl Unpin for Prepyrus
impl UnwindSafe for Prepyrus
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more