Skip to content

Commit

Permalink
Allows backslash in project/context names
Browse files Browse the repository at this point in the history
  • Loading branch information
sanpii committed Jul 9, 2018
1 parent 1c37dff commit 32f23d0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ fn get_tags(regex: &::regex::Regex, subject: &str) -> Vec<String> {

macro_rules! regex_tags_shared {
() => {
"(?P<space>^|[\\s]){}(?P<tag>[\\w-]+)"
"(?P<space>^|[\\s]){}(?P<tag>[\\w\\\\-]+)"
};
}

Expand Down
8 changes: 5 additions & 3 deletions tests/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,13 @@ fn deplucate_contexts() {

#[test]
fn projects() {
let line = "Email SoAndSo at soandso@example.com +project1 @context2".to_owned();
let line =
"Email SoAndSo at soandso@example.com +project1 +project1\\subject1 @context2".to_owned();
let task = ::todo_txt::Task {
subject: "Email SoAndSo at soandso@example.com +project1 @context2".to_owned(),
subject: "Email SoAndSo at soandso@example.com +project1 +project1\\subject1 @context2"
.to_owned(),
contexts: vec!["context2".to_owned()],
projects: vec!["project1".to_owned()],
projects: vec!["project1".to_owned(), "project1\\subject1".to_owned()],
..Default::default()
};

Expand Down

0 comments on commit 32f23d0

Please sign in to comment.