Implement the statistics cookie parser.

This commit is contained in:
Tom Alexander
2023-07-22 02:08:42 -04:00
parent c73e26e2d6
commit b8b2e33137
3 changed files with 56 additions and 5 deletions

View File

@@ -21,6 +21,7 @@ use crate::parser::org_macro::org_macro;
use crate::parser::plain_link::plain_link;
use crate::parser::radio_link::radio_link;
use crate::parser::radio_link::radio_target;
use crate::parser::statistics_cookie::statistics_cookie;
use crate::parser::target::target;
use crate::parser::text_markup::text_markup;
@@ -29,10 +30,14 @@ pub fn standard_set_object<'r, 's>(
context: Context<'r, 's>,
input: &'s str,
) -> Res<&'s str, Object<'s>> {
// TODO: line breaks, targets (different from radio targets), statistics cookies, subscript and superscript, timestamps.
// TODO: subscript and superscript, timestamps.
not(|i| context.check_exit_matcher(i))(input)?;
alt((
map(
parser_with_context!(statistics_cookie)(context),
Object::StatisticsCookie,
),
map(parser_with_context!(target)(context), Object::Target),
map(parser_with_context!(line_break)(context), Object::LineBreak),
map(
@@ -100,6 +105,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!(statistics_cookie)(context),
Object::StatisticsCookie,
),
map(parser_with_context!(target)(context), Object::Target),
map(parser_with_context!(line_break)(context), Object::LineBreak),
map(
@@ -145,8 +154,12 @@ 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, 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 ]]
// TODO: add export snippets. 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!(statistics_cookie)(context),
Object::StatisticsCookie,
),
map(
parser_with_context!(inline_source_block)(context),
Object::InlineSourceBlock,