Create a template for new element functions that will take in the affiliated keywords instead of re-parsing them multiple times.

This commit is contained in:
Tom Alexander
2023-10-12 15:47:06 -04:00
parent 176e37874e
commit a6f36ba679
5 changed files with 29 additions and 4 deletions

View File

@@ -2,6 +2,7 @@ use nom::branch::alt;
use nom::combinator::map;
use nom::combinator::opt;
use nom::combinator::peek;
use nom::multi::many0;
use nom::sequence::tuple;
#[cfg(feature = "tracing")]
use tracing::span;
@@ -59,6 +60,8 @@ fn _element<'b, 'g, 'r, 's>(
input: OrgSource<'s>,
can_be_paragraph: bool,
) -> Res<OrgSource<'s>, Element<'s>> {
let (post_affiliated_keywords_input, affiliated_keywords) = many0(affiliated_keyword)(input)?;
let plain_list_matcher = parser_with_context!(plain_list)(context);
let greater_block_matcher = parser_with_context!(greater_block)(context);
let dynamic_block_matcher = parser_with_context!(dynamic_block)(context);