Skip to content

Commit

Permalink
Merge pull request #7 from gmateo/adding-InProgress-state
Browse files Browse the repository at this point in the history
Add InProgress state
  • Loading branch information
samsonw committed Jun 24, 2015
2 parents c6626a9 + 0293220 commit 42b7eda
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 12 deletions.
10 changes: 7 additions & 3 deletions SublimeTask.py
Expand Up @@ -4,7 +4,6 @@
import re
import sublime_plugin


class TaskCommand(sublime_plugin.TextCommand):
def run(self, edit):
for region in self.view.sel():
Expand All @@ -20,10 +19,15 @@ def process(self, line):
# p = re.compile('^(\s*)([-✓])(.*)')
# http://docs.python.org/howto/unicode
line = line.encode(self.current_encoding())
p = re.compile(ur'^(\s*)(-|\xe2\x9c\x93)(.*)', re.UNICODE)
p = re.compile(ur'^(\s*)(-|~|\xe2\x9c\x93)(.*)', re.UNICODE)
m = p.match(line)
if m:
symbol = '✓' if m.group(2) == '-' else '-'
symbol = '-'
if m.group(2) == '-':
symbol = '~'
elif m.group(2) == '~':
symbol = '✓'

result = '%(leading_whitespace)s%(symbol)s%(content)s' % {'leading_whitespace': m.group(1), 'symbol': symbol, 'content': m.group(3)}
return result.decode(self.current_encoding())
else:
Expand Down
12 changes: 8 additions & 4 deletions Task.JSON-tmLanguage
Expand Up @@ -11,15 +11,19 @@
"match": "[\\[\\]]",
"comment": "[ and ]"
},
{ "name": "variable",
"match": "^[^-✓]*:\\s+",
{ "name": "support.function",
"match": "^[^-~✓]*:\\s+",
"comment": "Task Title"
},
{ "name": "string",
{ "name": "variable.parameter",
"match": "^\\s*~[^\\[\\]]*",
"comment": "Started Tasks"
},
{ "name": "entity.other.attribute-name",
"match": "^\\s*✓[^\\[\\]]*",
"comment": "Completed Tasks"
},
{ "name": "constant",
{ "name": "keyword",
"match": "^\\s*-[^\\[\\]]*",
"comment": "Action Items"
},
Expand Down
18 changes: 13 additions & 5 deletions Task.tmLanguage
Expand Up @@ -34,25 +34,33 @@
<key>comment</key>
<string>Task Title</string>
<key>match</key>
<string>^[^-✓]*:\s+</string>
<string>^[^-~✓]*:\s+</string>
<key>name</key>
<string>variable</string>
<string>support.function</string>
</dict>
<dict>
<key>comment</key>
<string>Started Tasks</string>
<key>match</key>
<string>^\s*~[^\[\]]*</string>
<key>name</key>
<string>variable.parameter</string>
</dict>
<dict>
<key>comment</key>
<string>Completed Tasks</string>
<key>match</key>
<string>^\s*✓[^\[\]]*</string>
<key>name</key>
<string>string</string>
<string>entity.other.attribute-name</string>
</dict>
<dict>
<key>comment</key>
<string>Action Items</string>
<key>match</key>
<string>^\s*-[^\[\]]*</string>
<key>name</key>
<string>constant</string>
<string>keyword</string>
</dict>
<dict>
<key>comment</key>
Expand All @@ -68,4 +76,4 @@
<key>uuid</key>
<string>47fcd6b9-58c4-4518-855b-a7e16298177c</string>
</dict>
</plist>
</plist>

0 comments on commit 42b7eda

Please sign in to comment.