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
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE
15 changed files with 73 additions and 28 deletions

View File

@ -0,0 +1,8 @@
#+begin_center
#+end_center
#+begin_center
#+NAME: foo
#+end_center

View File

@ -8,6 +8,7 @@ use nom::sequence::tuple;
use super::keyword::affiliated_keyword; use super::keyword::affiliated_keyword;
use super::org_source::OrgSource; use super::org_source::OrgSource;
use super::util::get_name;
use crate::context::RefContext; use crate::context::RefContext;
use crate::error::Res; use crate::error::Res;
use crate::parser::util::get_consumed; use crate::parser::util::get_consumed;
@ -30,7 +31,7 @@ pub(crate) fn diary_sexp<'b, 'g, 'r, 's>(
remaining, remaining,
DiarySexp { DiarySexp {
source: source.into(), source: source.into(),
name: None, // TODO name: get_name(&affiliated_keywords),
}, },
)) ))
} }

View File

@ -13,6 +13,7 @@ use nom::sequence::tuple;
use super::keyword::affiliated_keyword; use super::keyword::affiliated_keyword;
use super::org_source::OrgSource; use super::org_source::OrgSource;
use super::util::get_name;
use crate::context::parser_with_context; use crate::context::parser_with_context;
use crate::context::ContextElement; use crate::context::ContextElement;
use crate::context::ExitClass; use crate::context::ExitClass;
@ -93,7 +94,7 @@ pub(crate) fn drawer<'b, 'g, 'r, 's>(
remaining, remaining,
Drawer { Drawer {
source: source.into(), source: source.into(),
name: None, // TODO name: get_name(&affiliated_keywords),
drawer_name: drawer_name.into(), drawer_name: drawer_name.into(),
children, children,
}, },

View File

@ -19,6 +19,7 @@ use nom::sequence::tuple;
use super::keyword::affiliated_keyword; use super::keyword::affiliated_keyword;
use super::org_source::OrgSource; use super::org_source::OrgSource;
use super::util::get_name;
use crate::context::parser_with_context; use crate::context::parser_with_context;
use crate::context::ContextElement; use crate::context::ContextElement;
use crate::context::ExitClass; use crate::context::ExitClass;
@ -100,7 +101,7 @@ pub(crate) fn dynamic_block<'b, 'g, 'r, 's>(
remaining, remaining,
DynamicBlock { DynamicBlock {
source: source.into(), source: source.into(),
name: None, // TODO name: get_name(&affiliated_keywords),
block_name: name.into(), block_name: name.into(),
parameters: parameters.map(|val| val.into()), parameters: parameters.map(|val| val.into()),
children, children,

View File

@ -12,6 +12,7 @@ use nom::sequence::tuple;
use super::keyword::affiliated_keyword; use super::keyword::affiliated_keyword;
use super::org_source::OrgSource; use super::org_source::OrgSource;
use super::util::get_name;
use super::util::only_space1; use super::util::only_space1;
use super::util::org_line_ending; use super::util::org_line_ending;
use crate::context::parser_with_context; use crate::context::parser_with_context;
@ -39,7 +40,7 @@ pub(crate) fn fixed_width_area<'b, 'g, 'r, 's>(
remaining, remaining,
FixedWidthArea { FixedWidthArea {
source: source.into(), source: source.into(),
name: None, // TODO name: get_name(&affiliated_keywords),
}, },
)) ))
} }

View File

