This commit is contained in:
Rob Pilling 2024-11-27 12:03:21 +00:00 committed by GitHub
commit cde79a4ae3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 7 additions and 1 deletions

View file

@ -45,6 +45,11 @@ pub struct ParseConfig {
///
/// Equivalent to [`org-element-affiliated-keywords`](https://git.sr.ht/~bzg/org-mode/tree/6f960f3c6a4dfe137fbd33fef9f7dadfd229600c/item/lisp/org-element.el#L331)
pub affiliated_keywords: Vec<String>,
/// Control tag parsing
///
/// Defaults to org-mode's permitted characters: alphanumeric and `_@#%`.
pub is_tag_char: fn(char) -> bool,
}
impl ParseConfig {
@ -82,6 +87,7 @@ impl Default for ParseConfig {
"SRCNAME".into(),
"TBLNAME".into(),
],
is_tag_char: |c| c.is_alphanumeric() || c == '_' || c == '@' || c == '#' || c == '%',
}
}
}

View file

@ -173,7 +173,7 @@ fn headline_tags_node(input: Input) -> IResult<Input, GreenElement, ()> {
} else if String::from_utf8_lossy(item)
.chars()
// https://github.com/yyr/org-mode/blob/d8494b5668ad4d4e68e83228ae8451eaa01d2220/lisp/org-element.el#L922C25-L922C32
.all(|c| c.is_alphanumeric() || c == '_' || c == '@' || c == '#' || c == '%')
.all(input.c.is_tag_char)
{
children.push(input.slice(ii + 1..i).text_token());
children.push(token(COLON, ":"));