From c8da42b123592ee2278334a1d6ce6e79f1998f27 Mon Sep 17 00:00:00 2001 From: Jimmy Lv Date: Tue, 10 Jul 2018 23:38:17 +0800 Subject: [PATCH 1/4] close #370: add * [ ] as task bullet to make todo list compatible with Markdown syntax --- PlainTasks.py | 14 +++++++------- PlainTasks.sublime-syntax | 8 ++++---- PlainTasks.tmLanguage | 8 ++++---- Readme.md | 6 +++--- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/PlainTasks.py b/PlainTasks.py index 71cbdf0..03b20cb 100644 --- a/PlainTasks.py +++ b/PlainTasks.py @@ -154,9 +154,9 @@ def runCommand(self, edit): original = [r for r in self.view.sel()] done_line_end, now = self.format_line_end(self.done_tag, tznow()) offset = len(done_line_end) - rom = r'^(\s*)(\[\s\]|.)(\s*.*)$' + rom = r'^(\s*)(\*?\s?\[\s\]|.)(\s*.*)$' rdm = r''' - (?x)^(\s*)(\[x\]|.) # 0,1 indent & bullet + (?x)^(\s*)(\*?\s?\[x\]|.) # 0,1 indent & bullet (\s*[^\b]*?(?:[^\@]|(? match - ^\s*(?:(\+|✓|✔|☑|√|\[x\])(\s+(?:[^\@\n]|(?<!\s)\@|\@(?=\s))*)([^\n]*))|^\s*(?:(-)(\s+(?:[^\@]|(?<!\s)\@|\@(?=\s))*)(.*\@done(?=\s|\(|$)[^\n]*)) + ^\s*(?:(\+|✓|✔|☑|√|\*?\s?\[x\])(\s+(?:[^\@\n]|(?<!\s)\@|\@(?=\s))*)([^\n]*))|^\s*(?:(-)(\s+(?:[^\@]|(?<!\s)\@|\@(?=\s))*)(.*\@done(?=\s|\(|$)[^\n]*)) name meta.item.todo.completed @@ -96,14 +96,14 @@ match - ^\s*(?:(✘|x|\[-\])(\s+(?:[^\@\n]|(?<!\s)\@|\@(?=\s))*)(.*))|^\s*(?:(-)(\s+(?:[^\@]|(?<!\s)\@|\@(?=\s))*)(.*\@cancelled(?=\s|\(|$)[^\n]*)) + ^\s*(?:(✘|x|\*?\s?\[-\])(\s+(?:[^\@\n]|(?<!\s)\@|\@(?=\s))*)(.*))|^\s*(?:(-)(\s+(?:[^\@]|(?<!\s)\@|\@(?=\s))*)(.*\@cancelled(?=\s|\(|$)[^\n]*)) name meta.item.todo.cancelled begin - ^\s*(?!-|\+|✓|✔|√|❍|❑|■|□|☐|▪|▫|–|—|≡|→|›|\[[\sx-]\]|_|✘|(x\s+))(?=\S) + ^\s*(?!-|\+|✓|✔|√|❍|❑|■|□|☐|▪|▫|–|—|≡|→|›|\*?\s?\[[\sx-]\]|_|✘|(x\s+))(?=\S) end $\n? name @@ -135,7 +135,7 @@ begin - ^\s*(-|❍|❑|■|□|☐|▪|▫|–|—|≡|→|›|\[\s\])(?=(\s+(?:[^\@\n]|(?<![ \t])\@)*)(?!([^\n]*)?(\@done|\@cancelled)[\s\(])) + ^\s*(-|❍|❑|■|□|☐|▪|▫|–|—|≡|→|›|\*?\s?\[\s\])(?=(\s+(?:[^\@\n]|(?<![ \t])\@)*)(?!([^\n]*)?(\@done|\@cancelled)[\s\(])) end $ name diff --git a/Readme.md b/Readme.md index 9e31799..6bcc94d 100644 --- a/Readme.md +++ b/Readme.md @@ -173,9 +173,9 @@ Here is a list of PlainTasks’ specific settings: | Setting | Default | Options/Description | | ------------------------------ | ---------------- | ----------------------------------------------------------------------- | -| **open_tasks_bullet** | `☐` | `-` `❍` `❑` `■` `□` `☐` `▪` `▫` `–` `—` `≡` `→` `›` `[ ]` | -| **done_tasks_bullet** | `✔` | `✓` `☑` `+` `[x]` | -| **cancelled_tasks_bullet** | `✘` | `x` `[-]` | +| **open_tasks_bullet** | `☐` | `-` `❍` `❑` `■` `□` `☐` `▪` `▫` `–` `—` `≡` `→` `›` `[ ]` `* [ ]` | +| **done_tasks_bullet** | `✔` | `✓` `☑` `+` `[x]` `* [x]` | +| **cancelled_tasks_bullet** | `✘` | `x` `[-]` `* [-]` | | **date_format** | `(%y-%m-%d %H:%M)` | See [strfti.me](http://www.strfti.me/) for quick reference; detailed documentation: [ST2](https://docs.python.org/2.6/library/datetime.html#strftime-and-strptime-behavior), [ST3](https://docs.python.org/3.3/library/datetime.html#strftime-and-strptime-behavior) | | **done_tag** | true | Determines whether done tasks should gain a `@done` tag or not | | **done_date** | true | Determines whether done tasks should gain a date or not | From 49c8e9688443165801e27fafdbed08dbea4502e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=95=E7=AB=8B=E9=9D=92?= Date: Tue, 3 Sep 2019 17:44:50 +0800 Subject: [PATCH 2/4] Update PlainTasks.py --- PlainTasks.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/PlainTasks.py b/PlainTasks.py index 03b20cb..698f572 100644 --- a/PlainTasks.py +++ b/PlainTasks.py @@ -154,9 +154,9 @@ def runCommand(self, edit): original = [r for r in self.view.sel()] done_line_end, now = self.format_line_end(self.done_tag, tznow()) offset = len(done_line_end) - rom = r'^(\s*)(\*?\s?\[\s\]|.)(\s*.*)$' + rom = r'^(\s*)((?:\*\s)?\[\s\]|.)(\s*.*)$' rdm = r''' - (?x)^(\s*)(\*?\s?\[x\]|.) # 0,1 indent & bullet + (?x)^(\s*)((?:\*\s)?\[x\]|.) # 0,1 indent & bullet (\s*[^\b]*?(?:[^\@]|(? Date: Tue, 3 Sep 2019 17:46:03 +0800 Subject: [PATCH 3/4] Update PlainTasks.tmLanguage --- PlainTasks.tmLanguage | 548 +++++++++++++++++++++--------------------- 1 file changed, 274 insertions(+), 274 deletions(-) diff --git a/PlainTasks.tmLanguage b/PlainTasks.tmLanguage index b931250..9b5fbe8 100644 --- a/PlainTasks.tmLanguage +++ b/PlainTasks.tmLanguage @@ -2,297 +2,297 @@ - fileTypes - - todo - tasks - todolist.txt - - keyEquivalent - ^~T - name - Tasks - patterns - - - match - ^\s*(\w+.*?:\s*?(\@[^\s]+(\(.*?\))?\s*?)*$\n?) - name - keyword.control.header.todo - + fileTypes + + todo + tasks + todolist.txt + + keyEquivalent + ^~T + name + Tasks + patterns + + + match + ^\s*(\w+.*?:\s*?(\@[^\s]+(\(.*?\))?\s*?)*$\n?) + name + keyword.control.header.todo + - - captures - - 1 - - name - punctuation.definition.bullet.completed.todo - - 2 - - name - comment.line.completed.todo - - 3 - - name - meta.tag.todo.completed - - 4 - - name - punctuation.definition.bullet.completed.todo - - 5 - - name - comment.line.completed.todo - - 6 - - name - meta.tag.todo.completed - - - match - ^\s*(?:(\+|✓|✔|☑|√|\*?\s?\[x\])(\s+(?:[^\@\n]|(?<!\s)\@|\@(?=\s))*)([^\n]*))|^\s*(?:(-)(\s+(?:[^\@]|(?<!\s)\@|\@(?=\s))*)(.*\@done(?=\s|\(|$)[^\n]*)) - name - meta.item.todo.completed - + + captures + + 1 + + name + punctuation.definition.bullet.completed.todo + + 2 + + name + comment.line.completed.todo + + 3 + + name + meta.tag.todo.completed + + 4 + + name + punctuation.definition.bullet.completed.todo + + 5 + + name + comment.line.completed.todo + + 6 + + name + meta.tag.todo.completed + + + match + ^\s*(?:(\+|✓|✔|☑|√|(?:\*\s)?\[x\])(\s+(?:[^\@\n]|(?<!\s)\@|\@(?=\s))*)([^\n]*))|^\s*(?:(-)(\s+(?:[^\@]|(?<!\s)\@|\@(?=\s))*)(.*\@done(?=\s|\(|$)[^\n]*)) + name + meta.item.todo.completed + - - captures - - 1 - - name - punctuation.definition.bullet.cancelled.todo - - 2 - - name - text.cancelled.todo - - 3 - - name - meta.tag.todo.cancelled - - 4 - - name - punctuation.definition.bullet.cancelled.todo - - 5 - - name - text.cancelled.todo - - 6 - - name - meta.tag.todo.cancelled - - - match - ^\s*(?:(✘|x|\*?\s?\[-\])(\s+(?:[^\@\n]|(?<!\s)\@|\@(?=\s))*)(.*))|^\s*(?:(-)(\s+(?:[^\@]|(?<!\s)\@|\@(?=\s))*)(.*\@cancelled(?=\s|\(|$)[^\n]*)) - name - meta.item.todo.cancelled - + + captures + + 1 + + name + punctuation.definition.bullet.cancelled.todo + + 2 + + name + text.cancelled.todo + + 3 + + name + meta.tag.todo.cancelled + + 4 + + name + punctuation.definition.bullet.cancelled.todo + + 5 + + name + text.cancelled.todo + + 6 + + name + meta.tag.todo.cancelled + + + match + ^\s*(?:(✘|x|(?:\*\s)?\[-\])(\s+(?:[^\@\n]|(?<!\s)\@|\@(?=\s))*)(.*))|^\s*(?:(-)(\s+(?:[^\@]|(?<!\s)\@|\@(?=\s))*)(.*\@cancelled(?=\s|\(|$)[^\n]*)) + name + meta.item.todo.cancelled + - - begin - ^\s*(?!-|\+|✓|✔|√|❍|❑|■|□|☐|▪|▫|–|—|≡|→|›|\*?\s?\[[\sx-]\]|_|✘|(x\s+))(?=\S) - end - $\n? - name - notes.todo - patterns - - - include - #italic - - - include - #bold - - - include - #url - - - + + begin + ^\s*(?!-|\+|✓|✔|√|❍|❑|■|□|☐|▪|▫|–|—|≡|→|›|(?:\*\s)?\[[\sx-]\]|_|✘|(x\s+))(?=\S) + end + $\n? + name + notes.todo + patterns + + + include + #italic + + + include + #bold + + + include + #url + + + - - captures - - 1 - - name - punctuation.definition.bullet.pending.todo - - - begin - ^\s*(-|❍|❑|■|□|☐|▪|▫|–|—|≡|→|›|\*?\s?\[\s\])(?=(\s+(?:[^\@\n]|(?<![ \t])\@)*)(?!([^\n]*)?(\@done|\@cancelled)[\s\(])) - end - $ - name - meta.item.todo.pending - patterns - - - include - #italic - - - include - #bold - - - include - #url - - - include - #tag - - - include - #today - - - include - #low - - - include - #high - - - include - #critical - - - + + captures + + 1 + + name + punctuation.definition.bullet.pending.todo + + + begin + ^\s*(-|❍|❑|■|□|☐|▪|▫|–|—|≡|→|›|(?:\*\s)?\[\s\])(?=(\s+(?:[^\@\n]|(?<![ \t])\@)*)(?!([^\n]*)?(\@done|\@cancelled)[\s\(])) + end + $ + name + meta.item.todo.pending + patterns + + + include + #italic + + + include + #bold + + + include + #url + + + include + #tag + + + include + #today + + + include + #low + + + include + #high + + + include + #critical + + + - - match - ^_+$ - name - meta.punctuation.archive.todo - + + match + ^_+$ + name + meta.punctuation.archive.todo + - - match - ^\s*---.{3,5}---+$ - name - meta.punctuation.separator.todo - + + match + ^\s*---.{3,5}---+$ + name + meta.punctuation.separator.todo + - + - repository - + repository + - bold - - captures - - 1 - - name - punctuation.definition.bold - - - begin - (?<=\s|^)(\*\*|__)(?=\S)(?=(?!(?<=\S)\1)[^\n]+(?<=\S)\1)(?=[^\n]+(?<=\S)(\1)((?![\w\d\n])|(?=\s|$))) - end - (?<=\S)(\1)((?![\w\d\n])|(?=\s|$)) - name - todo.bold - + bold + + captures + + 1 + + name + punctuation.definition.bold + + + begin + (?<=\s|^)(\*\*|__)(?=\S)(?=(?!(?<=\S)\1)[^\n]+(?<=\S)\1)(?=[^\n]+(?<=\S)(\1)((?![\w\d\n])|(?=\s|$))) + end + (?<=\S)(\1)((?![\w\d\n])|(?=\s|$)) + name + todo.bold + - italic - - captures - - 1 - - name - punctuation.definition.italic - - - begin - (?<=\s|^)(\*|_)(?=\S)(?=(\1\1|(?!(?<=\S)\1).)++(?<=\S)\1)(?=[^\n]+(?<=\S)(\1)(?!\1|[\w\d])) - end - (?<=\S)(\1)(?!\1|[\w\d]) - name - todo.italic - + italic + + captures + + 1 + + name + punctuation.definition.italic + + + begin + (?<=\s|^)(\*|_)(?=\S)(?=(\1\1|(?!(?<=\S)\1).)++(?<=\S)\1)(?=[^\n]+(?<=\S)(\1)(?!\1|[\w\d])) + end + (?<=\S)(\1)(?!\1|[\w\d]) + name + todo.italic + - url - - captures - - 1 - - name - punctuation.definition.url - - - match - (?<!\S)(<)\w+?(?!\s)(\.|:)(?!\s)[^\n]+?(>) - name - todo.url - + url + + captures + + 1 + + name + punctuation.definition.url + + + match + (?<!\S)(<)\w+?(?!\s)(\.|:)(?!\s)[^\n]+?(>) + name + todo.url + - tag - - match - (?<=\s)\@(?!(high|today|critical|low|completed|done)[\s\(])[\w\d\.\(\)\-!? :\+]+[ \t]* - name - meta.tag.todo - + tag + + match + (?<=\s)\@(?!(high|today|critical|low|completed|done)[\s\(])[\w\d\.\(\)\-!? :\+]+[ \t]* + name + meta.tag.todo + - today - - match - (?<=\s)\@today|✭ᴛᴏᴅᴀʏ - name - string.other.tag.todo.today - + today + + match + (?<=\s)\@today|✭ᴛᴏᴅᴀʏ + name + string.other.tag.todo.today + - low - - match - (?<=\s)\@low|✭low - name - string.other.tag.todo.low - + low + + match + (?<=\s)\@low|✭low + name + string.other.tag.todo.low + - high - - match - (?<=\s)\@high|✭high - name - string.other.tag.todo.high - + high + + match + (?<=\s)\@high|✭high + name + string.other.tag.todo.high + - critical - - match - (?<=\s)\@critical|✭critical - name - string.other.tag.todo.critical - + critical + + match + (?<=\s)\@critical|✭critical + name + string.other.tag.todo.critical + - - scopeName - text.todo - uuid - 8fj2g29c-04ef-4330-9a6b-9b99aae1c418 + + scopeName + text.todo + uuid + 8fj2g29c-04ef-4330-9a6b-9b99aae1c418 From 425f1ee2c01cc6f8a4b61b54984a7f432242193c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=95=E7=AB=8B=E9=9D=92?= Date: Tue, 3 Sep 2019 17:46:27 +0800 Subject: [PATCH 4/4] Update PlainTasks.sublime-syntax --- PlainTasks.sublime-syntax | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/PlainTasks.sublime-syntax b/PlainTasks.sublime-syntax index 8fc077d..9aeabd3 100644 --- a/PlainTasks.sublime-syntax +++ b/PlainTasks.sublime-syntax @@ -10,7 +10,7 @@ contexts: main: - match: '^\s*(\w+.*?:\s*?(\@[^\s]+(\(.*?\))?\s*?)*$\n?)' scope: keyword.control.header.todo - - match: '^\s*(?:(\+|✓|✔|☑|√|\*?\s?\[x\])(\s+(?:[^\@\n]|(?