diff --git a/org_mode_samples/lesser_element/keyword/floating_affiliated_keyword.org b/org_mode_samples/lesser_element/keyword/floating_affiliated_keyword.org index defa8014..f3aa34a0 100644 --- a/org_mode_samples/lesser_element/keyword/floating_affiliated_keyword.org +++ b/org_mode_samples/lesser_element/keyword/floating_affiliated_keyword.org @@ -7,3 +7,9 @@ #+name: cat #+foo: dog [[file:lorem/ipsum.png]] + +#+name: cat +#+foo: dog + + +foo diff --git a/src/parser/element_parser.rs b/src/parser/element_parser.rs index eb3e7071..d5d75c00 100644 --- a/src/parser/element_parser.rs +++ b/src/parser/element_parser.rs @@ -87,6 +87,7 @@ fn _element<'r, 's>( map(fixed_width_area_matcher, Element::FixedWidthArea), map(horizontal_rule_matcher, Element::HorizontalRule), map(latex_environment_matcher, Element::LatexEnvironment), + map(keyword_matcher, Element::Keyword), ))(remaining) { the_ok @ Ok(_) => the_ok, @@ -96,12 +97,12 @@ fn _element<'r, 's>( the_ok @ Ok(_) => the_ok, Err(_) => { affiliated_keywords.clear(); - map(keyword_matcher, Element::Keyword)(input) + map(affiliated_keyword_matcher, Element::Keyword)(input) } } } else { affiliated_keywords.clear(); - map(keyword_matcher, Element::Keyword)(input) + map(affiliated_keyword_matcher, Element::Keyword)(input) } } }?; diff --git a/src/parser/keyword.rs b/src/parser/keyword.rs index f115fbad..1ee1e6ef 100644 --- a/src/parser/keyword.rs +++ b/src/parser/keyword.rs @@ -60,7 +60,6 @@ pub fn affiliated_keyword<'r, 's>( input: OrgSource<'s>, ) -> Res, Keyword<'s>> { start_of_line(input)?; - // org-element-dual-keywords // TODO: When key is a member of org-element-parsed-keywords, value can contain the standard set objects, excluding footnote references. let (remaining, rule) = recognize(tuple(( @@ -84,7 +83,7 @@ fn affiliated_key<'s>(input: OrgSource<'s>) -> Res, OrgSource<'s>> alt(( recognize(tuple((dual_affiliated_key, tag("["), optval, tag("]")))), plain_affiliated_key, - export_keyword + export_keyword, ))(input) } @@ -148,7 +147,7 @@ fn _optval_end<'s>( unreachable!("Exceeded optval bracket depth.") } if current_depth == 0 { - let close_bracket = tag::<&str, OrgSource<'_>, CustomError>>("]")(input); + let close_bracket = tag::<_, _, CustomError<_>>("]")(input); if close_bracket.is_ok() { return close_bracket; } @@ -158,5 +157,8 @@ fn _optval_end<'s>( #[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))] fn export_keyword<'s>(input: OrgSource<'s>) -> Res, OrgSource<'s>> { - recognize(tuple((tag_no_case("attr_"), take_while1(|c: char| c.is_alphanumeric() || "-_".contains(c)))))(input) + recognize(tuple(( + tag_no_case("attr_"), + take_while1(|c: char| c.is_alphanumeric() || "-_".contains(c)), + )))(input) }