forked from mars/tml
33 lines
730 B
Rust
33 lines
730 B
Rust
use std::str::FromStr;
|
|
use strum::EnumString;
|
|
|
|
pub mod dom;
|
|
pub mod layout;
|
|
pub mod parse;
|
|
pub mod style;
|
|
pub mod tag;
|
|
|
|
use style::Stylesheet;
|
|
|
|
fn main() {
|
|
let src_path = std::env::args().nth(1).unwrap();
|
|
let src = std::fs::read_to_string(src_path).unwrap();
|
|
let options =
|
|
lexpr::parse::Options::new().with_string_syntax(lexpr::parse::StringSyntax::Elisp);
|
|
let expr = lexpr::from_str_custom(&src, options).unwrap();
|
|
|
|
println!("{:#?}", expr);
|
|
|
|
let dom = parse::Parser::parse(&expr);
|
|
let style = Stylesheet::default();
|
|
let width = 40;
|
|
|
|
for tag in dom.tags.iter() {
|
|
for line in tag.layout(&style, width) {
|
|
println!("{}", line);
|
|
}
|
|
|
|
println!("");
|
|
}
|
|
}
|