website-risg/src/main.rs
philipp 5dcc5a6e8d
Some checks failed
CI/CD Pipeline / test (push) Failing after 5s
initial push
2024-02-16 12:13:24 +01:00

28 lines
679 B
Rust

use risp::law::{Heading, HeadingContent, Law};
fn print_header(header: Heading, level: usize) {
let mut header_title = header.name.clone();
if let Some(desc) = header.desc {
header_title.push_str(&format!(" ({desc})"))
}
println!("{} {header_title}", " ".repeat(level));
match header.content {
HeadingContent::Paragraph(p) => {}
HeadingContent::Heading(subheaders) => {
for subheader in subheaders {
print_header(subheader, level + 1);
}
}
}
}
fn main() {
let law = Law::from_config("data/abgb.toml").unwrap();
for h in law.header {
print_header(h, 0);
}
}