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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
use super::segments::Segment;
#[derive(Debug, Clone, PartialEq)]
pub enum Macro<'a> {
HtmlAttrs(Vec<Attr<'a>>),
Loose,
ListStyle(String),
Toc,
NoToc,
NoText,
Footnotes(Vec<Footnote<'a>>),
MathScript,
Blank,
Config,
Include(&'a str),
Invalid,
}
impl Macro<'_> {
pub fn is_for_list(&self) -> bool {
matches!(self, Macro::Loose | Macro::ListStyle(_))
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct Attr<'a> {
pub key: &'a str,
pub value: Option<AttrValue<'a>>,
}
#[derive(Debug, Clone, PartialEq)]
pub enum AttrValue<'a> {
Word(&'a str),
QuotedWord(String),
}
#[derive(Debug, Clone, PartialEq)]
pub struct Footnote<'a> {
pub num: u32,
pub text: Vec<Segment<'a>>,
}