diff --git a/todoist2org/todoist2org.py b/todoist2org/todoist2org.py index 0a871c9..f82f3ab 100644 --- a/todoist2org/todoist2org.py +++ b/todoist2org/todoist2org.py @@ -57,7 +57,7 @@ def parse_comments(task_id): return output -def parse_task(task, subtask, additional_labels): +def parse_task(task, subtask): """Print a task.""" output = [] if subtask: @@ -65,10 +65,9 @@ def parse_task(task, subtask, additional_labels): else: headline = f"** TODO {task.content}" - labels = [*additional_labels, *task.labels] + labels = task.labels if len(labels) > 0: - labels_string = " :" + ":".join(labels) + ":" - headline += labels_string.replace("-", "_") + headline += " :" + ":".join(labels) + ":" output.append(headline) @@ -111,7 +110,7 @@ def parse_task(task, subtask, additional_labels): return output -def parse_sections(project_id, tasks, additional_labels): +def parse_sections(project_id, tasks): """Print a section.""" output = [] sections = api.get_sections(project_id=project_id) @@ -120,8 +119,6 @@ def parse_sections(project_id, tasks, additional_labels): for section in sections: output.append(f"* {section.name}") output.append("") - section_slug = get_filename(section.name, False) - additional_labels.append(section_slug) subtask = False for task in tasks: if task.section_id == section.id: @@ -130,7 +127,7 @@ def parse_sections(project_id, tasks, additional_labels): subtask = True if subtask and not task.parent_id: subtask = False - output.extend(parse_task(task, subtask, additional_labels)) + output.extend(parse_task(task, subtask)) return output @@ -138,8 +135,6 @@ def parse_sections(project_id, tasks, additional_labels): def parse_project(project, parent_project_name=""): """Parse a project.""" filename = get_filename(project.name) - project_slug = get_filename(project.name, False) - additional_lables = [f"@{project_slug}"] content = [] output_dir = os.environ.get("OUTPUT_DIR", "./output") @@ -171,10 +166,9 @@ def parse_project(project, parent_project_name=""): subtask = True if subtask and not task.parent_id: subtask = False + content.extend(parse_task(task, subtask)) - content.extend(parse_task(task, subtask, additional_lables)) - - content.extend(parse_sections(project.id, tasks, additional_lables)) + content.extend(parse_sections(project.id, tasks)) write_file(path, content) return parent_project_name @@ -205,16 +199,6 @@ def parse_projects(): parent_project_name = parse_project(project, parent_project_name) -def print_warning(): - """Print warning about missing recurrences.""" - print( - "Please keep in mind that this script does not support recurring " - + "items and will only schedule them for next occurence. " - + "If a task is recurring then the description will include a note " - + "'(recurring)'." - ) - - def main(): """Run the program.""" load_dotenv() @@ -223,7 +207,6 @@ def main(): create_output_dir() parse_projects() print_stats() - print_warning() if __name__ == "__main__":