@ -13,6 +13,7 @@ use nom::sequence::tuple;
use super::keyword::affiliated_keyword; use super::keyword::affiliated_keyword;
use super::org_source::OrgSource; use super::org_source::OrgSource;
use super::util::get_name;
use super::util::include_input; use super::util::include_input;
use super::util::WORD_CONSTITUENT_CHARACTERS; use super::util::WORD_CONSTITUENT_CHARACTERS;
use crate::context::parser_with_context; use crate::context::parser_with_context;
@ -87,7 +88,7 @@ pub(crate) fn footnote_definition<'b, 'g, 'r, 's>(
remaining, remaining,
FootnoteDefinition { FootnoteDefinition {
source: source.into(), source: source.into(),
name: None, // TODO name: get_name(&affiliated_keywords),
label: lbl.into(), label: lbl.into(),
children: children.into_iter().map(|(_, item)| item).collect(), children: children.into_iter().map(|(_, item)| item).collect(),
}, },

View File

@ -19,6 +19,7 @@ use nom::sequence::tuple;
use super::keyword::affiliated_keyword; use super::keyword::affiliated_keyword;
use super::org_source::OrgSource; use super::org_source::OrgSource;
use super::util::get_name;
use super::util::in_section; use super::util::in_section;
use crate::context::parser_with_context; use crate::context::parser_with_context;
use crate::context::ContextElement; use crate::context::ContextElement;
@ -36,6 +37,7 @@ use crate::parser::util::get_consumed;
use crate::parser::util::start_of_line; use crate::parser::util::start_of_line;
use crate::types::CenterBlock; use crate::types::CenterBlock;
use crate::types::Element; use crate::types::Element;
use crate::types::Keyword;
use crate::types::Paragraph; use crate::types::Paragraph;
use crate::types::QuoteBlock; use crate::types::QuoteBlock;
use crate::types::SetSource; use crate::types::SetSource;
@ -60,9 +62,9 @@ pub(crate) fn greater_block<'b, 'g, 'r, 's>(
))(remaining)?; ))(remaining)?;
let name = Into::<&str>::into(name); let name = Into::<&str>::into(name);
let (remaining, element) = match name.to_lowercase().as_str() { let (remaining, element) = match name.to_lowercase().as_str() {
"center" => center_block(context, remaining, input)?, "center" => center_block(context, remaining, input, &affiliated_keywords)?,
"quote" => quote_block(context, remaining, input)?, "quote" => quote_block(context, remaining, input, &affiliated_keywords)?,
_ => special_block(name)(context, remaining, input)?, _ => special_block(name)(context, remaining, input, &affiliated_keywords)?,
}; };
Ok((remaining, element)) Ok((remaining, element))
} }
@ -72,6 +74,7 @@ fn center_block<'b, 'g, 'r, 's>(
context: RefContext<'b, 'g, 'r, 's>, context: RefContext<'b, 'g, 'r, 's>,
input: OrgSource<'s>, input: OrgSource<'s>,
original_input: OrgSource<'s>, original_input: OrgSource<'s>,
affiliated_keywords: &Vec<Keyword<'s>>,
) -> Res<OrgSource<'s>, Element<'s>> { ) -> Res<OrgSource<'s>, Element<'s>> {
let (remaining, (source, children)) = let (remaining, (source, children)) =
greater_block_body(context, input, original_input, "center", "center block")?; greater_block_body(context, input, original_input, "center", "center block")?;
@ -79,7 +82,7 @@ fn center_block<'b, 'g, 'r, 's>(
remaining, remaining,
Element::CenterBlock(CenterBlock { Element::CenterBlock(CenterBlock {
source, source,
name: None, // TODO name: get_name(&affiliated_keywords),
children, children,
}), }),
)) ))
@ -90,6 +93,7 @@ fn quote_block<'b, 'g, 'r, 's>(
context: RefContext<'b, 'g, 'r, 's>, context: RefContext<'b, 'g, 'r, 's>,
input: OrgSource<'s>, input: OrgSource<'s>,
original_input: OrgSource<'s>, original_input: OrgSource<'s>,
affiliated_keywords: &Vec<Keyword<'s>>,
) -> Res<OrgSource<'s>, Element<'s>> { ) -> Res<OrgSource<'s>, Element<'s>> {
let (remaining, (source, children)) = let (remaining, (source, children)) =
greater_block_body(context, input, original_input, "quote", "quote block")?; greater_block_body(context, input, original_input, "quote", "quote block")?;
@ -97,7 +101,7 @@ fn quote_block<'b, 'g, 'r, 's>(
remaining, remaining,
Element::QuoteBlock(QuoteBlock { Element::QuoteBlock(QuoteBlock {
source, source,
name: None, // TODO name: get_name(&affiliated_keywords),
children, children,
}), }),
)) ))
@ -109,11 +113,19 @@ fn special_block<'s>(
RefContext<'b, 'g, 'r, 's>, RefContext<'b, 'g, 'r, 's>,
OrgSource<'s>, OrgSource<'s>,
OrgSource<'s>, OrgSource<'s>,
&Vec<Keyword<'s>>,
) -> Res<OrgSource<'s>, Element<'s>> ) -> Res<OrgSource<'s>, Element<'s>>
+ 's { + 's {
let context_name = format!("special block {}", name); let context_name = format!("special block {}", name);
move |context, input, original_input| { move |context, input, original_input, affiliated_keywords| {
_special_block(context, input, original_input, name, context_name.as_str()) _special_block(
context,
input,
original_input,
name,
context_name.as_str(),
affiliated_keywords,
)
} }
} }
@ -124,6 +136,7 @@ fn _special_block<'c, 'b, 'g, 'r, 's>(
original_input: OrgSource<'s>, original_input: OrgSource<'s>,
name: &'s str, name: &'s str,
context_name: &'c str, context_name: &'c str,
affiliated_keywords: &Vec<Keyword<'s>>,
) -> Res<OrgSource<'s>, Element<'s>> { ) -> Res<OrgSource<'s>, Element<'s>> {
let (remaining, parameters) = opt(tuple((space1, parameters)))(input)?; let (remaining, parameters) = opt(tuple((space1, parameters)))(input)?;
let (remaining, (source, children)) = let (remaining, (source, children)) =
@ -132,7 +145,7 @@ fn _special_block<'c, 'b, 'g, 'r, 's>(
remaining, remaining,
Element::SpecialBlock(SpecialBlock { Element::SpecialBlock(SpecialBlock {
source, source,
name: None, // TODO name: get_name(&affiliated_keywords),
children, children,
block_type: name, block_type: name,
parameters: parameters.map(|(_, parameters)| Into::<&str>::into(parameters)), parameters: parameters.map(|(_, parameters)| Into::<&str>::into(parameters)),

View File

@ -11,6 +11,7 @@ use nom::sequence::tuple;
use super::keyword::affiliated_keyword; use super::keyword::affiliated_keyword;
use super::org_source::OrgSource; use super::org_source::OrgSource;
use super::util::get_name;
use crate::context::RefContext; use crate::context::RefContext;
use crate::error::Res; use crate::error::Res;
use crate::parser::util::start_of_line; use crate::parser::util::start_of_line;
@ -33,7 +34,7 @@ pub(crate) fn horizontal_rule<'b, 'g, 'r, 's>(
remaining, remaining,
HorizontalRule { HorizontalRule {
source: rule.into(), source: rule.into(),
name: None, // TODO name: get_name(&affiliated_keywords),
}, },
)) ))
} }

