#[allow(dead_code)]
#[derive(Debug, Clone)]
pub struct Section {
pub level: u8,
pub title: String,
pub body: String,
pub parent: Option<usize>,
pub children: Vec<usize>,
}
impl Section {
pub fn new() -> Section {
Section {
level: 0,
title: String::new(),
body: String::new(),
parent: None,
children: Vec::new(),
}
}
pub fn append_to_body(&mut self, line: String) {
self.body.push_str(&line);
self.body.push('\n');
}
pub fn add_child(&mut self, child: usize) {
self.children.push(child);
}
}
pub type Document = Vec<Section>;