From d3868aca9f6bc45dcc11f78ddefa40bcc4af8bbf Mon Sep 17 00:00:00 2001 From: HampusM Date: Sat, 4 Mar 2023 13:56:42 +0100 Subject: feat: add informal equation support --- src/description.rs | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'src') 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::(), + )); + } + 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. -- cgit v1.2.3-18-g5258