Start of making ignored whitespace a top-level template element to handle it in a more generic fashion.
This commit is contained in:
parent
b8c59f012b
commit
908ae078b0
@ -53,6 +53,11 @@ pub enum Special {
|
||||
RightCurlyBrace,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
pub enum IgnoredWhitespace<'a> {
|
||||
StartOfLine(&'a str),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
pub struct Comment<'a> {
|
||||
value: &'a str,
|
||||
@ -141,6 +146,7 @@ pub struct Template<'a> {
|
||||
pub enum TemplateElement<'a> {
|
||||
TESpan(Span<'a>),
|
||||
TETag(DustTag<'a>),
|
||||
TEIgnoredWhitespace(IgnoredWhitespace<'a>),
|
||||
}
|
||||
|
||||
/// Any element significant to dust that isn't plain text
|
||||
@ -478,10 +484,9 @@ fn filter(i: &str) -> IResult<&str, Filter> {
|
||||
)(i)
|
||||
}
|
||||
|
||||
/// Whitespace at the beginning of lines is ignored so inside a span
|
||||
/// we are matching a newline character followed by as much contiguous
|
||||
/// whitespace as possible, all of which will be thrown away by other
|
||||
/// parsers.
|
||||
/// Whitespace at the beginning of lines is ignored so we are matching
|
||||
/// a newline character followed by as much contiguous whitespace as
|
||||
/// possible, all of which will be thrown away by other parsers.
|
||||
fn span_end_of_line(i: &str) -> IResult<&str, (&str, &str)> {
|
||||
tuple((line_ending, multispace0))(i)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user