diff --git a/src/parser/entity.rs b/src/parser/entity.rs index 84c271b..94c91a2 100644 --- a/src/parser/entity.rs +++ b/src/parser/entity.rs @@ -28,7 +28,7 @@ pub(crate) fn entity<'b, 'g, 'r, 's>( let (remaining, _) = tag("\\")(input)?; let (remaining, (entity_definition, entity_name, use_brackets)) = name(context, remaining)?; - let (remaining, _trailing_whitespace) = + let (remaining, post_blank) = maybe_consume_object_trailing_whitespace_if_not_exiting(context, remaining)?; let source = get_consumed(input, remaining); @@ -43,6 +43,7 @@ pub(crate) fn entity<'b, 'g, 'r, 's>( ascii: entity_definition.ascii, utf8: entity_definition.utf8, use_brackets, + post_blank: post_blank.map(Into::<&str>::into), }, )) } diff --git a/src/types/object.rs b/src/types/object.rs index 801c1e6..07555cd 100644 --- a/src/types/object.rs +++ b/src/types/object.rs @@ -187,6 +187,7 @@ pub struct Entity<'s> { // Skipping latin1 because it is detrimental to the future. If anyone out there is using latin1, take a long look in the mirror and change your ways. pub utf8: &'s str, pub use_brackets: bool, + pub post_blank: Option<&'s str>, } #[derive(Debug)] @@ -740,11 +741,15 @@ impl<'s> StandardProperties<'s> for Entity<'s> { } fn get_contents<'b>(&'b self) -> Option<&'s str> { - todo!() + None } fn get_post_blank(&self) -> PostBlank { - todo!() + self.post_blank + .map(|post_blank| post_blank.chars().count()) + .unwrap_or(0) + .try_into() + .expect("Too much post-blank to fit into a PostBlank.") } }