diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/diagrams.rs (renamed from src/graphmarkup.rs) | 16 | ||||
-rw-r--r-- | src/lib.rs | 4 | ||||
-rw-r--r-- | src/typeset.rs | 20 | ||||
-rw-r--r-- | src/visitor/typesetting.rs | 4 |
4 files changed, 22 insertions, 22 deletions
diff --git a/src/graphmarkup.rs b/src/diagrams.rs index dc0a37e..96f5d70 100644 --- a/src/graphmarkup.rs +++ b/src/diagrams.rs @@ -60,7 +60,7 @@ lazy_static! { static ref JAVA_PATH: Mutex<PathBuf> = Mutex::new(env!("BUILTIN_JAVA_PATH").into()); } -/// A code block with markup for a graph. +/// A code block with markup for a diagram. /// /// The code block will be converted to an SVG image using an external /// filter such as Graphviz dot or plantuml. SVG is the chosen image @@ -70,7 +70,7 @@ lazy_static! { /// This trait defines the interface for different kinds of markup /// conversions. There's only one function that needs to be defined /// for the trait. -pub trait GraphMarkup { +pub trait DiagramMarkup { /// Convert the markup into an SVG. fn as_svg(&self) -> Result<Vec<u8>>; } @@ -78,7 +78,7 @@ pub trait GraphMarkup { /// A code block with pikchr markup. /// /// ~~~~ -/// use subplot::{GraphMarkup, PikchrMarkup}; +/// use subplot::{DiagramMarkup, PikchrMarkup}; /// let markup = r#"line; box "Hello," "World!"; arrow"#; /// let svg = PikchrMarkup::new(markup, None).as_svg().unwrap(); /// assert!(svg.len() > 0); @@ -98,7 +98,7 @@ impl PikchrMarkup { } } -impl GraphMarkup for PikchrMarkup { +impl DiagramMarkup for PikchrMarkup { fn as_svg(&self) -> Result<Vec<u8>> { let mut flags = pikchr::PikchrFlags::default(); flags.generate_plain_errors(); @@ -111,7 +111,7 @@ impl GraphMarkup for PikchrMarkup { /// A code block with Dot markup. /// /// ~~~~ -/// use subplot::{GraphMarkup, DotMarkup}; +/// use subplot::{DiagramMarkup, DotMarkup}; /// let markup = r#"digraph "foo" { a -> b }"#; /// let svg = DotMarkup::new(&markup).as_svg().unwrap(); /// assert!(svg.len() > 0); @@ -129,7 +129,7 @@ impl DotMarkup { } } -impl GraphMarkup for DotMarkup { +impl DiagramMarkup for DotMarkup { fn as_svg(&self) -> Result<Vec<u8>> { let mut child = Command::new(DOT_PATH.lock().unwrap().clone()) .arg("-Tsvg") @@ -154,7 +154,7 @@ impl GraphMarkup for DotMarkup { /// A code block with PlantUML markup. /// /// ~~~~ -/// use subplot::{GraphMarkup, PlantumlMarkup}; +/// use subplot::{DiagramMarkup, PlantumlMarkup}; /// let markup = "@startuml\nAlice -> Bob\n@enduml"; /// let svg = PlantumlMarkup::new(&markup).as_svg().unwrap(); /// assert!(svg.len() > 0); @@ -190,7 +190,7 @@ impl PlantumlMarkup { // Acquire path to JAR for pandoc } -impl GraphMarkup for PlantumlMarkup { +impl DiagramMarkup for PlantumlMarkup { fn as_svg(&self) -> Result<Vec<u8>> { let mut cmd = Command::new(JAVA_PATH.lock().unwrap().clone()); cmd.arg("-Djava.awt.headless=true") @@ -21,8 +21,8 @@ pub use error::Warnings; pub mod resource; -mod graphmarkup; -pub use graphmarkup::{DotMarkup, GraphMarkup, MarkupOpts, PikchrMarkup, PlantumlMarkup}; +mod diagrams; +pub use diagrams::{DiagramMarkup, DotMarkup, MarkupOpts, PikchrMarkup, PlantumlMarkup}; mod datafiles; pub use datafiles::DataFile; diff --git a/src/typeset.rs b/src/typeset.rs index bc86ef8..18e5a44 100644 --- a/src/typeset.rs +++ b/src/typeset.rs @@ -4,7 +4,7 @@ use crate::PartialStep; use crate::ScenarioStep; use crate::StepKind; use crate::SubplotError; -use crate::{DotMarkup, GraphMarkup, PikchrMarkup, PlantumlMarkup}; +use crate::{DiagramMarkup, DotMarkup, PikchrMarkup, PlantumlMarkup}; use crate::{Warning, Warnings}; use pandoc_ast::Attr; @@ -147,10 +147,10 @@ pub fn link_as_note(attr: Attr, text: Vec<Inline>, target: Target) -> Inline { Inline::Span(attr, text) } -/// Take a pikchr graph, render it as SVG, and return an AST block element. +/// Take a pikchr diagram, render it as SVG, and return an AST block element. /// -/// The `Block` will contain the SVG data. This allows the graph to be -/// rendered without referencing external entities. +/// The `Block` will contain the SVG data. This allows the diagram to +/// be rendered without referencing external entities. /// /// If the code block which contained the pikchr contains other classes, they /// can be added to the SVG for use in later typesetting etc. @@ -164,9 +164,9 @@ pub fn pikchr_to_block(pikchr: &str, class: Option<&str>, warnings: &mut Warning } } -// Take a dot graph, render it as SVG, and return an AST Block -// element. The Block will contain the SVG data. This allows the graph -// to be rendered without referending external entities. +// Take a dot diagram, render it as SVG, and return an AST Block +// element. The Block will contain the SVG data. This allows the +// diagram to be rendered without referending external entities. pub fn dot_to_block(dot: &str, warnings: &mut Warnings) -> Block { match DotMarkup::new(dot).as_svg() { Ok(svg) => typeset_svg(svg), @@ -177,9 +177,9 @@ pub fn dot_to_block(dot: &str, warnings: &mut Warnings) -> Block { } } -// Take a PlantUML graph, render it as SVG, and return an AST Block -// element. The Block will contain the SVG data. This allows the graph -// to be rendered without referending external entities. +// Take a PlantUML diagram, render it as SVG, and return an AST Block +// element. The Block will contain the SVG data. This allows the +// diagram to be rendered without referending external entities. pub fn plantuml_to_block(markup: &str, warnings: &mut Warnings) -> Block { match PlantumlMarkup::new(markup).as_svg() { Ok(svg) => typeset_svg(svg), diff --git a/src/visitor/typesetting.rs b/src/visitor/typesetting.rs index 6f82c24..8d73f3e 100644 --- a/src/visitor/typesetting.rs +++ b/src/visitor/typesetting.rs @@ -30,8 +30,8 @@ impl<'a> TypesettingVisitor<'a> { // Visit interesting parts of the Pandoc abstract syntax tree. The // document top level is a vector of blocks and we visit that and // replace any fenced code block with the scenario tag with a typeset -// paragraph. Also, replace fenced code blocks with known graph markup -// with the rendered SVG image. +// paragraph. Also, replace fenced code blocks with known diagram +// markup with the rendered SVG image. impl<'a> MutVisitor for TypesettingVisitor<'a> { fn visit_vec_block(&mut self, vec_block: &mut Vec<Block>) { use panhelper::is_class; |