pub mod chapter;
use std::fmt::Display;
use std::path::PathBuf;
use std::str::FromStr;
use std::sync::{Arc, RwLock};
use std::time::Instant;
pub use chapter::Chapter;
use getset::{Getters, MutGetters, Setters};
use thiserror::Error;
use log;
use rayon::prelude::*;
use crate::codex::Codex;
use crate::compiler::compilation_configuration::compilation_configuration_overlay::CompilationConfigurationOverLay;
use crate::compiler::compilation_configuration::CompilationConfiguration;
use crate::compiler::compilation_error::CompilationError;
use crate::output_format::OutputFormat;
use crate::resource::{Resource, ResourceError};
use self::chapter::paragraph::ParagraphError;
pub use self::chapter::Paragraph;
use self::chapter::chapter_builder::{ChapterBuilder, ChapterBuilderError};
#[derive(Error, Debug)]
pub enum DocumentError {
#[error(transparent)]
Load(#[from] ResourceError),
#[error(transparent)]
Compilation(#[from] CompilationError),
#[error(transparent)]
ChapterBuilderError(#[from] ChapterBuilderError),
#[error(transparent)]
ParagraphError(#[from] ParagraphError),
}
#[derive(Debug, Getters, MutGetters, Setters)]
pub struct Document {
#[getset(get = "pub", set = "pub")]
name: String,
#[getset(get = "pub", get_mut = "pub", set = "pub")]
preamble: Vec<Paragraph>,
#[getset(get = "pub", get_mut = "pub", set = "pub")]
chapters: Vec<Chapter>
}
impl Document {
pub fn new(name: String, preamble: Vec<Paragraph>, chapters: Vec<Chapter>) -> Self {
Self {
name,
preamble,
chapters
}
}
}