summaryrefslogtreecommitdiffstats
path: root/src/pandoc/types.rs
blob: dc5be6446da89484b923ea0e265ccc8e3f1a4d20 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
use crate::pandoc::{Block, Inline};

#[derive(Debug, Clone)]
pub(super) struct Class {
    inners: Vec<Inner>,
}

#[derive(Debug, Clone)]
struct Inner {
    kind: InnerKind,
    name: String,
    //refid: String
}

#[derive(Debug, Clone)]
enum InnerKind {
    Class,
    Enum,
}

impl std::fmt::Display for InnerKind {
    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
        match self {
            InnerKind::Class => write!(f, "class"),
            InnerKind::Enum => write!(f, "enum"),
        }
    }
}

impl From<Inner> for (Vec<Inline>, Vec<Vec<Block>>) {
    fn from(inner: Inner) -> (Vec<Inline>, Vec<Vec<Block>>) {
        (
            vec![Inline::Str(inner.name)],
            vec![vec![Block::Plain(vec![Inline::Str(
                inner.kind.to_string(),
            )])]],
        )
    }
}