Add a context element for tracking whether or not elements should consume their trailing whitespace.
This commit is contained in:
@@ -100,10 +100,11 @@ pub fn document(input: &str) -> Res<&str, Document> {
|
||||
fn section<'r, 's>(context: Context<'r, 's>, input: &'s str) -> Res<&'s str, Section<'s>> {
|
||||
// TODO: The zeroth section is specialized so it probably needs its own parser
|
||||
let parser_context = context
|
||||
.with_additional_node(ContextElement::ConsumeTrailingWhitespace(true))
|
||||
.with_additional_node(ContextElement::Context("section"))
|
||||
.with_additional_node(ContextElement::ExitMatcherNode(ExitMatcherNode {
|
||||
exit_matcher: ChainBehavior::AndParent(Some(§ion_end)),
|
||||
}))
|
||||
.with_additional_node(ContextElement::Context("section"));
|
||||
}));
|
||||
let element_matcher = parser_with_context!(element)(&parser_context);
|
||||
let exit_matcher = parser_with_context!(exit_matcher_parser)(&parser_context);
|
||||
let trailing_matcher = parser_with_context!(element_trailing_whitespace)(&parser_context);
|
||||
|
||||
Reference in New Issue
Block a user