website-risg/src/main.rs

28 lines
679 B
Rust
Raw Normal View History

2024-02-16 12:13:24 +01:00
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);
}
}