Prepyrus

Struct Prepyrus 

Source
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

Source

pub fn parse_cli() -> Cli

Source

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.
Source

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.

Source

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.

Source

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.

Source

pub fn process(all_articles: Vec<ArticleFileData>)

Process the MDX files by injecting bibliography and other details into the MDX files.

Source

pub fn gen_index_to_file( all_articles: Vec<ArticleFileData>, index_file_path: String, rewrite: Option<&(String, String)>, )

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.