Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -82,6 +87,7 @@ impl Default for ParseConfig {
"SRCNAME".into(),
"TBLNAME".into(),
],
is_tag_char: |c| c.is_alphanumeric() || c == '_' || c == '@' || c == '#' || c == '%',
}
}
}
2 changes: 1 addition & 1 deletion src/syntax/headline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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, ":"));
Expand Down