summaryrefslogtreecommitdiff
path: root/src/bin/subplot-filter.rs
blob: 6c012417423ddaf4583492babc51be3a14db141f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use anyhow::Result;
use std::io::{self, Read, Write};
use subplot::{Document, Style};

fn main() -> Result<()> {
    let mut buffer = String::new();
    let mut stdin = io::stdin();
    stdin.read_to_string(&mut buffer)?;
    let basedir = std::path::Path::new(".");
    let style = Style::default();
    let mut doc = Document::from_json(&basedir, vec![], &buffer, style, None)?;
    doc.typeset();
    let bytes = doc.ast()?.into_bytes();
    io::stdout().write_all(&bytes)?;
    Ok(())
}