diff --git a/taskwarrior/info.json b/taskwarrior/info.json
index 774291c..e19d864 100644
--- a/taskwarrior/info.json
+++ b/taskwarrior/info.json
@@ -6,5 +6,5 @@
"minAppVersion": "17.06.1",
"authors": ["@fmakowski"],
"platforms": ["linux", "macos"],
- "description" : "This script creates menu items and buttons to import and export Taskwarrior tasks.\n\nDependencies\n\nUnix-like OSes only!\nTaskwarrior\n\nUsage\n\nExport:\nThe script takes selected text from your note and parse it to create task entries based on it. The following rules currently apply for the test to be parsed correctly:\n * the project is defined by writing \"project:\" (case-insensitive) immediately followed by the project name; the rest of the line content is skipped\n * the task is defined by making a list item, using either - (minus) or * (asterisk) at the beginning; the task description taken will be used with the most recently detected project name to create a new task\n\nImport:\nThe script takes selected text from your note, parsing it into the project names you want to fetch from Taskwarrior into the note. The tasks will be written as a list right below the selection. The project names will be appended before the lists As \"Project: [projectName]\" to separate lists.To Do\n\n * foolproof used regexps\n * make project nesting easier\n * use headers to determine project name and nesting\n * Windows support\n * Taskwarrior parameter parsing (like tags, dates, priority, etc.)"
+ "description" : "This script creates menu items and buttons to import and export Taskwarrior tasks.\n\nDependencies\n\nUnix-like OSes only!\nTaskwarrior\n\nUsage\n\nExport:\nThe script takes selected text from your note and parse it to create task entries based on it. The following rules currently apply for the test to be parsed correctly:\n * the project is defined by writing \"project:\" (case-insensitive) immediately followed by the project name; the rest of the line content is skipped\n * the headers (lines starting with #) are also considered as project names - no nesting available yet\n * the task is defined by making a list item, using either - (minus) or * (asterisk) at the beginning; the task description taken will be used with the most recently detected project name to create a new task\n\nImport:\nThe script takes selected text from your note, parsing it into the project names you want to fetch from Taskwarrior into the note. The tasks will be written as a list right below the selection. The project names will be appended before the lists As \"Project: [projectName]\" to separate lists.To Do\n\n * foolproof used regexps\n * make project nesting easier\n * Windows support\n * Taskwarrior parameter parsing (like tags, dates, priority, etc.)"
}
diff --git a/taskwarrior/taskwarrior.qml b/taskwarrior/taskwarrior.qml
index 57e1908..5a1c904 100644
--- a/taskwarrior/taskwarrior.qml
+++ b/taskwarrior/taskwarrior.qml
@@ -45,10 +45,11 @@ QtObject {
function getProjectNameAndRun(str, func) {
// We are trying to get the name of the project.
// To do so, we are getting the substring of a line by using regexp group.
- var projectRegExp = /project:[\s*]?(.+)?[\s*]?/i;
+ var projectRegExp = /(project:[\s*]?(.+)?[\s*]?)|(#+[\s*]?(.+)?[\s*]?)/i;
var isProjectName = projectRegExp.exec(str);
if (isProjectName) {
- func(isProjectName[1]);
+ var projectName = isProjectName[2] ? isProjectName[2] : isProjectName[4];
+ func(projectName);
return true;
}
}