diff options
author | HampusM <hampus@hampusmat.com> | 2023-03-02 20:27:25 +0100 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2023-03-02 20:27:25 +0100 |
commit | 36fba448f15a2a58ee5aeb384f78967eb1a622ff (patch) | |
tree | 817e305519e93f1fc219338554f5c0915411db24 /src | |
parent | a67d1b5bc2f8669102c30081a966e7a1b60e3fbc (diff) |
feat: add paragraph paragraph part support
Diffstat (limited to 'src')
-rw-r--r-- | src/description.rs | 16 |
1 files changed, 15 insertions, 1 deletions
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<InformalTableError>), + + /// Invalid paragraph. + #[error("Invalid paragraph")] + InvalidParagraph(#[source] Box<ParagraphError>), } |