Code structure for radio links and radio targets.

This commit is contained in:
Tom Alexander
2023-04-24 18:55:15 -04:00
parent 5c37373419
commit 64c17e654a
5 changed files with 132 additions and 7 deletions

View File

@@ -8,6 +8,8 @@ use super::regular_link::regular_link;
use super::Context;
use crate::error::Res;
use crate::parser::object::Object;
use crate::parser::radio_link::radio_link;
use crate::parser::radio_link::radio_target;
use crate::parser::text_markup::text_markup;
#[tracing::instrument(ret, level = "debug")]
@@ -19,6 +21,11 @@ pub fn standard_set_object<'r, 's>(
not(|i| context.check_exit_matcher(i))(input)?;
alt((
map(parser_with_context!(radio_link)(context), Object::RadioLink),
map(
parser_with_context!(radio_target)(context),
Object::RadioTarget,
),
parser_with_context!(text_markup)(context),
map(
parser_with_context!(regular_link)(context),
@@ -33,7 +40,7 @@ pub fn minimal_set_object<'r, 's>(
context: Context<'r, 's>,
input: &'s str,
) -> Res<&'s str, Object<'s>> {
// TODO: add text markup, entities, LaTeX fragments, superscripts and subscripts
// TODO: add entities, LaTeX fragments, superscripts and subscripts
not(|i| context.check_exit_matcher(i))(input)?;
alt((
@@ -49,6 +56,11 @@ 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!(radio_link)(context), Object::RadioLink),
map(
parser_with_context!(radio_target)(context),
Object::RadioTarget,
),
parser_with_context!(text_markup)(context),
map(
parser_with_context!(regular_link)(context),