Less indentation

merge-requests/30/head
Bob Mottram 2024-07-16 10:55:34 +01:00
parent 44bff188c2
commit 0a34a1d00f
1 changed files with 28 additions and 26 deletions

View File

@ -368,32 +368,34 @@ def html_calendar(person_cache: {}, translate: {},
if '?' in actor: if '?' in actor:
first = True first = True
for part in actor.split('?'): for part in actor.split('?'):
if not first: if first:
if '=' in part: first = False
if part.split('=')[0] == 'year': continue
num_str = part.split('=')[1] if '=' not in part:
if len(num_str) <= 5: continue
if num_str.isdigit(): if part.split('=')[0] == 'year':
year = int(num_str) num_str = part.split('=')[1]
elif part.split('=')[0] == 'month': if len(num_str) <= 5:
num_str = part.split('=')[1] if num_str.isdigit():
if len(num_str) <= 3: year = int(num_str)
if num_str.isdigit(): elif part.split('=')[0] == 'month':
month_number = int(num_str) num_str = part.split('=')[1]
elif part.split('=')[0] == 'day': if len(num_str) <= 3:
num_str = part.split('=')[1] if num_str.isdigit():
if len(num_str) <= 3: month_number = int(num_str)
if num_str.isdigit(): elif part.split('=')[0] == 'day':
day_number = int(num_str) num_str = part.split('=')[1]
elif part.split('=')[0] == 'ical': if len(num_str) <= 3:
bool_str = part.split('=')[1] if num_str.isdigit():
if bool_str.lower().startswith('t'): day_number = int(num_str)
icalendar = True elif part.split('=')[0] == 'ical':
elif part.split('=')[0] == 'onlyShowReminders': bool_str = part.split('=')[1]
bool_str = part.split('=')[1] if bool_str.lower().startswith('t'):
if bool_str.lower().startswith('t'): icalendar = True
only_show_reminders = True elif part.split('=')[0] == 'onlyShowReminders':
first = False bool_str = part.split('=')[1]
if bool_str.lower().startswith('t'):
only_show_reminders = True
actor = actor.split('?')[0] actor = actor.split('?')[0]
curr_date = datetime.now() curr_date = datetime.now()