From 94dec311309e71cd2a5e41b72c507f560837cc2a Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Wed, 18 Oct 2023 12:17:57 -0400 Subject: [PATCH] Consuming trailing whitespace for :end: bullshitium. --- src/parser/bullshitium.rs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/parser/bullshitium.rs b/src/parser/bullshitium.rs index 10f5694..3a7afc0 100644 --- a/src/parser/bullshitium.rs +++ b/src/parser/bullshitium.rs @@ -3,13 +3,16 @@ use nom::character::complete::space0; use nom::sequence::tuple; use super::paragraph::paragraph; +use super::util::maybe_consume_trailing_whitespace_if_not_exiting; use super::util::org_line_ending; use super::util::start_of_line; use super::OrgSource; use crate::context::RefContext; use crate::error::Res; +use crate::types::AffiliatedKeywords; use crate::types::Object; use crate::types::Paragraph; +use crate::types::PlainText; #[cfg_attr( feature = "tracing", @@ -62,9 +65,18 @@ pub(crate) fn broken_end<'b, 'g, 'r, 's>( }; Ok((remaining, paragraph)) } else { + let (remaining, _trailing_ws) = + maybe_consume_trailing_whitespace_if_not_exiting(context, lead_in_remaining)?; + Ok(( - lead_in_remaining, - Paragraph::of_text(input.get_until(lead_in_remaining).into()), + remaining, + Paragraph { + source: input.get_until(remaining).into(), + affiliated_keywords: AffiliatedKeywords::default(), + children: vec![Object::PlainText(PlainText { + source: input.get_until(lead_in_remaining).into(), + })], + }, )) } }