I need to prevent matching bold inside a bold.
This commit is contained in:
parent
b27be8eab1
commit
0c676c44c2
@ -222,15 +222,11 @@ fn flat_text_element<'s, 'r>(
|
|||||||
))(i)
|
))(i)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn recognize_bold_end<'s, 'r>(context: Context<'r, 's>, input: &'s str) -> Res<&'s str, &'s str> {
|
|
||||||
recognize(bold_end)(input)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn flat_bold<'s, 'r>(context: Context<'r, 's>, i: &'s str) -> Res<&'s str, Bold<'s>> {
|
fn flat_bold<'s, 'r>(context: Context<'r, 's>, i: &'s str) -> Res<&'s str, Bold<'s>> {
|
||||||
let bold_start = parser_with_context!(context_bold_start)(&context);
|
let bold_start = parser_with_context!(context_bold_start)(&context);
|
||||||
let nom_context =
|
let nom_context =
|
||||||
context.with_additional_node(ContextElement::FailMatcherNode(FailMatcherNode {
|
context.with_additional_node(ContextElement::FailMatcherNode(FailMatcherNode {
|
||||||
fail_matcher: ChainBehavior::AndParent(Some(&recognize_bold_end)),
|
fail_matcher: ChainBehavior::AndParent(Some(&context_bold_end)),
|
||||||
}));
|
}));
|
||||||
let (remaining, captured) = recognize(tuple((bold_start, |i| {
|
let (remaining, captured) = recognize(tuple((bold_start, |i| {
|
||||||
context_many_till(&nom_context, flat_text_element, context_bold_end)(i)
|
context_many_till(&nom_context, flat_text_element, context_bold_end)(i)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user