multiline comments

This commit is contained in:
Andrei Stoica 2022-10-14 19:13:01 -04:00
parent 637af554f0
commit 120b3d2f9f
1 changed files with 7 additions and 3 deletions

View File

@ -53,6 +53,7 @@ def parse_note(note_f: str, line_matcher: re.Pattern) -> dict:
curr_section = None
for line in note:
m = line_matcher.match(line)
print(line, m)
if not m:
continue
if m.group(1):
@ -63,6 +64,8 @@ def parse_note(note_f: str, line_matcher: re.Pattern) -> dict:
else:
if m.group(2) and curr_section:
todo[curr_section].append(m.group(4))
elif curr_section:
todo[curr_section][-1] += f"\n {m.group(4)}"
return todo
@ -99,10 +102,10 @@ def main():
"*", r"\*"
)
line_regex = re.compile(
rf"^\s*({_SECTION_HEADING})?({todo_marker_groups})?({comp_marker_groups})?\s*(\S+)$".replace(
"[", "\["
rf"^\s*({_SECTION_HEADING})?({todo_marker_groups})?({comp_marker_groups})?\s*(.+)$".replace(
"[", r"\["
).replace(
"]", "\]"
"]", r"\]"
)
)
print(line_regex)
@ -119,6 +122,7 @@ def main():
last_note = previous_notes[max(list(previous_notes.keys()))]
last_note = os.path.join(root_dir, last_note)
last_note_content = parse_note(last_note, line_regex)
print(last_note_content)
write_notes(todays_notes, today, last_note_content)
subprocess.call([editor, todays_notes])