diff options
Diffstat (limited to '.ai/scripts/drill-to-anki.py')
| -rwxr-xr-x | .ai/scripts/drill-to-anki.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/.ai/scripts/drill-to-anki.py b/.ai/scripts/drill-to-anki.py index 1050021..9fe954e 100755 --- a/.ai/scripts/drill-to-anki.py +++ b/.ai/scripts/drill-to-anki.py @@ -90,15 +90,18 @@ def escape_html(s: str) -> str: def strip_org_metadata(body_lines: list[str]) -> list[str]: - """Drop :PROPERTIES: drawers and SCHEDULED/DEADLINE/CLOSED planning lines. + """Drop :PROPERTIES: drawers, planning lines, and created-date lines. Org-drill needs these in the source file (SRS state lives in the PROPERTIES drawer; SCHEDULED carries the next-review date), but they - are noise on the back of an Anki card. + are noise on the back of an Anki card. A created/added date never + belongs on a card, so a stray "Created:" or ":CREATED:" body line is + dropped too. """ cleaned: list[str] = [] in_drawer = False planning_re = re.compile(r"^\s*(SCHEDULED|DEADLINE|CLOSED):\s") + created_re = re.compile(r"^\s*:?created:?\s", re.IGNORECASE) drawer_start_re = re.compile(r"^\s*:PROPERTIES:\s*$") drawer_end_re = re.compile(r"^\s*:END:\s*$") for line in body_lines: @@ -109,7 +112,7 @@ def strip_org_metadata(body_lines: list[str]) -> list[str]: if drawer_start_re.match(line): in_drawer = True continue - if planning_re.match(line): + if planning_re.match(line) or created_re.match(line): continue cleaned.append(line) return cleaned |
