Created
November 14, 2013 16:27
-
-
Save pslobo/7469760 to your computer and use it in GitHub Desktop.
Based on a request here http://stackoverflow.com/questions/19944470/supporting-subtasks-in-taskpaper-script
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
t = '''Inbox: | |
Project 01: | |
- Task 01 | |
this is a comment | |
this is still a comment associate with task 01 | |
- sub 01 | |
- sub 02 | |
- sub 05 | |
- Task 02 | |
- Task 03 | |
- sub 03 | |
- sub 04 | |
Project 02: | |
- Task 01 | |
- proj 2 sub 01 | |
- Task 02 | |
- Task 03 | |
- Task 04''' | |
allTasks = t.split('\n\n') | |
projects = [filter(None,proj.split('\n\t')) for proj in allTasks] | |
for i in projects: | |
if len(i[1:])>0: | |
print i[0] | |
print i[1] | |
for s in range(2,len(i[1:])): | |
if i[s].startswith("\t") or not i[s].startswith("-"): | |
print i[s] | |
else: | |
break |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment