Populate the name field on elements.

This commit is contained in:
Tom Alexander
2023-10-04 21:21:26 -04:00
parent 5b308ea76f
commit 93fe46e4e7
15 changed files with 73 additions and 28 deletions

View File

@@ -148,12 +148,15 @@ pub enum SwitchNumberLines {
}
impl<'s> Paragraph<'s> {
/// 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(input: &'s str) -> Self {
let mut objects = Vec::with_capacity(1);
objects.push(Object::PlainText(PlainText { source: input }));
Paragraph {
source: input,
name: None, // TODO
name: None,
children: objects,
}
}