Remove the SetSource trait.
It was only being used for creating paragraphs of specific text, so I just adjusted the of_text function to handle it.
This commit is contained in:
@@ -15,10 +15,8 @@ use crate::context::RefContext;
|
||||
use crate::error::CustomError;
|
||||
use crate::error::Res;
|
||||
use crate::parser::macros::element;
|
||||
use crate::types::AffiliatedKeywords;
|
||||
use crate::types::Object;
|
||||
use crate::types::Paragraph;
|
||||
use crate::types::PlainText;
|
||||
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
@@ -80,13 +78,10 @@ pub(crate) fn broken_end<'b, 'g, 'r, 's>(
|
||||
|
||||
Ok((
|
||||
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(),
|
||||
})],
|
||||
},
|
||||
Paragraph::of_text(
|
||||
input.get_until(remaining).into(),
|
||||
input.get_until(lead_in_remaining).into(),
|
||||
),
|
||||
))
|
||||
}
|
||||
}
|
||||
@@ -139,13 +134,10 @@ pub(crate) fn broken_dynamic_block<'b, 'g, 'r, 's>(
|
||||
|
||||
Ok((
|
||||
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(),
|
||||
})],
|
||||
},
|
||||
Paragraph::of_text(
|
||||
input.get_until(remaining).into(),
|
||||
input.get_until(lead_in_remaining).into(),
|
||||
),
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,6 @@ use crate::types::Drawer;
|
||||
use crate::types::Element;
|
||||
use crate::types::Keyword;
|
||||
use crate::types::Paragraph;
|
||||
use crate::types::SetSource;
|
||||
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
@@ -81,9 +80,8 @@ where
|
||||
))(remaining)
|
||||
{
|
||||
Ok((remain, (_not_immediate_exit, first_line, (_trailing_whitespace, _exit_contents)))) => {
|
||||
let mut element = Element::Paragraph(Paragraph::of_text(first_line.into()));
|
||||
let source = get_consumed(remaining, remain);
|
||||
element.set_source(source.into());
|
||||
let element = Element::Paragraph(Paragraph::of_text(source.into(), first_line.into()));
|
||||
(remain, vec![element])
|
||||
}
|
||||
Err(_) => {
|
||||
|
||||
@@ -37,7 +37,6 @@ use crate::types::DynamicBlock;
|
||||
use crate::types::Element;
|
||||
use crate::types::Keyword;
|
||||
use crate::types::Paragraph;
|
||||
use crate::types::SetSource;
|
||||
|
||||
#[cfg_attr(
|
||||
feature = "tracing",
|
||||
@@ -88,9 +87,7 @@ where
|
||||
))))(remaining)?;
|
||||
let leading_blank_lines =
|
||||
leading_blank_lines.map(|(source, (first_line, _remaining_lines))| {
|
||||
let mut element = Element::Paragraph(Paragraph::of_text(first_line.into()));
|
||||
element.set_source(source.into());
|
||||
element
|
||||
Element::Paragraph(Paragraph::of_text(source.into(), first_line.into()))
|
||||
});
|
||||
let (remaining, (mut children, _exit_contents)) =
|
||||
many_till(element_matcher, exit_matcher)(remaining)?;
|
||||
|
||||
@@ -39,7 +39,6 @@ use crate::types::Element;
|
||||
use crate::types::Keyword;
|
||||
use crate::types::Paragraph;
|
||||
use crate::types::QuoteBlock;
|
||||
use crate::types::SetSource;
|
||||
use crate::types::SpecialBlock;
|
||||
|
||||
#[cfg_attr(
|
||||
@@ -257,9 +256,7 @@ fn greater_block_body<'c, 'b, 'g, 'r, 's>(
|
||||
))))(remaining)?;
|
||||
let leading_blank_lines =
|
||||
leading_blank_lines.map(|(source, (first_line, _remaining_lines))| {
|
||||
let mut element = Element::Paragraph(Paragraph::of_text(first_line.into()));
|
||||
element.set_source(source.into());
|
||||
element
|
||||
Element::Paragraph(Paragraph::of_text(source.into(), first_line.into()))
|
||||
});
|
||||
let (remaining, (mut children, _exit_contents)) =
|
||||
many_till(element_matcher, exit_matcher)(remaining)?;
|
||||
|
||||
Reference in New Issue
Block a user