diff --git a/src/parser/affiliated_keyword.rs b/src/parser/affiliated_keyword.rs new file mode 100644 index 0000000..cbd12d7 --- /dev/null +++ b/src/parser/affiliated_keyword.rs @@ -0,0 +1,38 @@ +use crate::types::Keyword; +use crate::types::Object; +use crate::types::PlainList; + +pub struct AffiliatedKeyword<'s> { + name: &'s str, +} + +pub enum AffiliatedKeywordValue<'s> { + SingleString(&'s str), + ListOfStrings(Vec<&'s str>), + ListOfObjects(Vec>), +} + +pub trait GetAffiliatedKeywords<'s> { + type ItemIterator: Iterator>; + + fn get_affiliated_keywords<'r: 's>(&'r self) -> Self::ItemIterator; +} + +pub trait HandleAffiliatedKeywords<'s> { + fn get_stuff(&self) -> &'s str; +} + +impl<'s> GetAffiliatedKeywords<'s> for PlainList<'s> { + type ItemIterator = std::slice::Iter<'s, Keyword<'s>>; + + fn get_affiliated_keywords<'r: 's>(&'r self) -> Self::ItemIterator { + self.affiliated_keywords.iter() + } +} + +impl<'s, I: GetAffiliatedKeywords<'s>> HandleAffiliatedKeywords<'s> for I { + fn get_stuff(&self) -> &'s str { + self.get_affiliated_keywords().count(); + todo!() + } +} diff --git a/src/parser/mod.rs b/src/parser/mod.rs index 02dabf6..c9c2e6e 100644 --- a/src/parser/mod.rs +++ b/src/parser/mod.rs @@ -1,3 +1,4 @@ +mod affiliated_keyword; mod angle_link; mod babel_call; mod citation; diff --git a/src/types/greater_element.rs b/src/types/greater_element.rs index c66bfc1..d2aeab4 100644 --- a/src/types/greater_element.rs +++ b/src/types/greater_element.rs @@ -219,13 +219,3 @@ impl<'s> TableRow<'s> { } } } - -pub trait GetAffiliatedKeywords<'s> { - fn get_affiliated_keywords(&self) -> () { - // foo - } -} - -// impl<'s> GetAffiliatedKeywords for PlainList<'s> { - -// }