diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/description.rs | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/src/description.rs b/src/description.rs index 3697673..e6cd1cd 100644 --- a/src/description.rs +++ b/src/description.rs @@ -262,6 +262,9 @@ pub enum ParagraphPart /// Paragraph part. Paragraph(Paragraph), + + /// Footnote part. + Footnote(Paragraph), } impl FromElements for ParagraphPart @@ -297,9 +300,11 @@ impl ParagraphPart "inlineequation" => Self::InlineEquation, "programlisting" => Self::ProgramListing, "citerefentry" => Self::Entry, - "variablelist" | "itemizedlist" | "informaltable" | "para" => |_| { - unreachable!(); - }, + "variablelist" | "itemizedlist" | "informaltable" | "para" | "footnote" => { + |_| { + unreachable!(); + } + } _ => { return Err(<Self as FromElements>::Error::UnknownPart( tagged_element.name().to_string(), @@ -361,6 +366,13 @@ impl ParagraphPart )); } + if tagged_element.name() == "footnote" { + return Ok(Self::Footnote( + Paragraph::from_elements(tagged_element.child_elements()) + .map_err(|err| ParagraphPartError::InvalidFootnote(Box::new(err)))?, + )); + } + let text_element = tagged_element .child_elements() .get_first_text_element() @@ -405,4 +417,8 @@ pub enum ParagraphPartError /// Invalid paragraph. #[error("Invalid paragraph")] InvalidParagraph(#[source] Box<ParagraphError>), + + /// Invalid footnote. + #[error("Invalid footnote")] + InvalidFootnote(#[source] Box<ParagraphError>), } |