Function pandoc_ast::filter

source ·
pub fn filter<F: FnOnce(Pandoc) -> Pandoc>(json: String, f: F) -> String
Expand description

deserialized a json string to a Pandoc object, passes it to the closure/function and serializes the result back into a string

Examples found in repository?
examples/removenotes.rs (lines 21-24)
18
19
20
21
22
23
24
25
26
fn main() {
    let mut s = String::new();
    io::stdin().read_to_string(&mut s).unwrap();
    let s = pandoc_ast::filter(s, |mut pandoc| {
        MyVisitor.walk_pandoc(&mut pandoc);
        pandoc
    });
    io::stdout().write(s.as_bytes()).unwrap();
}
More examples
Hide additional examples
examples/uppercase.rs (lines 21-24)
18
19
20
21
22
23
24
25
26
fn main() {
    let mut s = String::new();
    io::stdin().read_to_string(&mut s).unwrap();
    let s = pandoc_ast::filter(s, |mut pandoc| {
        MyVisitor.walk_pandoc(&mut pandoc);
        pandoc
    });
    io::stdout().write(s.as_bytes()).unwrap();
}