teacat_lib 0.5.2

Tools for working with TeaCat files
Documentation
use crate::{
	Moo,
	parser::{Attributes, MarkupType},
};

#[derive(Debug, PartialEq, Clone, Default)]
pub struct TeaCatDom<'input>(pub Vec<DomNode<'input>>);

#[derive(Debug, PartialEq, Clone)]
pub enum DomNode<'input> {
	Space,
	Word(Moo<'input>),
	Tag(DomTag<'input>),
	ContentBlock(TeaCatDom<'input>),
	Markup {
		of: MarkupType,
		inner: TeaCatDom<'input>,
	},
}

#[derive(Debug, PartialEq, Clone)]
pub struct DomTag<'input> {
	pub name: Moo<'input>,
	pub attrs: Attributes<'input>,
	pub content: TeaCatDom<'input>,
}

impl<'input> TeaCatDom<'input> {
	pub fn push(&mut self, node: DomNode<'input>) {
		self.0.push(node);
	}

	pub fn append(&mut self, mut other: Self) {
		self.0.append(&mut other.0);
	}
}