Skip to content

Commit

Permalink
Merge pull request #26 from djjudas21/22_holy_week
Browse files Browse the repository at this point in the history
Add support for Holy Week
  • Loading branch information
djjudas21 committed Feb 25, 2024
2 parents 23c61f8 + f6ed7d4 commit af11358
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 17 deletions.
5 changes: 3 additions & 2 deletions liturgical_colour/feasts.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ def lookup_feast(datecode):
# Dates relative to Easter are encoded as the number of days after Easter.
-47: { 'name': 'Shrove Tuesday', 'colour':'white', 'url': 'https://en.wikipedia.org/wiki/Shrove_Tuesday', 'prec':7, 'type': 'Festival', 'type_url': 'https://en.wikipedia.org/wiki/Festival_(Church_of_England)' },
-46: { 'name': 'Ash Wednesday', 'colour':'purple', 'url': 'https://en.wikipedia.org/wiki/Ash_Wednesday', 'prec':9, 'type': 'Principal Holy Day', 'type_url': 'https://en.wikipedia.org/wiki/Principal_Holy_Day' },
-3: { 'name': 'Maundy Thursday', 'colour':'purple', 'url': 'https://en.wikipedia.org/wiki/Maundy_Thursday', 'prec':9, 'type': 'Principal Holy Day', 'type_url': 'https://en.wikipedia.org/wiki/Principal_Holy_Day'},
-2: { 'name': 'Good Friday', 'colour':'purple', 'url': 'https://en.wikipedia.org/wiki/Good_Friday', 'prec':9, 'type': 'Principal Holy Day', 'type_url': 'https://en.wikipedia.org/wiki/Principal_Holy_Day' },
-7: { 'name': 'Palm Sunday', 'colour':'red', 'url': 'https://en.wikipedia.org/wiki/Palm_Sunday', 'prec':5, 'type': 'Festival', 'type_url': 'https://en.wikipedia.org/wiki/Festival_(Church_of_England)'},
-3: { 'name': 'Maundy Thursday', 'colour':'white', 'url': 'https://en.wikipedia.org/wiki/Maundy_Thursday', 'prec':9, 'type': 'Principal Holy Day', 'type_url': 'https://en.wikipedia.org/wiki/Principal_Holy_Day'},
-2: { 'name': 'Good Friday', 'colour':'red', 'url': 'https://en.wikipedia.org/wiki/Good_Friday', 'prec':9, 'type': 'Principal Holy Day', 'type_url': 'https://en.wikipedia.org/wiki/Principal_Holy_Day' },
0 : { 'name': 'Easter', 'url': 'https://en.wikipedia.org/wiki/Easter', 'prec':9, 'type': 'Principal Feast', 'type_url': 'https://en.wikipedia.org/wiki/Principal_Feast' },
39: { 'name': 'Ascension', 'url': 'https://en.wikipedia.org/wiki/Ascension_Day', 'prec':9, 'type': 'Principal Feast', 'type_url': 'https://en.wikipedia.org/wiki/Principal_Feast' },
49: { 'name': 'Pentecost', 'colour': 'red', 'url': 'https://en.wikipedia.org/wiki/Pentecost', 'prec':9, 'type': 'Principal Feast', 'type_url': 'https://en.wikipedia.org/wiki/Principal_Feast' },
Expand Down
31 changes: 16 additions & 15 deletions liturgical_colour/liturgical.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,21 +69,7 @@ def liturgical_colour(s_date: str, transferred: bool = False):

advent_sunday = get_advent_sunday(year)

if easter_point > -47 and easter_point < 0:
season = 'Lent'
season_url = 'https://en.wikipedia.org/wiki/Lent'
weekno = (easter_point+50-dayofweek) // 7
# The ECUSA calendar seems to indicate that Easter Eve ends
# Lent *and* begins the Easter season. I'm not sure how. Maybe it's
# in both? Maybe the daytime is in Lent and the night is in Easter?
elif easter_point >= 0 and easter_point <= 49:
# yes, this is correct: Pentecost itself is in Easter season;
# Pentecost season actually begins on the day after Pentecost.
# Its proper name is "The Season After Pentecost".
season = 'Easter'
season_url = 'https://en.wikipedia.org/wiki/Eastertide'
weekno = easter_point // 7
elif christmas_point >= advent_sunday and christmas_point <= -1:
if christmas_point >= advent_sunday and christmas_point <= -1:
season = 'Advent'
season_url = 'https://en.wikipedia.org/wiki/Advent'
weekno = 1 + (christmas_point-advent_sunday) // 7
Expand All @@ -101,6 +87,21 @@ def liturgical_colour(s_date: str, transferred: bool = False):
season = 'Ordinary Time'
season_url = 'https://en.wikipedia.org/wiki/Ordinary_Time'
weekno = 1 + (christmas_point - 47) // 7
elif easter_point > -47 and easter_point < -7:
season = 'Lent'
season_url = 'https://en.wikipedia.org/wiki/Lent'
weekno = (easter_point+50-dayofweek) // 7
elif easter_point >= -7 and easter_point < 0:
season = 'Holy Week'
season_url = 'https://en.wikipedia.org/wiki/Holy_Week'
weekno = 0
elif easter_point >= 0 and easter_point <= 49:
# yes, this is correct: Pentecost itself is in Easter season;
# Pentecost season actually begins on the day after Pentecost.
# Its proper name is "The Season After Pentecost".
season = 'Easter'
season_url = 'https://en.wikipedia.org/wiki/Eastertide'
weekno = easter_point // 7
else:
# Period of Ordinary Time after Pentecost
season = 'Ordinary Time'
Expand Down

0 comments on commit af11358

Please sign in to comment.