View File

@ -19,6 +19,7 @@ use nom::sequence::tuple;
use super::org_source::BracketDepth; use super::org_source::BracketDepth;
use super::org_source::OrgSource; use super::org_source::OrgSource;
use super::util::get_name;
use crate::context::Matcher; use crate::context::Matcher;
use crate::context::RefContext; use crate::context::RefContext;
use crate::error::CustomError; use crate::error::CustomError;
@ -62,7 +63,7 @@ fn _filtered_keyword<'s, F: Matcher>(
remaining, remaining,
Keyword { Keyword {
source: consumed_input.into(), source: consumed_input.into(),
name: None, // TODO name: None, // To be populated by the caller if this keyword is in a context to support affiliated keywords.
key: parsed_key.into(), key: parsed_key.into(),
value: "".into(), value: "".into(),
}, },
@ -80,7 +81,7 @@ fn _filtered_keyword<'s, F: Matcher>(
remaining, remaining,
Keyword { Keyword {
source: consumed_input.into(), source: consumed_input.into(),
name: None, // TODO name: None, // To be populated by the caller if this keyword is in a context to support affiliated keywords.
key: parsed_key.into(), key: parsed_key.into(),
value: parsed_value.into(), value: parsed_value.into(),
}, },
@ -93,7 +94,9 @@ pub(crate) fn keyword<'b, 'g, 'r, 's>(
input: OrgSource<'s>, input: OrgSource<'s>,
) -> Res<OrgSource<'s>, Keyword<'s>> { ) -> Res<OrgSource<'s>, Keyword<'s>> {
let (input, affiliated_keywords) = many0(affiliated_keyword)(input)?; let (input, affiliated_keywords) = many0(affiliated_keyword)(input)?;
filtered_keyword(regular_keyword_key)(input) let (remaining, mut kw) = filtered_keyword(regular_keyword_key)(input)?;
kw.name = get_name(&affiliated_keywords);
Ok((remaining, kw))
} }
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))] #[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
@ -112,7 +115,7 @@ pub(crate) fn babel_call_keyword<'b, 'g, 'r, 's>(
remaining, remaining,
BabelCall { BabelCall {
source: kw.source, source: kw.source,
name: None, // TODO name: get_name(&affiliated_keywords),
key: kw.key, key: kw.key,
value: kw.value, value: kw.value,
}, },

View File

@ -15,6 +15,7 @@ use nom::sequence::tuple;
use super::keyword::affiliated_keyword; use super::keyword::affiliated_keyword;
use super::org_source::OrgSource; use super::org_source::OrgSource;
use super::util::get_consumed; use super::util::get_consumed;
use super::util::get_name;
use crate::context::parser_with_context; use crate::context::parser_with_context;
use crate::context::ContextElement; use crate::context::ContextElement;
use crate::context::ContextMatcher; use crate::context::ContextMatcher;
@ -57,7 +58,7 @@ pub(crate) fn latex_environment<'b, 'g, 'r, 's>(
remaining, remaining,
LatexEnvironment { LatexEnvironment {
source: source.into(), source: source.into(),
name: None, // TODO name: get_name(&affiliated_keywords),
}, },
)) ))
} }

