Add affiliated keyword matching to the detect_* functions.

This commit is contained in:
Tom Alexander
2023-10-04 21:03:32 -04:00
parent d8102b7bc2
commit 786521ad4a
13 changed files with 21 additions and 33 deletions

View File

@@ -71,7 +71,6 @@ fn _element<'b, 'g, 'r, 's>(
let fixed_width_area_matcher = parser_with_context!(fixed_width_area)(context);
let horizontal_rule_matcher = parser_with_context!(horizontal_rule)(context);
let keyword_matcher = parser_with_context!(keyword)(context);
let affiliated_keyword_matcher = parser_with_context!(affiliated_keyword)(context);
let babel_keyword_matcher = parser_with_context!(babel_call_keyword)(context);
let paragraph_matcher = parser_with_context!(paragraph)(context);
let latex_environment_matcher = parser_with_context!(latex_environment)(context);
@@ -105,11 +104,11 @@ fn _element<'b, 'g, 'r, 's>(
the_ok @ Ok(_) => the_ok,
Err(_) => {
// TODO: Because this function expects a single element, if there are multiple affiliated keywords before an element that cannot have affiliated keywords, we end up re-parsing the affiliated keywords many times.
map(affiliated_keyword_matcher, Element::Keyword)(input)
map(affiliated_keyword, Element::Keyword)(input)
}
}
} else {
map(affiliated_keyword_matcher, Element::Keyword)(input)
map(affiliated_keyword, Element::Keyword)(input)
}
}
}?;