Support export affiliated keywords.

This commit is contained in:
Tom Alexander 2023-08-29 17:01:35 -04:00
parent 9df40fb13f
commit 2ba0dc49be
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE
1 changed files with 7 additions and 0 deletions

View File

@ -2,6 +2,7 @@ use nom::branch::alt;
use nom::bytes::complete::is_not;
use nom::bytes::complete::tag;
use nom::bytes::complete::tag_no_case;
use nom::bytes::complete::take_while1;
use nom::character::complete::anychar;
use nom::character::complete::line_ending;
use nom::character::complete::space0;
@ -83,6 +84,7 @@ fn affiliated_key<'s>(input: OrgSource<'s>) -> Res<OrgSource<'s>, OrgSource<'s>>
alt((
recognize(tuple((dual_affiliated_key, tag("["), optval, tag("]")))),
plain_affiliated_key,
export_keyword
))(input)
}
@ -153,3 +155,8 @@ fn _optval_end<'s>(
}
tag("\n")(input)
}
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
fn export_keyword<'s>(input: OrgSource<'s>) -> Res<OrgSource<'s>, OrgSource<'s>> {
recognize(tuple((tag_no_case("attr_"), take_while1(|c: char| c.is_alphanumeric() || "-_".contains(c)))))(input)
}