-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: extract tags from task summary
Signed-off-by: Raimund Schlüßler <[email protected]>
- Loading branch information
1 parent
c2fc5ac
commit 02748bd
Showing
3 changed files
with
58 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -449,11 +449,33 @@ function searchSubTasks(task, searchQuery) { | |
}) | ||
} | ||
|
||
/** | ||
Check warning on line 452 in src/store/storeHelper.js
|
||
* Parses a string to extract tags and a summary | ||
* | ||
* @param {string} string The string | ||
* @return {object} The object containing the parsed results | ||
*/ | ||
function parseString(str) { | ||
const matches = str.matchAll(/\s?#([^\s#]+)/g) | ||
let summary = str | ||
const tags = [] | ||
for (const match of matches) { | ||
tags.push(match[1]) | ||
summary = summary.replace(match[0], '') | ||
} | ||
summary = summary.trim() | ||
return { | ||
summary, | ||
tags, | ||
} | ||
} | ||
|
||
export { | ||
isTaskInList, | ||
overdue, | ||
isParentInList, | ||
sort, | ||
momentToICALTime, | ||
searchSubTasks, | ||
parseString, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters