From 36fba448f15a2a58ee5aeb384f78967eb1a622ff Mon Sep 17 00:00:00 2001 From: HampusM Date: Thu, 2 Mar 2023 20:27:25 +0100 Subject: feat: add paragraph paragraph part support --- src/description.rs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/description.rs b/src/description.rs index e835751..3697673 100644 --- a/src/description.rs +++ b/src/description.rs @@ -259,6 +259,9 @@ pub enum ParagraphPart /// Informal table part. InformalTable(InformalTable), + + /// Paragraph part. + Paragraph(Paragraph), } impl FromElements for ParagraphPart @@ -294,7 +297,7 @@ impl ParagraphPart "inlineequation" => Self::InlineEquation, "programlisting" => Self::ProgramListing, "citerefentry" => Self::Entry, - "variablelist" | "itemizedlist" | "informaltable" => |_| { + "variablelist" | "itemizedlist" | "informaltable" | "para" => |_| { unreachable!(); }, _ => { @@ -351,6 +354,13 @@ impl ParagraphPart )); } + if tagged_element.name() == "para" { + return Ok(Self::Paragraph( + Paragraph::from_elements(tagged_element.child_elements()) + .map_err(|err| ParagraphPartError::InvalidParagraph(Box::new(err)))?, + )); + } + let text_element = tagged_element .child_elements() .get_first_text_element() @@ -391,4 +401,8 @@ pub enum ParagraphPartError /// Invalid informal table. #[error("Invalid informal table")] InvalidInformalTable(#[source] Box), + + /// Invalid paragraph. + #[error("Invalid paragraph")] + InvalidParagraph(#[source] Box), } -- cgit v1.2.3-18-g5258