Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
"""I have a TaskPaper file I keep in Dropbox that contains some tasks for my
daily routine.
This script runs once a day and resets every item on that list, removing
the @done tag and replacing the file.
import os
import re
# Path to the file containing my daily tasks
ROUTINE_FILE = os.path.join(
os.environ['HOME'], 'Dropbox', 'taskpaper', 'tasks_daily.taskpaper')
# Regex for matching a @done tag
DONE_REGEX = re.compile(r' @done(?:\([^\)]+\))?')
def remove_done_tag(line):
"""Given a line from a TaskPaper document, remove any @done tags."""
return DONE_REGEX.sub('', line).rstrip()
def main():
new_lines = []
with open(ROUTINE_FILE, 'r') as infile:
for line in infile:
with open(ROUTINE_FILE, 'w') as outfile:
if __name__ == '__main__':
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment