1
0

More robust

This commit is contained in:
Jon Michael Aanes 2024-11-24 17:58:36 +01:00
parent 47761eb4d7
commit 188249e39f
Signed by: Jmaa
SSH Key Fingerprint: SHA256:Ab0GfHGCblESJx7JRE4fj4bFy/KRpeLhi41y4pF3sNA

View File

@ -162,6 +162,7 @@ class ObsidianVault:
)
events = list(contents.events)
events.sort(key=lambda x: x.comment or '')
events.sort(key=lambda x: x.subject or '')
events.sort(key=lambda x: x.verb or '')
date_sentinel = datetime.datetime(1900, 1, 1, 1, 1, 1, tzinfo=contents.timezone)
@ -232,7 +233,7 @@ def find_events_list_block(ast) -> tuple[list, list[str], list]:
isinstance(block, marko.block.Heading)
and block.children[0].children.lower() == 'events'
):
events_block = ast.children[block_i + 1]
events_block = ast.children[block_i + 1] if block_i + 1 < len(ast.children) else None
if isinstance(events_block, marko.block.List):
offset = 2
event_texts = [