PoiScript / orgize

A Rust library for parsing org-mode files.
https://poiscript.github.io/orgize/
MIT License
289 stars 35 forks source link

Tags accept non-alphanumeric characters #16

Closed calmofthestorm closed 4 years ago

calmofthestorm commented 4 years ago

Another fairly minor issue with tag parsing is that Orgize will accept non-alphanumeric characters (e.g., parentheses) in tags. On the plus side, it handles Unicode alphanumeric characters correctly, the same way org-mode does:

fn main() {
    // Bad
    let org = orgize::Org::parse("* a :(:");
    assert!(org.headlines().next().unwrap().title(&org).tags.is_empty());

    // Good -- 郫县豆瓣酱 is alphanumeric.
    let org = orgize::Org::parse("* a :郫县豆瓣酱:");
    assert_eq!(vec!("郫县豆瓣酱"), org.headlines().next().unwrap().title(&org).tags);
}
PoiScript commented 4 years ago

I did a quick search, it seems tags should only accept alphanumeric characters, _, @ , # and %. I'll update the parser.

PoiScript commented 4 years ago

Fixed by v0.8.3.