Take into account the source directory when parsing org-mode in Organic.

Previously only the emacs code was doing this.
This commit is contained in:
Tom Alexander
2023-09-04 21:46:40 -04:00
parent 275b4b53d1
commit d3c733c5ad
6 changed files with 61 additions and 15 deletions

View File

@@ -47,14 +47,24 @@ fn _filtered_keyword<'s, F: Matcher>(
) -> Res<OrgSource<'s>, Keyword<'s>> {
start_of_line(input)?;
// TODO: When key is a member of org-element-parsed-keywords, value can contain the standard set objects, excluding footnote references.
let (remaining, (consumed_input, (_, _, parsed_key, _, parsed_value, _))) = consumed(tuple((
space0,
tag("#+"),
key_parser,
tag(":"),
alt((recognize(tuple((space1, is_not("\r\n")))), space0)),
alt((line_ending, eof)),
)))(input)?;
let (remaining, (consumed_input, (_, _, parsed_key, _))) =
consumed(tuple((space0, tag("#+"), key_parser, tag(":"))))(input)?;
match tuple((space0, alt((line_ending, eof))))(remaining) {
Ok((remaining, _)) => {
return Ok((
remaining,
Keyword {
source: consumed_input.into(),
key: parsed_key.into(),
value: "".into(),
},
));
}
err @ Err(_) => err?,
};
let (remaining, _ws) = space1(remaining)?;
let (remaining, parsed_value) = is_not("\r\n")(remaining)?;
let (remaining, _ws) = tuple((space0, alt((line_ending, eof))))(remaining)?;
Ok((
remaining,
Keyword {

View File

@@ -46,4 +46,5 @@ mod token;
mod util;
pub use document::document;
pub use document::parse;
pub use document::parse_with_settings;
pub use org_source::OrgSource;