summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2023-03-02 20:27:25 +0100
committerHampusM <hampus@hampusmat.com>2023-03-02 20:27:25 +0100
commit36fba448f15a2a58ee5aeb384f78967eb1a622ff (patch)
tree817e305519e93f1fc219338554f5c0915411db24
parenta67d1b5bc2f8669102c30081a966e7a1b60e3fbc (diff)
feat: add paragraph paragraph part support
-rw-r--r--src/description.rs16
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>),
}