28 lines
679 B
Rust
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);
|
|
}
|
|
}
|