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
// Copyright 2018 Fredrik Portström <https://portstrom.com>
// This is free software distributed under the terms specified in
// the file LICENSE at the top-level directory of this distribution.
pub fn parse_details<'a>(
context: &mut ::Context<'a>,
list_node: &::Node,
list_items: &[::ListItem<'a>],
output: &mut Option<Vec<Vec<::Flowing<'a>>>>,
) {
*output = Some(if output.is_some() {
::add_warning(context, list_node, ::WarningMessage::Duplicate);
vec![]
} else {
list_items
.iter()
.filter_map(|item| {
if item.nodes.is_empty() {
::add_warning(context, item, ::WarningMessage::Empty);
None
} else {
Some(
item.nodes
.iter()
.map(|node| match node {
::Node::Italic { .. } => ::Flowing::Italic,
::Node::Link { target, text, .. } => {
::parse_link(context, node, target, text)
}
::Node::Text { value, .. } => ::Flowing::Text {
value: ::Cow::Borrowed(value),
},
_ => ::create_unknown(context, node),
})
.collect(),
)
}
})
.collect()
});
}