use super::{Block, Inline};
#[derive(PartialEq, Eq, Clone, Debug)]
pub enum BlockType {
Plain,
Para,
LineBlock,
CodeBlock,
RawBlock,
BlockQuote,
OrderedList,
BulletList,
DefinitionList,
Header,
HorizontalRule,
Table,
Figure,
Div,
Null,
}
impl From<&Block> for BlockType {
fn from(block: &Block) -> Self {
match block {
Block::Plain(_) => Self::Plain,
Block::Para(_) => Self::Para,
Block::LineBlock(_) => Self::LineBlock,
Block::CodeBlock(_, _) => Self::CodeBlock,
Block::RawBlock(_, _) => Self::RawBlock,
Block::BlockQuote(_) => Self::BlockQuote,
Block::OrderedList(_, _) => Self::OrderedList,
Block::BulletList(_) => Self::BulletList,
Block::DefinitionList(_) => Self::DefinitionList,
Block::Header(_, _, _) => Self::Header,
Block::HorizontalRule => Self::HorizontalRule,
Block::Table(_) => Self::Table,
Block::Figure(_, _, _) => Self::Figure,
Block::Div(_, _) => Self::Div,
Block::Null => Self::Null,
}
}
}
#[derive(PartialEq, Eq, Clone, Debug)]
pub enum InlineType {
Str,
Emph,
Underline,
Strong,
Strikeout,
Superscript,
Subscript,
SmallCaps,
Quoted,
Cite,
Code,
Space,
SoftBreak,
LineBreak,
Math,
RawInline,
Link,
Image,
Note,
Span,
}
impl From<&Inline> for InlineType {
fn from(inline: &Inline) -> Self {
match inline {
Inline::Str(_) => Self::Str,
Inline::Emph(_) => Self::Emph,
Inline::Underline(_) => Self::Underline,
Inline::Strong(_) => Self::Strong,
Inline::Strikeout(_) => Self::Strikeout,
Inline::Superscript(_) => Self::Superscript,
Inline::Subscript(_) => Self::Subscript,
Inline::SmallCaps(_) => Self::SmallCaps,
Inline::Quoted(_, _) => Self::Quoted,
Inline::Cite(_, _) => Self::Cite,
Inline::Code(_, _) => Self::Code,
Inline::Space => Self::Space,
Inline::SoftBreak => Self::SoftBreak,
Inline::LineBreak => Self::LineBreak,
Inline::Math(_, _) => Self::Math,
Inline::RawInline(_, _) => Self::RawInline,
Inline::Link(_, _, _) => Self::Link,
Inline::Image(_, _, _) => Self::Image,
Inline::Note(_) => Self::Note,
Inline::Span(_, _) => Self::Span,
}
}
}