letterbox/server/src/bin/cleanhtml.rs

17 lines
467 B
Rust

use std::fs;
use letterbox_server::sanitize_html;
fn main() -> anyhow::Result<()> {
let mut args = std::env::args().skip(1);
let src = args.next().expect("source not specified");
let dst = args.next().expect("destination not specified");
println!("Sanitizing {src} into {dst}");
let bytes = fs::read(src)?;
let html = String::from_utf8_lossy(&bytes);
let html = sanitize_html(&html, "", &None)?;
fs::write(dst, html)?;
Ok(())
}