Rename the container parser to conditional.
Rename the container parser to conditional because we are going to have other tags with bodies that do not match the same semantics as the conditional blocks. An example of this is inline partials only support a single key rather than a path.
This commit is contained in:
@@ -99,9 +99,9 @@ fn dust_tag(i: &str) -> IResult<&str, DustTag> {
|
||||
map(special, DustTag::DTSpecial),
|
||||
map(comment, DustTag::DTComment),
|
||||
map(reference, DustTag::DTReference),
|
||||
container("{#", DustTag::DTSection),
|
||||
container("{?", DustTag::DTExists),
|
||||
container("{^", DustTag::DTNotExists),
|
||||
conditional("{#", DustTag::DTSection),
|
||||
conditional("{?", DustTag::DTExists),
|
||||
conditional("{^", DustTag::DTNotExists),
|
||||
))(i)
|
||||
}
|
||||
|
||||
@@ -154,7 +154,7 @@ fn reference(i: &str) -> IResult<&str, Reference> {
|
||||
))
|
||||
}
|
||||
|
||||
fn container<'a, F>(
|
||||
fn conditional<'a, F>(
|
||||
open_matcher: &'static str,
|
||||
constructor: F,
|
||||
) -> impl Fn(&'a str) -> IResult<&'a str, DustTag<'a>>
|
||||
@@ -162,12 +162,12 @@ where
|
||||
F: Copy + Fn(Container<'a>) -> DustTag<'a>,
|
||||
{
|
||||
alt((
|
||||
container_with_body(open_matcher, constructor),
|
||||
self_closing_container(open_matcher, constructor),
|
||||
conditional_with_body(open_matcher, constructor),
|
||||
self_closing_conditional(open_matcher, constructor),
|
||||
))
|
||||
}
|
||||
|
||||
fn container_with_body<'a, F>(
|
||||
fn conditional_with_body<'a, F>(
|
||||
open_matcher: &'static str,
|
||||
constructor: F,
|
||||
) -> impl Fn(&'a str) -> IResult<&'a str, DustTag<'a>>
|
||||
@@ -196,7 +196,7 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
fn self_closing_container<'a, F>(
|
||||
fn self_closing_conditional<'a, F>(
|
||||
open_matcher: &'static str,
|
||||
constructor: F,
|
||||
) -> impl Fn(&'a str) -> IResult<&'a str, DustTag<'a>>
|
||||
|
||||
Reference in New Issue
Block a user