diff --git a/src/parser/element_parser.rs b/src/parser/element_parser.rs index 03a26d3..3ddc1f5 100644 --- a/src/parser/element_parser.rs +++ b/src/parser/element_parser.rs @@ -69,16 +69,22 @@ pub fn element( map(diary_sexp_matcher, Element::DiarySexp), map(fixed_width_area_matcher, Element::FixedWidthArea), map(horizontal_rule_matcher, Element::HorizontalRule), - map( - verify(paragraph_matcher, |_p| can_be_paragraph), - Element::Paragraph, - ), ))(remaining) { the_ok @ Ok(_) => the_ok, Err(_) => { - affiliated_keywords.clear(); - map(keyword_matcher, Element::Keyword)(input) + if can_be_paragraph { + match map(paragraph_matcher, Element::Paragraph)(remaining) { + the_ok @ Ok(_) => the_ok, + Err(_) => { + affiliated_keywords.clear(); + map(keyword_matcher, Element::Keyword)(input) + } + } + } else { + affiliated_keywords.clear(); + map(keyword_matcher, Element::Keyword)(input) + } } }?;