Implement the parser for inline babel calls.

This commit is contained in:
Tom Alexander
2023-07-21 21:38:32 -04:00
parent 2773b35438
commit 45b01012b3
4 changed files with 186 additions and 7 deletions

View File

@@ -12,6 +12,7 @@ use crate::parser::citation::citation;
use crate::parser::entity::entity;
use crate::parser::export_snippet::export_snippet;
use crate::parser::footnote_reference::footnote_reference;
use crate::parser::inline_babel_call::inline_babel_call;
use crate::parser::latex_fragment::latex_fragment;
use crate::parser::object::Object;
use crate::parser::org_macro::org_macro;
@@ -25,10 +26,14 @@ pub fn standard_set_object<'r, 's>(
context: Context<'r, 's>,
input: &'s str,
) -> Res<&'s str, Object<'s>> {
// TODO: 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.
// TODO: inline source blocks, line breaks, targets (different from radio targets), statistics cookies, subscript and superscript, timestamps.
not(|i| context.check_exit_matcher(i))(input)?;
alt((
map(
parser_with_context!(inline_babel_call)(context),
Object::InlineBabelCall,
),
map(parser_with_context!(citation)(context), Object::Citation),
map(
parser_with_context!(footnote_reference)(context),
@@ -86,6 +91,10 @@ pub fn any_object_except_plain_text<'r, 's>(
) -> Res<&'s str, Object<'s>> {
// Used for exit matchers so this does not check exit matcher condition.
alt((
map(
parser_with_context!(inline_babel_call)(context),
Object::InlineBabelCall,
),
map(parser_with_context!(citation)(context), Object::Citation),
map(
parser_with_context!(footnote_reference)(context),
@@ -121,6 +130,13 @@ pub fn regular_link_description_object_set<'r, 's>(
context: Context<'r, 's>,
input: &'s str,
) -> Res<&'s str, Object<'s>> {
// TODO: minimal set of objects as well as export snippets, inline babel calls, inline source blocks, macros, and statistics cookies. It can also contain another link, but only when it is a plain or angle link. It can contain square brackets, but not ]]
alt((parser_with_context!(minimal_set_object)(context),))(input)
// TODO: minimal set of objects as well as export snippets, inline source blocks, and statistics cookies. It can also contain another link, but only when it is a plain or angle link. It can contain square brackets, but not ]]
alt((
map(
parser_with_context!(inline_babel_call)(context),
Object::InlineBabelCall,
),
map(parser_with_context!(org_macro)(context), Object::OrgMacro),
parser_with_context!(minimal_set_object)(context),
))(input)
}