Fix nested bolds child eating the parent exit.

This commit is contained in:
Tom Alexander 2023-04-24 16:48:33 -04:00
parent ca57c91adf
commit ed174c1c41
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE
3 changed files with 15 additions and 12 deletions

View File

@ -0,0 +1,3 @@
foo *bar /baz *lorem* ipsum/ dolar* alpha
foo *bar /baz _lorem_ ipsum/ dolar* alpha

View File

@ -131,6 +131,12 @@ fn _text_markup_object<'r, 's, 'x>(
|(children, _exit_contents)| !children.is_empty(),
)(remaining)?;
if exit_matcher_parser(context, remaining).is_ok() {
return Err(nom::Err::Error(CustomError::MyError(MyError(
"Parent exit matcher is triggering.",
))));
}
// TODO: Sometimes its plain text, not objects
let (remaining, _close) = text_markup_end_specialized(context, remaining)?;
let (remaining, _trailing_whitespace) = space0(remaining)?;
@ -168,6 +174,12 @@ fn _text_markup_string<'r, 's, 'x>(
|(children, _exit_contents)| !children.is_empty(),
))(remaining)?;
if exit_matcher_parser(context, remaining).is_ok() {
return Err(nom::Err::Error(CustomError::MyError(MyError(
"Parent exit matcher is triggering.",
))));
}
// TODO: Sometimes its plain text, not objects
let (remaining, _close) = text_markup_end_specialized(context, remaining)?;
let (remaining, _trailing_whitespace) = space0(remaining)?;

View File

@ -1,13 +1 @@
prologue *goes here* I guess *bold
text*
bold*wont* start *or stop*when there is text outside it
I guess *regular
text*
[[foo][foo *bar]] baz* car
*nesting *bold entrances* and* exits