Do not use the plain text parser for property drawers.
This additional exit condition was causing property drawers to parse incorrectly.
This commit is contained in:
parent
f170a557ed
commit
6f2d90162b
@ -0,0 +1,7 @@
|
|||||||
|
** foo
|
||||||
|
:PROPERTIES:
|
||||||
|
:DESCRIPTION: lorem
|
||||||
|
:ALT_TITLE: ipsum
|
||||||
|
:END:
|
||||||
|
|
||||||
|
bar
|
@ -2,13 +2,14 @@ use nom::branch::alt;
|
|||||||
use nom::bytes::complete::is_not;
|
use nom::bytes::complete::is_not;
|
||||||
use nom::bytes::complete::tag;
|
use nom::bytes::complete::tag;
|
||||||
use nom::bytes::complete::tag_no_case;
|
use nom::bytes::complete::tag_no_case;
|
||||||
|
use nom::character::complete::anychar;
|
||||||
use nom::character::complete::line_ending;
|
use nom::character::complete::line_ending;
|
||||||
use nom::character::complete::space0;
|
use nom::character::complete::space0;
|
||||||
use nom::character::complete::space1;
|
use nom::character::complete::space1;
|
||||||
use nom::combinator::eof;
|
use nom::combinator::eof;
|
||||||
use nom::combinator::map;
|
|
||||||
use nom::combinator::opt;
|
use nom::combinator::opt;
|
||||||
use nom::combinator::recognize;
|
use nom::combinator::recognize;
|
||||||
|
use nom::combinator::verify;
|
||||||
use nom::multi::many_till;
|
use nom::multi::many_till;
|
||||||
use nom::sequence::tuple;
|
use nom::sequence::tuple;
|
||||||
|
|
||||||
@ -23,7 +24,6 @@ use crate::parser::greater_element::PropertyDrawer;
|
|||||||
use crate::parser::parser_context::ContextElement;
|
use crate::parser::parser_context::ContextElement;
|
||||||
use crate::parser::parser_context::ExitMatcherNode;
|
use crate::parser::parser_context::ExitMatcherNode;
|
||||||
use crate::parser::parser_with_context::parser_with_context;
|
use crate::parser::parser_with_context::parser_with_context;
|
||||||
use crate::parser::plain_text::plain_text;
|
|
||||||
use crate::parser::util::exit_matcher_parser;
|
use crate::parser::util::exit_matcher_parser;
|
||||||
use crate::parser::util::get_consumed;
|
use crate::parser::util::get_consumed;
|
||||||
use crate::parser::util::immediate_in_section;
|
use crate::parser::util::immediate_in_section;
|
||||||
@ -147,11 +147,16 @@ fn node_property_name<'r, 's>(
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
let (remaining, name) = recognize(tuple((
|
let (remaining, name) = recognize(tuple((
|
||||||
map(parser_with_context!(plain_text)(&parser_context), |pt| {
|
verify(
|
||||||
pt.source
|
many_till(
|
||||||
}),
|
anychar,
|
||||||
|
parser_with_context!(exit_matcher_parser)(&parser_context),
|
||||||
|
),
|
||||||
|
|(children, _exit_contents)| !children.is_empty(),
|
||||||
|
),
|
||||||
opt(tag("+")),
|
opt(tag("+")),
|
||||||
)))(input)?;
|
)))(input)?;
|
||||||
|
|
||||||
Ok((remaining, name))
|
Ok((remaining, name))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user