Add an exit matcher to plain text.

This commit is contained in:
Tom Alexander
2023-04-22 19:46:27 -04:00
parent 9a3bde0d80
commit a4cce121c0
3 changed files with 35 additions and 4 deletions

View File

@@ -43,3 +43,17 @@ pub fn minimal_set_object<'r, 's>(
map(parser_with_context!(plain_text)(context), Object::PlainText),
))(input)
}
#[tracing::instrument(ret, level = "debug")]
pub fn any_object_except_plain_text<'r, 's>(
context: Context<'r, 's>,
input: &'s str,
) -> Res<&'s str, Object<'s>> {
// TODO: add entities, LaTeX fragments, export snippets, footnote references, citations (NOT citation references), inline babel calls, inline source blocks, line breaks, links, macros, targets and radio targets, statistics cookies, subscript and superscript, timestamps, and text markup.
not(|i| context.check_exit_matcher(i))(input)?;
alt((map(
parser_with_context!(text_markup)(context),
Object::TextMarkup,
),))(input)
}