From 010118ecaf2b714a73c8c0b737dfeccc37ef4bde Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?benjamin=20melan=C3=A7on?= Date: Tue, 1 Jul 2025 12:32:51 -0400 Subject: [PATCH] Allow different dash attempts and even single dashes, emdashes no longer need to be surrounded by spaces to separate project and task but single dashes do --- pomodoro_to_harvest.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pomodoro_to_harvest.py b/pomodoro_to_harvest.py index 6485303..4e88929 100644 --- a/pomodoro_to_harvest.py +++ b/pomodoro_to_harvest.py @@ -170,10 +170,12 @@ for preferred, alternatives in compound_project_tasks.items(): # because apparently i really only accepted emdashes for all this time and # never noticed because i use them so consistently. timelog['project'] = timelog['project'].str.replace('---', '—', regex=False); +timelog['project'] = timelog['project'].str.replace('--', '—', regex=False); +timelog['project'] = timelog['project'].str.replace(' - ', '—', regex=False); # If a compound project was specified, break that out into a sub-project (in # Harvest, we use Task, which is really task type, for this). -timelog['subproject'] = (np.where(timelog['project'].str.contains(' — '), timelog['project'].str.split(' — ', n=1).str[1], None)) -timelog['project'] = (np.where(timelog['project'].str.contains(' — '), timelog['project'].str.split(' — ', n=1).str[0], timelog['project'])) +timelog['subproject'] = (np.where(timelog['project'].str.contains('—'), timelog['project'].str.split('—', n=1).str[1], None)) +timelog['project'] = (np.where(timelog['project'].str.contains('—'), timelog['project'].str.split('—', n=1).str[0], timelog['project'])) # Trim any surrounding whitespace from final project and sub-project/task. timelog['subproject'] = timelog['subproject'].str.strip()