From c49f62a8c369e58ee5cbffe853a436e724789d2f Mon Sep 17 00:00:00 2001 From: HampusM Date: Sat, 4 Mar 2023 15:01:38 +0100 Subject: feat: add gloss list support --- src/description.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/description.rs') diff --git a/src/description.rs b/src/description.rs index 92af9c1..4f3b08a 100644 --- a/src/description.rs +++ b/src/description.rs @@ -1,4 +1,5 @@ //! Reference entry description. +use crate::gloss_list::{Error as GlossListError, GlossList}; use crate::itemized_list::{Error as ItemizedListError, ItemizedList}; use crate::table::{Error as TableError, Informal, Table}; use crate::variable_list::{Error as VariableListError, VariableList}; @@ -111,6 +112,11 @@ impl FromElements for Description .map(Part::Table) .map_err(Self::Error::InvalidTable), ), + "glosslist" => Some( + GlossList::from_elements(part_elem.child_elements()) + .map(Part::GlossList) + .map_err(Self::Error::InvalidGlossList), + ), "title" => None, name => Some(Err(Self::Error::UnknownPartFound(name.to_string()))), }) @@ -150,6 +156,10 @@ pub enum Error /// Invalid table. #[error("Invalid table")] InvalidTable(#[source] TableError), + + /// Invalid gloss list. + #[error("Invalid gloss list")] + InvalidGlossList(#[source] GlossListError), } /// Description part. @@ -173,6 +183,9 @@ pub enum Part /// Table. Table(Table), + + /// Gloss list. + GlossList(GlossList), } /// Reference entry description paragraph. -- cgit v1.2.3-18-g5258