diff options
author | Minijackson <minijackson@riseup.net> | 2019-09-08 16:15:46 +0200 |
---|---|---|
committer | Minijackson <minijackson@riseup.net> | 2019-11-10 16:37:59 +0100 |
commit | 3301430c676e4af6b95d96b6408a66f9d2768653 (patch) | |
tree | 12810ce81a3b1d3cb23270fc5119016d5f6c325a /src/pandoc | |
download | poseidoc-3301430c676e4af6b95d96b6408a66f9d2768653.tar.gz poseidoc-3301430c676e4af6b95d96b6408a66f9d2768653.zip |
First version
Diffstat (limited to 'src/pandoc')
-rw-r--r-- | src/pandoc/types.rs | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/src/pandoc/types.rs b/src/pandoc/types.rs new file mode 100644 index 0000000..dc5be64 --- /dev/null +++ b/src/pandoc/types.rs | |||
@@ -0,0 +1,39 @@ | |||
1 | use crate::pandoc::{Block, Inline}; | ||
2 | |||
3 | #[derive(Debug, Clone)] | ||
4 | pub(super) struct Class { | ||
5 | inners: Vec<Inner>, | ||
6 | } | ||
7 | |||
8 | #[derive(Debug, Clone)] | ||
9 | struct Inner { | ||
10 | kind: InnerKind, | ||
11 | name: String, | ||
12 | //refid: String | ||
13 | } | ||
14 | |||
15 | #[derive(Debug, Clone)] | ||
16 | enum InnerKind { | ||
17 | Class, | ||
18 | Enum, | ||
19 | } | ||
20 | |||
21 | impl std::fmt::Display for InnerKind { | ||
22 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
23 | match self { | ||
24 | InnerKind::Class => write!(f, "class"), | ||
25 | InnerKind::Enum => write!(f, "enum"), | ||
26 | } | ||
27 | } | ||
28 | } | ||
29 | |||
30 | impl From<Inner> for (Vec<Inline>, Vec<Vec<Block>>) { | ||
31 | fn from(inner: Inner) -> (Vec<Inline>, Vec<Vec<Block>>) { | ||
32 | ( | ||
33 | vec![Inline::Str(inner.name)], | ||
34 | vec![vec![Block::Plain(vec![Inline::Str( | ||
35 | inner.kind.to_string(), | ||
36 | )])]], | ||
37 | ) | ||
38 | } | ||
39 | } | ||