View File

@ -14,11 +14,14 @@ use nom::combinator::opt;
use nom::combinator::peek; use nom::combinator::peek;
use nom::combinator::recognize; use nom::combinator::recognize;
use nom::combinator::verify; use nom::combinator::verify;
use nom::multi::many0;
use nom::multi::many_till; use nom::multi::many_till;
use nom::multi::separated_list1; use nom::multi::separated_list1;
use nom::sequence::tuple; use nom::sequence::tuple;
use super::keyword::affiliated_keyword;
use super::org_source::OrgSource; use super::org_source::OrgSource;
use super::util::get_name;
use crate::context::parser_with_context; use crate::context::parser_with_context;
use crate::context::ContextElement; use crate::context::ContextElement;
use crate::context::ContextMatcher; use crate::context::ContextMatcher;
@ -50,6 +53,7 @@ pub(crate) fn verse_block<'b, 'g, 'r, 's>(
context: RefContext<'b, 'g, 'r, 's>, context: RefContext<'b, 'g, 'r, 's>,
input: OrgSource<'s>, input: OrgSource<'s>,
) -> Res<OrgSource<'s>, VerseBlock<'s>> { ) -> Res<OrgSource<'s>, VerseBlock<'s>> {
let (input, affiliated_keywords) = many0(affiliated_keyword)(input)?;
let (remaining, _) = lesser_block_begin("verse")(context, input)?; let (remaining, _) = lesser_block_begin("verse")(context, input)?;
let (remaining, parameters) = opt(tuple((space1, data)))(remaining)?; let (remaining, parameters) = opt(tuple((space1, data)))(remaining)?;
let (remaining, _nl) = recognize(tuple((space0, line_ending)))(remaining)?; let (remaining, _nl) = recognize(tuple((space0, line_ending)))(remaining)?;
@ -93,7 +97,7 @@ pub(crate) fn verse_block<'b, 'g, 'r, 's>(
remaining, remaining,
VerseBlock { VerseBlock {
source: source.into(), source: source.into(),
name: None, // TODO name: get_name(&affiliated_keywords),
data: parameters.map(|parameters| Into::<&str>::into(parameters)), data: parameters.map(|parameters| Into::<&str>::into(parameters)),
children, children,
}, },
@ -105,6 +109,7 @@ pub(crate) fn comment_block<'b, 'g, 'r, 's>(
context: RefContext<'b, 'g, 'r, 's>, context: RefContext<'b, 'g, 'r, 's>,
input: OrgSource<'s>, input: OrgSource<'s>,
) -> Res<OrgSource<'s>, CommentBlock<'s>> { ) -> Res<OrgSource<'s>, CommentBlock<'s>> {
let (input, affiliated_keywords) = many0(affiliated_keyword)(input)?;
let (remaining, _) = lesser_block_begin("comment")(context, input)?; let (remaining, _) = lesser_block_begin("comment")(context, input)?;
let (remaining, _parameters) = opt(tuple((space1, data)))(remaining)?; let (remaining, _parameters) = opt(tuple((space1, data)))(remaining)?;
let (remaining, _nl) = recognize(tuple((space0, line_ending)))(remaining)?; let (remaining, _nl) = recognize(tuple((space0, line_ending)))(remaining)?;
@ -129,7 +134,7 @@ pub(crate) fn comment_block<'b, 'g, 'r, 's>(
remaining, remaining,
CommentBlock { CommentBlock {
source: source.into(), source: source.into(),
name: None, // TODO name: get_name(&affiliated_keywords),
contents: contents.into(), contents: contents.into(),
}, },
)) ))
@ -140,6 +145,7 @@ pub(crate) fn example_block<'b, 'g, 'r, 's>(
context: RefContext<'b, 'g, 'r, 's>, context: RefContext<'b, 'g, 'r, 's>,
input: OrgSource<'s>, input: OrgSource<'s>,
) -> Res<OrgSource<'s>, ExampleBlock<'s>> { ) -> Res<OrgSource<'s>, ExampleBlock<'s>> {
let (input, affiliated_keywords) = many0(affiliated_keyword)(input)?;
let (remaining, _) = lesser_block_begin("example")(context, input)?; let (remaining, _) = lesser_block_begin("example")(context, input)?;
let (remaining, parameters) = opt(tuple((space1, example_switches)))(remaining)?; let (remaining, parameters) = opt(tuple((space1, example_switches)))(remaining)?;
let (remaining, _nl) = recognize(tuple((space0, line_ending)))(remaining)?; let (remaining, _nl) = recognize(tuple((space0, line_ending)))(remaining)?;
@ -183,7 +189,7 @@ pub(crate) fn example_block<'b, 'g, 'r, 's>(
remaining, remaining,
ExampleBlock { ExampleBlock {
source: source.into(), source: source.into(),
name: None, // TODO name: get_name(&affiliated_keywords),
switches, switches,
number_lines, number_lines,
preserve_indent, preserve_indent,
@ -200,6 +206,7 @@ pub(crate) fn export_block<'b, 'g, 'r, 's>(
context: RefContext<'b, 'g, 'r, 's>, context: RefContext<'b, 'g, 'r, 's>,
input: OrgSource<'s>, input: OrgSource<'s>,
) -> Res<OrgSource<'s>, ExportBlock<'s>> { ) -> Res<OrgSource<'s>, ExportBlock<'s>> {
let (input, affiliated_keywords) = many0(affiliated_keyword)(input)?;
let (remaining, _) = lesser_block_begin("export")(context, input)?; let (remaining, _) = lesser_block_begin("export")(context, input)?;
// https://orgmode.org/worg/org-syntax.html#Blocks claims that export blocks must have a single word for data but testing shows no data and multi-word data still parses as an export block. // https://orgmode.org/worg/org-syntax.html#Blocks claims that export blocks must have a single word for data but testing shows no data and multi-word data still parses as an export block.
let (remaining, parameters) = opt(tuple((space1, data)))(remaining)?; let (remaining, parameters) = opt(tuple((space1, data)))(remaining)?;
@ -229,7 +236,7 @@ pub(crate) fn export_block<'b, 'g, 'r, 's>(
remaining, remaining,
ExportBlock { ExportBlock {
source: source.into(), source: source.into(),
name: None, // TODO name: get_name(&affiliated_keywords),
data: parameters.map(|parameters| Into::<&str>::into(parameters)), data: parameters.map(|parameters| Into::<&str>::into(parameters)),
contents: contents.into(), contents: contents.into(),
}, },
@ -241,6 +248,7 @@ pub(crate) fn src_block<'b, 'g, 'r, 's>(
context: RefContext<'b, 'g, 'r, 's>, context: RefContext<'b, 'g, 'r, 's>,
input: OrgSource<'s>, input: OrgSource<'s>,
) -> Res<OrgSource<'s>, SrcBlock<'s>> { ) -> Res<OrgSource<'s>, SrcBlock<'s>> {
let (input, affiliated_keywords) = many0(affiliated_keyword)(input)?;
let (remaining, _) = lesser_block_begin("src")(context, input)?; let (remaining, _) = lesser_block_begin("src")(context, input)?;
// https://orgmode.org/worg/org-syntax.html#Blocks claims that data is mandatory and must follow the LANGUAGE SWITCHES ARGUMENTS pattern but testing has shown that no data and incorrect data here will still parse to a src block. // https://orgmode.org/worg/org-syntax.html#Blocks claims that data is mandatory and must follow the LANGUAGE SWITCHES ARGUMENTS pattern but testing has shown that no data and incorrect data here will still parse to a src block.
let (remaining, language) = opt(map(tuple((space1, switch_word(true))), |(_, language)| { let (remaining, language) = opt(map(tuple((space1, switch_word(true))), |(_, language)| {
@ -289,7 +297,7 @@ pub(crate) fn src_block<'b, 'g, 'r, 's>(
remaining, remaining,
SrcBlock { SrcBlock {
source: source.into(), source: source.into(),
name: None, // TODO name: get_name(&affiliated_keywords),
language: language.map(Into::<&str>::into), language: language.map(Into::<&str>::into),
switches, switches,
parameters: parameters.map(Into::<&str>::into), parameters: parameters.map(Into::<&str>::into),

View File

@ -12,6 +12,7 @@ use super::keyword::affiliated_keyword;
use super::org_source::OrgSource; use super::org_source::OrgSource;
use super::util::blank_line; use super::util::blank_line;
use super::util::get_consumed; use super::util::get_consumed;
use super::util::get_name;
use crate::context::parser_with_context; use crate::context::parser_with_context;
use crate::context::ContextElement; use crate::context::ContextElement;
use crate::context::ExitClass; use crate::context::ExitClass;
@ -51,7 +52,7 @@ pub(crate) fn paragraph<'b, 'g, 'r, 's>(
remaining, remaining,
Paragraph { Paragraph {
source: source.into(), source: source.into(),
name: None, // TODO name: get_name(&affiliated_keywords),
children, children,
}, },
)) ))

View File

@ -22,6 +22,7 @@ use super::element_parser::element;
use super::keyword::affiliated_keyword; use super::keyword::affiliated_keyword;
use super::object_parser::standard_set_object; use super::object_parser::standard_set_object;
use super::org_source::OrgSource; use super::org_source::OrgSource;
use super::util::get_name;
use super::util::include_input; use super::util::include_input;
use super::util::indentation_level; use super::util::indentation_level;
use super::util::non_whitespace_character; use super::util::non_whitespace_character;
@ -154,7 +155,7 @@ pub(crate) fn plain_list<'b, 'g, 'r, 's>(
remaining, remaining,
PlainList { PlainList {
source: source.into(), source: source.into(),
name: None, // TODO name: get_name(&affiliated_keywords),
list_type: first_item_list_type.expect("Plain lists require at least one element."), list_type: first_item_list_type.expect("Plain lists require at least one element."),
children: children.into_iter().map(|(_start, item)| item).collect(), children: children.into_iter().map(|(_start, item)| item).collect(),
}, },

View File

@ -18,6 +18,7 @@ use super::keyword::table_formula_keyword;
use super::object_parser::table_cell_set_object; use super::object_parser::table_cell_set_object;
use super::org_source::OrgSource; use super::org_source::OrgSource;
use super::util::exit_matcher_parser; use super::util::exit_matcher_parser;
use super::util::get_name;
use super::util::org_line_ending; use super::util::org_line_ending;
use crate::context::parser_with_context; use crate::context::parser_with_context;
use crate::context::ContextElement; use crate::context::ContextElement;
@ -70,7 +71,7 @@ pub(crate) fn org_mode_table<'b, 'g, 'r, 's>(
remaining, remaining,
Table { Table {
source: source.into(), source: source.into(),
name: None, // TODO name: get_name(&affiliated_keywords),
formulas, formulas,
children, children,
}, },

View File

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