pub mod replacement_rule_paragraph;
pub mod table_paragraph;
pub mod list_paragraph;
pub mod image_paragraph;
pub mod block_quote_paragraph;
pub mod focus_block_paragraph;
pub mod metadata_wrapper_paragraph;
pub mod common_paragraph;
pub mod paragraph_loading_rule;
use std::fmt::Display;
use thiserror::Error;
use crate::{compilation::compilable::Compilable, utility::nmd_unique_identifier::NmdUniqueIdentifier};
#[derive(Error, Debug)]
pub enum ParagraphError {
#[error("creation error")]
Creation,
#[error("empty content")]
Empty
}
pub type ParagraphType = String;
pub trait Paragraph: std::fmt::Debug + Compilable + Sync + Send {
fn raw_content(&self) -> &String;
fn set_raw_content(&mut self, raw_content: String);
fn nuid(&self) -> Option<&NmdUniqueIdentifier>;
fn set_nuid(&mut self, nuid: Option<NmdUniqueIdentifier>);
fn is_empty(&self) -> bool {
self.raw_content().chars().all(|c| c.is_control() || c.is_whitespace())
}
}
impl Display for dyn Paragraph {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}", self.raw_content())
}
}