summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2023-03-04 13:56:42 +0100
committerHampusM <hampus@hampusmat.com>2023-03-04 13:56:42 +0100
commitd3868aca9f6bc45dcc11f78ddefa40bcc4af8bbf (patch)
tree1063f237cdb26375a7876bca9fc1a94c111007ab /src
parenta15a878b87a4891ec856178c151faeaaa1799ad3 (diff)
feat: add informal equation support
Diffstat (limited to 'src')
-rw-r--r--src/description.rs19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/description.rs b/src/description.rs
index 615b0c2..3a5b26f 100644
--- a/src/description.rs
+++ b/src/description.rs
@@ -280,6 +280,9 @@ pub enum ParagraphPart
/// Table part.
Table(Table),
+
+ /// Informal equation part.
+ InformalEquation(String),
}
impl FromElements for ParagraphPart
@@ -316,7 +319,7 @@ impl ParagraphPart
"programlisting" => Self::ProgramListing,
"citerefentry" => Self::Entry,
"variablelist" | "itemizedlist" | "informaltable" | "para" | "footnote"
- | "table" => |_| {
+ | "table" | "informalequation" => |_| {
unreachable!();
},
_ => {
@@ -392,6 +395,16 @@ impl ParagraphPart
return Ok(Self::Table(table));
}
+ if tagged_element.name() == "informalequation" {
+ return Ok(Self::InlineEquation(
+ tagged_element
+ .child_elements()
+ .into_iter()
+ .map(ToString::to_string)
+ .collect::<String>(),
+ ));
+ }
+
let text_element = tagged_element
.child_elements()
.get_first_text_element()
@@ -409,8 +422,8 @@ pub enum ParagraphPartError
#[error("Expected a text element")]
ExpectedTextElement,
- /// A input element is a unknown description part.
- #[error("Input element with name '{0}' is a unknown description part")]
+ /// A input element is a unknown paragraph part.
+ #[error("Input element with name '{0}' is a unknown paragraph part")]
UnknownPart(String),
/// No text was found in tagged input element.