flatiron 1.0.5

A parser and HTML renderer for the Textile markup language
Documentation
#[derive(Debug, PartialEq)]
pub struct Textile(pub Vec<BlockTag>);

#[derive(Debug, PartialEq)]
pub enum BlockTag {
    Basic {
        kind: BlockKind,
        header: BlockHeader,
        content: InlineTag,
    },
    Preformatted {
        kind: BlockKind,
        header: BlockHeader,
        content: String,
    },
    List {
        header: BlockHeader,
        content: List,
    },
    Table {
        header: BlockHeader,
        rows: Vec<TableRow>,
    },
    NoTextile(String),
}

#[derive(Debug, PartialEq, Clone, Copy)]
pub enum BlockKind {
    Paragraph,
    NoTextile,
    BlockQuote,
    BlockCode,
    Preformatted,
    Header(usize),
    Footnote(usize),
}

#[derive(Debug, PartialEq)]
pub struct BlockHeader {
    pub attributes: Option<Attributes>,
    pub indent: Option<Indent>,
    pub align: Option<Align>,
}

#[derive(Debug, PartialEq)]
pub struct List {
    pub kind: ListKind,
    pub items: Vec<ListItem>,
}

#[derive(Debug, PartialEq)]
pub struct ListItem {
    pub content: InlineTag,
    pub sublist: Option<List>,
}

#[derive(Debug, PartialEq, Clone, Copy)]
pub enum ListKind {
    Numeric,
    Bulleted,
}

#[derive(Debug, PartialEq)]
pub struct TableRow {
    pub header: TableHeader,
    pub cells: Vec<TableCell>,
}

#[derive(Debug, PartialEq)]
pub struct TableHeader {
    pub attributes: Option<Attributes>,
    pub h_align: Option<Align>,
    pub v_align: Option<VerticalAlign>,
}

#[derive(Debug, PartialEq)]
pub struct TableCell {
    pub kind: CellKind,
    pub col_span: Option<usize>,
    pub row_span: Option<usize>,
    pub header: TableHeader,
    pub content: InlineTag,
}

#[derive(Debug, PartialEq, Clone, Copy)]
pub enum CellKind {
    Header,
    Data,
}

#[derive(Debug, PartialEq, Clone)]
pub struct Indent {
    pub left: usize,
    pub right: usize,
}

#[derive(Debug, PartialEq, Clone, Copy)]
pub enum Align {
    Left,
    Right,
    Center,
    Justify,
}

#[derive(Debug, PartialEq, Clone, Copy)]
pub enum VerticalAlign {
    Top,
    Middle,
    Bottom,
}

#[derive(Debug, PartialEq, Clone)]
pub struct Attributes {
    pub class: Option<String>,
    pub id: Option<String>,
    pub style: Option<String>,
    pub language: Option<String>,
}

#[derive(Debug, PartialEq)]
pub enum InlineTag {
    Plaintext(String),
    NoTextile(String),
    Code(String),
    FootnoteRef(usize),
    LineBreak,
    Image {
        header: ImageHeader,
        url: String,
        alt: Option<String>,
    },
    Acronym {
        title: Option<String>,
        content: String,
    },
    Link {
        attributes: Option<Attributes>,
        title: Option<String>,
        url: String,
        content: Box<InlineTag>,
    },
    Phrase {
        kind: Option<PhraseKind>,
        attributes: Option<Attributes>,
        content: Vec<InlineTag>,
    },
}

#[derive(Debug, PartialEq)]
pub struct ImageHeader {
    pub attributes: Option<Attributes>,
    pub align: Option<ImageAlign>,
}

#[derive(Debug, PartialEq, Clone, Copy)]
pub enum ImageAlign {
    Left,
    Right,
    Center,
}

#[derive(Debug, PartialEq, Clone, Copy)]
pub enum PhraseKind {
    Italic,
    Bold,
    Emphasis,
    Strong,
    Citation,
    Deleted,
    Inserted,
    Superscript,
    Subscript,
    Span,
}