blob: be49d663e161de1dafc7a8f7b61322f678847e35 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
use std::path::PathBuf;
use pandoc_ast::{Inline, MutVisitor};
pub struct ImageVisitor {
images: Vec<PathBuf>,
}
impl ImageVisitor {
pub fn new() -> Self {
ImageVisitor { images: vec![] }
}
pub fn images(&self) -> Vec<PathBuf> {
self.images.clone()
}
}
impl MutVisitor for ImageVisitor {
fn visit_inline(&mut self, inline: &mut Inline) {
if let Inline::Image(_attr, _inlines, target) = inline {
self.images.push(PathBuf::from(&target.0));
}
}
}
|