From 3563f92eee513e4679eb064cdb49f408a1f4b7a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?benjamin=20melan=C3=A7on?= Date: Tue, 1 Jul 2025 12:29:40 -0400 Subject: [PATCH 1/2] Allow attempted emdash (three dashes where i missed the compose key) --- pomodoro_to_harvest.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pomodoro_to_harvest.py b/pomodoro_to_harvest.py index 5602e4b..6485303 100644 --- a/pomodoro_to_harvest.py +++ b/pomodoro_to_harvest.py @@ -166,6 +166,10 @@ for preferred, alternatives in compound_project_tasks.items(): alternatives = [item.lower() for item in alternatives] timelog.loc[timelog.project.str.lower().isin(alternatives), "project"] = preferred +# Replace single dashes, en-dashes, and attempts at em-dashes with emdashes +# 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); # 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)) 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 2/2] 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()