Struct DiagramFilter

Source
pub struct DiagramFilter { /* private fields */ }
Expand description

Convert inline diagram markup as images for Pandoc.

This acts a filter on the Pandoc Abstract Syntax Tree (AST), to modify it so that any inline markup for diagrams are rendered as SVG images. The library is meant to be used with the pandoc_ast::filter function.

Filtering may fail. Because of the API constrain imposed by pandoc_ast::filter, this library doesn’t return a Result. Instead, it collects any errors and lets the caller query for them after the filtering is done (see the errors method). All errors are always rendered as text in the document as well, but that requires a human to read the document to spot any errors.

Implementations§

Source§

impl DiagramFilter

Source

pub fn new() -> Self

Create a new filter.

Source

pub fn filter(&mut self, doc: Pandoc) -> Pandoc

Process a parsed document to convert inline diagram markup into SVG. This method is suitable to be passed to pandoc_ast::filter as the filter function argument.

Source

pub fn errors(&self) -> &[DiagramError]

Return any errors that occurred during the filtering process. The caller can decide how to report them to the user in a suitable way.

Source

pub fn dot_path<P>(&mut self, path: P) -> &mut Self
where P: AsRef<Path>,

Set the name by which to invoke Graphviz dot program. The default is “dot”.

Source

pub fn java_path<P>(&mut self, path: P) -> &mut Self
where P: AsRef<Path>,

Set the name by which to invoke the Java runtime, for PlantUML. The default is “java”.

Source

pub fn plantuml_jar<P>(&mut self, path: P) -> &mut Self
where P: AsRef<Path>,

Set the location of the PlantUML jar (Java bytecode archive). The default is “/usr/share/plantuml/plantuml.jar”.

Source

pub fn roadmap_width(&mut self, w: usize) -> &mut Self

Set the maximum width, in characters, of the roadmap text nodes. The default is 50.

Trait Implementations§

Source§

impl Debug for DiagramFilter

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for DiagramFilter

Source§

fn default() -> Self

Create a filter with default settings.

Source§

impl MutVisitor for DiagramFilter

Source§

fn visit_block(&mut self, block: &mut Block)

Source§

fn visit_attr( &mut self, attr: &mut (String, Vec<String>, Vec<(String, String)>), )

Source§

fn visit_inline(&mut self, inline: &mut Inline)

Source§

fn visit_meta(&mut self, _key: &str, meta: &mut MetaValue)

Source§

fn visit_vec_block(&mut self, vec_block: &mut Vec<Block>)

Source§

fn visit_vec_inline(&mut self, vec_inline: &mut Vec<Inline>)

Source§

fn visit_rows( &mut self, rows: &mut Vec<((String, Vec<String>, Vec<(String, String)>), Vec<((String, Vec<String>, Vec<(String, String)>), Alignment, i64, i64, Vec<Block>)>)>, )

Source§

fn walk_meta(&mut self, meta: &mut MetaValue)

Source§

fn walk_pandoc(&mut self, pandoc: &mut Pandoc)

Source§

fn walk_block(&mut self, block: &mut Block)

Source§

fn walk_attr( &mut self, _attr: &mut (String, Vec<String>, Vec<(String, String)>), )

Source§

fn walk_inline(&mut self, inline: &mut Inline)

Source§

fn walk_rows( &mut self, rows: &mut Vec<((String, Vec<String>, Vec<(String, String)>), Vec<((String, Vec<String>, Vec<(String, String)>), Alignment, i64, i64, Vec<Block>)>)>, )

Source§

fn walk_vec_block(&mut self, vec_block: &mut Vec<Block>)

Source§

fn walk_vec_inline(&mut self, vec_inline: &mut Vec<Inline>)

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