diff --git a/src/parser/affiliated_keyword.rs b/src/parser/affiliated_keyword.rs index 498033f..92b59fc 100644 --- a/src/parser/affiliated_keyword.rs +++ b/src/parser/affiliated_keyword.rs @@ -25,12 +25,15 @@ use crate::types::AffiliatedKeywordValue; use crate::types::AffiliatedKeywords; use crate::types::Keyword; -pub(crate) fn parse_affiliated_keywords<'g, 's>( +pub(crate) fn parse_affiliated_keywords<'g, 's, AK>( global_settings: &'g GlobalSettings<'g, 's>, - input: Vec>, -) -> AffiliatedKeywords<'s> { + input: AK, +) -> AffiliatedKeywords<'s> +where + AK: IntoIterator>, +{ let mut ret = BTreeMap::new(); - for kw in input.into_iter() { + for kw in input { let translated_name = translate_name(global_settings, kw.key); if is_single_string_keyword(global_settings, translated_name.as_str()) { ret.insert( diff --git a/src/parser/element_parser.rs b/src/parser/element_parser.rs index 6288efb..0be0504 100644 --- a/src/parser/element_parser.rs +++ b/src/parser/element_parser.rs @@ -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, 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); diff --git a/src/parser/macros.rs b/src/parser/macros.rs new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/src/parser/macros.rs @@ -0,0 +1 @@ + diff --git a/src/parser/mod.rs b/src/parser/mod.rs index c9c2e6e..dff7f19 100644 --- a/src/parser/mod.rs +++ b/src/parser/mod.rs @@ -27,6 +27,7 @@ mod latex_environment; mod latex_fragment; mod lesser_block; mod line_break; +mod macros; mod object_parser; mod org_macro; mod org_source; diff --git a/src/parser/plain_list.rs b/src/parser/plain_list.rs index 3035f6b..adb0dc3 100644 --- a/src/parser/plain_list.rs +++ b/src/parser/plain_list.rs @@ -43,6 +43,7 @@ use crate::parser::util::org_space; use crate::parser::util::start_of_line; use crate::types::CheckboxType; use crate::types::IndentationLevel; +use crate::types::Keyword; use crate::types::Object; use crate::types::PlainList; use crate::types::PlainListItem; @@ -79,6 +80,22 @@ pub(crate) fn detect_plain_list<'b, 'g, 'r, 's>( )))); } +#[cfg_attr( + feature = "tracing", + tracing::instrument(ret, level = "debug", skip(context)) +)] +pub(crate) fn new_plain_list<'b, 'g, 'r, 's, AK>( + affiliated_keywords: AK, + remaining: OrgSource<'s>, + context: RefContext<'b, 'g, 'r, 's>, + input: OrgSource<'s>, +) -> Res, PlainList<'s>> +where + AK: Iterator>, +{ + todo!() +} + #[cfg_attr( feature = "tracing", tracing::instrument(ret, level = "debug", skip(context))