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:
parent
de4f420627
commit
52824b4d0b
@ -99,9 +99,9 @@ fn dust_tag(i: &str) -> IResult<&str, DustTag> {
|
|||||||
map(special, DustTag::DTSpecial),
|
map(special, DustTag::DTSpecial),
|
||||||
map(comment, DustTag::DTComment),
|
map(comment, DustTag::DTComment),
|
||||||
map(reference, DustTag::DTReference),
|
map(reference, DustTag::DTReference),
|
||||||
container("{#", DustTag::DTSection),
|
conditional("{#", DustTag::DTSection),
|
||||||
container("{?", DustTag::DTExists),
|
conditional("{?", DustTag::DTExists),
|
||||||
container("{^", DustTag::DTNotExists),
|
conditional("{^", DustTag::DTNotExists),
|
||||||
))(i)
|
))(i)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -154,7 +154,7 @@ fn reference(i: &str) -> IResult<&str, Reference> {
|
|||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn container<'a, F>(
|
fn conditional<'a, F>(
|
||||||
open_matcher: &'static str,
|
open_matcher: &'static str,
|
||||||
constructor: F,
|
constructor: F,
|
||||||
) -> impl Fn(&'a str) -> IResult<&'a str, DustTag<'a>>
|
) -> impl Fn(&'a str) -> IResult<&'a str, DustTag<'a>>
|
||||||
@ -162,12 +162,12 @@ where
|
|||||||
F: Copy + Fn(Container<'a>) -> DustTag<'a>,
|
F: Copy + Fn(Container<'a>) -> DustTag<'a>,
|
||||||
{
|
{
|
||||||
alt((
|
alt((
|
||||||
container_with_body(open_matcher, constructor),
|
conditional_with_body(open_matcher, constructor),
|
||||||
self_closing_container(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,
|
open_matcher: &'static str,
|
||||||
constructor: F,
|
constructor: F,
|
||||||
) -> impl Fn(&'a str) -> IResult<&'a str, DustTag<'a>>
|
) -> 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,
|
open_matcher: &'static str,
|
||||||
constructor: F,
|
constructor: F,
|
||||||
) -> impl Fn(&'a str) -> IResult<&'a str, DustTag<'a>>
|
) -> impl Fn(&'a str) -> IResult<&'a str, DustTag<'a>>
|
||||||
|
Loading…
Reference in New Issue
Block a user