diff options
Diffstat (limited to 'src/visitor/typesetting.rs')
-rw-r--r-- | src/visitor/typesetting.rs | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/src/visitor/typesetting.rs b/src/visitor/typesetting.rs index e29a434..6f82c24 100644 --- a/src/visitor/typesetting.rs +++ b/src/visitor/typesetting.rs @@ -1,6 +1,6 @@ use crate::panhelper; use crate::typeset; -use crate::{Bindings, Style}; +use crate::{Bindings, Style, Warnings}; use pandoc_ast::{Block, Inline, MutVisitor}; @@ -10,11 +10,20 @@ use pandoc_ast::{Block, Inline, MutVisitor}; pub struct TypesettingVisitor<'a> { style: Style, bindings: &'a Bindings, + warnings: Warnings, } impl<'a> TypesettingVisitor<'a> { pub fn new(style: Style, bindings: &'a Bindings) -> Self { - TypesettingVisitor { style, bindings } + TypesettingVisitor { + style, + bindings, + warnings: Warnings::default(), + } + } + + pub fn warnings(self) -> Warnings { + self.warnings } } @@ -30,15 +39,15 @@ impl<'a> MutVisitor for TypesettingVisitor<'a> { match block { Block::CodeBlock(attr, s) => { if is_class(attr, "scenario") { - *block = typeset::scenario_snippet(self.bindings, s) + *block = typeset::scenario_snippet(self.bindings, s, &mut self.warnings) } else if is_class(attr, "file") { *block = typeset::file_block(attr, s) } else if is_class(attr, "dot") { - *block = typeset::dot_to_block(s) + *block = typeset::dot_to_block(s, &mut self.warnings) } else if is_class(attr, "plantuml") { - *block = typeset::plantuml_to_block(s) + *block = typeset::plantuml_to_block(s, &mut self.warnings) } else if is_class(attr, "roadmap") { - *block = typeset::roadmap_to_block(s) + *block = typeset::roadmap_to_block(s, &mut self.warnings) } else if is_class(attr, "pikchr") { let other_classes: Vec<_> = attr .1 @@ -52,7 +61,7 @@ impl<'a> MutVisitor for TypesettingVisitor<'a> { Some(other_classes.join(" ")) }; let class = class.as_deref(); - *block = typeset::pikchr_to_block(s, class) + *block = typeset::pikchr_to_block(s, class, &mut self.warnings) } } _ => { |