Added ability to provide detailed address in location field in calendar

This commit is contained in:
Jim Martens 2018-10-10 18:01:48 +02:00
parent a18a66f027
commit 075d9fcbc6
2 changed files with 5 additions and 1 deletions

View File

@ -72,7 +72,10 @@ def sync(calendar_url: str, event_collection_path: str) -> None:
end: datetime.datetime = event.end
end_str = end.isoformat(sep=' ')
event_content = event_content.replace('<end>', end_str)
event_content = event_content.replace('<location>', event.location)
location_info = event.location.split(sep=':')
event_content = event_content.replace('<location>', location_info[0])
if len(location_info) == 2:
event_content = event_content.replace('<address>', location_info[1])
event_filename = begin.date().isoformat() + '-' + event.name.replace(' ', '_') + '.markdown'
with open(event_collection_path + event_filename, 'w', encoding='utf-8', newline='\n') as event_file:

View File

@ -5,4 +5,5 @@ date: <date>
start_date: <begin>
end_date: <end>
location: <location>
address: <address>
---