Bold not getting detected.

This commit is contained in:
Tom Alexander
2022-11-25 18:23:51 -05:00
parent cdb35edd64
commit 9c54689bd9
3 changed files with 16 additions and 4 deletions

View File

@@ -24,6 +24,7 @@ use nom::error::VerboseError;
use nom::multi::many_till;
use nom::sequence::tuple;
use nom::IResult;
use tracing::instrument;
fn flat_text_element<'s, 'r>(
i: &'s str,
@@ -44,21 +45,21 @@ fn flat_text_element<'s, 'r>(
))(i)
}
#[instrument]
fn recognize_bold_end(input: &str) -> Res<&str, &str> {
recognize(bold_end)(input)
}
#[instrument]
fn flat_bold<'s, 'r>(i: &'s str, context: &'r OrgModeContext<'r>) -> Res<&'s str, TextElement<'s>> {
let new_context = context.with_additional_fail_matcher(&recognize_bold_end);
let text_element_parser = parser_with_context!(flat_text_element)(&new_context);
let (remaining, captured) = recognize(tuple((
bold_start,
many_till(text_element_parser, bold_end),
bold_end
bold_end,
)))(i)?;
let ret = TextElement::Bold(Bold {
contents: captured
});
let ret = TextElement::Bold(Bold { contents: captured });
Ok((remaining, ret))
}