Fix handling of property drawers containing only whitespace.

This commit is contained in:
Tom Alexander
2023-12-15 14:49:28 -05:00
parent 6ce25c8a3b
commit 7430daa768
4 changed files with 103 additions and 21 deletions

View File

@@ -204,10 +204,29 @@ impl<'s> Paragraph<'s> {
///
/// This is used for elements that support an "empty" content like greater blocks.
pub(crate) fn of_text(source: &'s str, body: &'s str) -> Self {
// TODO: This should be replaced with of_text_full.
Paragraph {
source,
contents: None, // TODO
post_blank: None, // TODO
contents: None,
post_blank: None,
affiliated_keywords: AffiliatedKeywords::default(),
children: vec![Object::PlainText(PlainText { source: body })],
}
}
/// Generate a paragraph of the passed in text with no additional properties.
///
/// This is used for elements that support an "empty" content like greater blocks.
pub(crate) fn of_text_full(
source: &'s str,
body: &'s str,
contents: Option<&'s str>,
post_blank: Option<&'s str>,
) -> Self {
Paragraph {
source,
contents,
post_blank,
affiliated_keywords: AffiliatedKeywords::default(),
children: vec![Object::PlainText(PlainText { source: body })],
}