Skip to content

Commit

Permalink
Commemorations (#178)
Browse files Browse the repository at this point in the history
* Fixing commemorations 01.05, 01.11, 01.14

* Fixing commemoration 01.15

* Adding utils.match_all

* Fixing commemoration 01.19

* Fixing commemorations 01.23, 01.25, 01.28

* Fixing commemorations 02.06

* Fixing commemorations 02.09

* Fixing commemorations 02.22

* Fixing commemorations on Gaudete, Laetare and Palm Sunday

* Updating CLI calendar

* Fixing commemoration on Friday after Passion Sunday

* Fixing commemoration 04.25

* Fixing commemoration 05.10

* Fixing commemoration 05.27

* Fixing commemoration 05.31

* Fixing commemoration 05.31 tests

* Fixing commemorations 06.10, 06.12, 06.18, 06.19

* Fixing commemorations 07.02 and 07.12

* Updating divoff dependency

* Updating tests

* Fixing commemoration 07.18 - PL

* Fixing commemoration 07.20

* Fixing commemoration 07.23

* Fixing commemoration 07.24

* Fixing commemorations 07.25, 07.29

* Updating tests

* Fixing commemorations in August

* Fixing commemoration 08.06

* Updating divoff

* Fixing commemorations 09.16, 09.23

* Fixing commemorations 10.01, 10.07

* Fixing commemoration 10.08

* Typo

* Fixing typos

* Fixing tests

* Updating DivinumOfficium submodule

* Updating readme

* Improving propers tests

* Adding celebration's class in CLI output
  • Loading branch information
mmolenda authored Aug 22, 2024
1 parent aab6f1e commit c6b50c0
Show file tree
Hide file tree
Showing 138 changed files with 104,247 additions and 51,886 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,4 @@ missalemeum/__version__
node_modules
deploy
*.tar.gz
.DS_Store
17 changes: 13 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,18 +114,27 @@ $ python missalemeum/cli.py proper sancti:09-15:2:w

## Localization

### Backend

1. Copy folder `missalemeum/constants/en` into `missalemeum/constants/<your-lang-ISO-639-1>` and translate the files
2. Add mapping between your language ISO-639-1 code and [Divinum Officium language folder](https://github.com/DivinumOfficium/divinum-officium/tree/master/web/www/missa) in `LANGUAGES` in `missalemeum/constants/common.py`
3. Generate Babel language files:
- Create .po file: `cd missalemeum/missalemeum && pybabel init -i messages.pot -d translations -l <your-lang-ISO-639-1>`
- Provide translations in file generated in `missalemeum/translations/<your-lang>/LC_MESSAGES/messages.po`
- Compile babel files: `pybabel compile -d translations`
4. Copy folder `missalemeum/templates/en` into `missalemeum/templates/<your-lang-ISO-639-1>` and translate the files
5. Copy folder `missalemeum/static/data/en` into `missalemeum/static/data/<your-lang-ISO-639-1>` and translate the files
6. Copy folder `missalemeum/static/js/en` into `missalemeum/static/js/<your-lang-ISO-639-1>` and translate the files
7. Run the application and verify everything is being displayed properly. Check at least one full year from now. Most likely you'll encounter some issues with Divinum Officium source files. In such case correct them in Divinum Officium project and update the submodule.
8. Add source files for non-regular Masses, like Ash Wednesday or Maundy Thursday in `resources/divinum-officium-custom/web/www/missa/<your-lang>`
5. Add source files for non-regular propers, like Ash Wednesday or Maundy Thursday in `resources/divinum-officium-custom/web/www/missa/<your-lang>`
6. Add tests in [test_propers.py](tests/test_propers.py)

### Frontend

1. Add your language to `supportedLanguages` array in [App.js](frontend/src/App.js)
2. Provide translation of fronted elements in [intl.js](frontend/src/intl.js)

### Verification

Run the application and verify everything is being displayed properly. Check at least one full year from now. Most likely you'll encounter
some issues with Divinum Officium source files. In such case correct them in Divinum Officium project and update the submodule.

## Dev info

Expand Down
43 changes: 29 additions & 14 deletions missalemeum/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,29 +34,40 @@ def _print_proper(language, proper):

@click.command()
@click.argument('year', default=datetime.datetime.utcnow().year, type=int)
@click.option('--month', default=None, type=int)
@click.option('--language', default=LANGUAGE_ENGLISH)
def calendar(year, language):
def calendar(year, language, month):
def _print_all(missal):
for date_, day in missal.items():
if month and date_.month != month:
continue
if date_.weekday() == 6:
click.echo("---")
if date_.day == 1:
click.echo(f"\n\n# {date_.month}\n")

collect = []

padding = 40
for i in ('tempora', 'celebration', 'commemoration'):
items = getattr(day, i, None)
if not items:
collect.append('-')
else:
repr_ = f"[{items[0].name}:{items[0].rank}] {items[0].title}"
if len(repr_) > padding:
repr_ = repr_[:padding - 3] + '…'
collect.append(repr_)
te, ce, co = collect
click.echo(f"{date_.strftime('%A %Y-%m-%d').ljust(padding)} "
f"{te.ljust(padding)} {ce.ljust(padding)} {co.ljust(padding)}")
tempora = day.tempora
celebration = day.celebration
commemoration = day.commemoration
rows_count = max([len(tempora), len(celebration), len(commemoration)])
for row_number in range(0, rows_count):
collect = []
for items in (tempora, celebration, commemoration):
if not items:
collect.append('-')
elif len(items) - 1 < row_number:
collect.append("")
else:
repr_ = f"[{items[row_number].name}:{items[row_number].rank}] {items[row_number].title}"
if len(repr_) > padding:
repr_ = repr_[:padding - 3] + '…'
collect.append(repr_)
te, ce, co = collect
datestr = date_.strftime('%A %Y-%m-%d') if row_number == 0 else ""
click.echo(f"{datestr.ljust(22)} class:{str(day.get_celebration_rank()).ljust(6)}"
f"{te.ljust(padding)} {ce.ljust(padding)} {co.ljust(padding)}")

missal: Calendar = controller.get_calendar(year, language)
_print_all(missal)
Expand All @@ -68,6 +79,9 @@ def _print_all(missal):
def proper(proper_id: str, language: str):
try:
proper_vernacular, proper_latin = controller.get_proper_by_id(proper_id, language)
click.echo('# title Latin: {}'.format(proper_latin.title))
click.echo('# title vernacular: {}'.format(proper_vernacular.title))
click.echo('class: {}'.format(proper_latin.rank))
_print_proper(language, proper_vernacular)
_print_proper('Latin', proper_latin)
except (InvalidInput, ProperNotFound) as e:
Expand All @@ -86,6 +100,7 @@ def date(date: str, language: str):
click.echo(f'# {date}')
click.echo('- tempora: {}'.format(day.get_tempora_name()))
click.echo('- celebration: {}'.format(day.get_celebration_name()))
click.echo('- class: {}'.format(day.get_celebration_rank()))
for itr, (proper_vernacular, proper_latin) in enumerate(propers, 1):
if len(propers) > 1:
click.echo(f'\n--- Missa {itr} ---')
Expand Down
47 changes: 42 additions & 5 deletions missalemeum/constants/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@
PATTERN_EASTER_PREFATIO = re.compile(r'^tempora:Pasc([0-4]|5-0|5-1|5-2|5-3)')
PATTERN_ASCENSION_PREFATIO = re.compile(r'^tempora:Pasc(5-4|5-5|5-6|6-0|6-1|6-2|6-3|6-4|6-5)')
PATTERN_LENT_SUNDAY = re.compile(r'^tempora:Quad\d-0.*')
PATTERN_TEMPORA_SUNDAY = re.compile(r'^tempora:.*-0r*:\d:\w$')
PATTERN_TEMPORA_SUNDAY_CLASS_1 = re.compile(r'^tempora:.*-0r*:1:\w$')
PATTERN_TEMPORA_SUNDAY = re.compile(r'^tempora:.*-0r*:\d:\w{1,2}$')
PATTERN_TEMPORA_SUNDAY_CLASS_1 = re.compile(r'^tempora:.*-0r*:1:\w{1,2}$')
PATTERN_TEMPORA_SUNDAY_CLASS_2 = re.compile(r'^tempora:(.*-0r*:2|Nat1-0):\w$')
PATTERN_TEMPORA_CLASS_1 = re.compile(r'^tempora:.*:1:\w$')
PATTERN_TEMPORA_CLASS_2 = re.compile(r'^tempora:.*:2:\w$')
Expand All @@ -55,7 +55,7 @@
PATTERN_SANCTI_CLASS_2 = re.compile(r'^sancti:.*:2:\w$')
PATTERN_SANCTI_CLASS_3 = re.compile(r'^sancti:.*:3:\w$')
PATTERN_SANCTI_CLASS_3_LOCAL = re.compile(r'^sancti:.*(?:' + r"|".join(LANGUAGES.keys()) + r'):3:\w$')
PATTERN_SANCTI_CLASS_4 = re.compile(r'^sancti:.*:4:\w$')
PATTERN_SANCTI_CLASS_4 = re.compile(r'^sancti:.*:4c?:\w$')
PATTERN_SANCTI_CLASS_1_OR_2 = re.compile(r'^sancti:.*:[12]:\w$')
PATTERN_CLASS_1 = re.compile(r'^[a-z]+:.*:1:\w$')
PATTERN_CLASS_2 = re.compile(r'^[a-z]+:.*:2:\w$')
Expand Down Expand Up @@ -283,6 +283,7 @@
TEMPORA_QUAD5_3 = 'tempora:Quad5-3:3:v'
TEMPORA_QUAD5_4 = 'tempora:Quad5-4:3:v'
TEMPORA_QUAD5_5 = 'tempora:Quad5-5Feria:3:v'
TEMPORA_QUAD5_5C = 'tempora:Quad5-5Feriac:4:w'
TEMPORA_QUAD5_6 = 'tempora:Quad5-6:3:v'
TEMPORA_QUAD6_0 = 'tempora:Quad6-0r:1:rv' # 2nd Passion Sunday (Palm Sunday)
TEMPORA_QUAD6_1 = 'tempora:Quad6-1:1:v'
Expand Down Expand Up @@ -565,23 +566,31 @@
# SANCTI - days which have fixed date
SANCTI_10_DU = 'sancti:10-DU:1:w' # Feast of Christ the King; last Sunday of October
SANCTI_01_01 = 'sancti:01-01:1:w' # Octave of the Nativity
SANCTI_01_05 = 'sancti:01-05:4:r' # commemoratio S. Telesphori
SANCTI_01_06 = 'sancti:01-06:1:w' # Epiphany
SANCTI_01_11 = 'sancti:01-11:4:r' # commemoratio S. Hyginus
SANCTI_01_13 = 'sancti:01-13:2:w' # Baptism of the Lord
SANCTI_01_14 = 'sancti:01-14:3:w'
SANCTI_01_14 = 'sancti:01-14:3:w' # S. Hilarii
SANCTI_01_14C = 'sancti:01-14c:4:r' # commemoratio S. Felicis
SANCTI_01_15 = 'sancti:01-15:3:w'
SANCTI_01_15C = 'sancti:01-15c:4:w' # Pro S. Mauro Abbate
SANCTI_01_16 = 'sancti:01-16:3:r'
SANCTI_01_17 = 'sancti:01-17:3:w'
SANCTI_01_18 = 'sancti:01-18r:4:w'
SANCTI_01_19 = 'sancti:01-19:4:r'
SANCTI_01_19C = 'sancti:01-19c:4:r' # Pro S. Canuto Regi Mart.
SANCTI_01_20 = 'sancti:01-20:3:r'
SANCTI_01_21 = 'sancti:01-21:3:r'
SANCTI_01_22 = 'sancti:01-22:3:r'
SANCTI_01_23 = 'sancti:01-23:3:w'
SANCTI_01_23C = 'sancti:01-23c:4:r' # Pro S. Emerentianæ Virg. et Mart.
SANCTI_01_24 = 'sancti:01-24:3:r'
SANCTI_01_25 = 'sancti:01-25r:3:w'
SANCTI_01_25C = 'sancti:01-25c:4:w' # Pro S. Petro
SANCTI_01_26 = 'sancti:01-26:3:r'
SANCTI_01_27 = 'sancti:01-27:3:w'
SANCTI_01_28 = 'sancti:01-28:3:w'
SANCTI_01_28C = 'sancti:01-28c:4:r'
SANCTI_01_29 = 'sancti:01-29:3:w'
SANCTI_01_30 = 'sancti:01-30:3:r'
SANCTI_01_31 = 'sancti:01-31:3:w'
Expand All @@ -592,16 +601,19 @@
SANCTI_02_04 = 'sancti:02-04:3:w'
SANCTI_02_05 = 'sancti:02-05:3:r'
SANCTI_02_06 = 'sancti:02-06:3:w'
SANCTI_02_06C = 'sancti:02-06c:4:r' # św. Doroty
SANCTI_02_07 = 'sancti:02-07:3:w'
SANCTI_02_08 = 'sancti:02-08:3:w'
SANCTI_02_09 = 'sancti:02-09:3:w'
SANCTI_02_09C = 'sancti:02-09c:4:r' # św Apolonii
SANCTI_02_10 = 'sancti:02-10:3:w'
SANCTI_02_11 = 'sancti:02-11:3:w'
SANCTI_02_12 = 'sancti:02-12:3:w'
SANCTI_02_14 = 'sancti:02-14:4:r'
SANCTI_02_15 = 'sancti:02-15:4:r'
SANCTI_02_18 = 'sancti:02-18:4:r'
SANCTI_02_22 = 'sancti:02-22:2:w' # Feast of the Chair of Saint Peter
SANCTI_02_22C = 'sancti:02-22c:4:r' # St. Paul
SANCTI_02_23 = 'sancti:02-23r:3:w'
SANCTI_02_24 = 'sancti:02-24:2:r' # St. Matthias, Apostle
SANCTI_02_27 = 'sancti:02-27:3:w'
Expand Down Expand Up @@ -636,6 +648,7 @@
SANCTI_04_23PL = 'sancti:04-23pl:1:r'
SANCTI_04_24 = 'sancti:04-24:3:r'
SANCTI_04_25 = 'sancti:04-25:2:r' # St. Mark, Evangelist
SANCTI_04_25C = 'sancti:04-25c:4:r' #
SANCTI_04_26 = 'sancti:04-26:3:r'
SANCTI_04_27 = 'sancti:04-27:3:w'
SANCTI_04_28 = 'sancti:04-28:3:w'
Expand All @@ -653,6 +666,7 @@
SANCTI_05_08PL = 'sancti:05-08pl:1:r'
SANCTI_05_09 = 'sancti:05-09:3:w'
SANCTI_05_10 = 'sancti:05-10:3:w'
SANCTI_05_10C = 'sancti:05-10c:4:r' #
SANCTI_05_11 = 'sancti:05-11r:2:r' # SS. Philip and James, Apostles
SANCTI_05_12 = 'sancti:05-12:3:r'
SANCTI_05_13 = 'sancti:05-13:3:w'
Expand All @@ -668,10 +682,12 @@
SANCTI_05_25 = 'sancti:05-25:3:w'
SANCTI_05_26 = 'sancti:05-26:3:w'
SANCTI_05_27 = 'sancti:05-27:3:w'
SANCTI_05_27C = 'sancti:05-27c:4:r' #
SANCTI_05_28 = 'sancti:05-28:3:w'
SANCTI_05_29 = 'sancti:05-29:3:w'
SANCTI_05_30 = 'sancti:05-30:4:r'
SANCTI_05_31 = 'sancti:05-31:2:w' # Mary the Queen
SANCTI_05_31C = 'sancti:05-31c:4:w' # Petronela

SANCTI_06_01 = 'sancti:06-01:3:w'
SANCTI_06_02 = 'sancti:06-02:4:r'
Expand All @@ -683,13 +699,16 @@
SANCTI_06_10PL = 'sancti:06-10pl:3:w'
SANCTI_06_11 = 'sancti:06-11:3:r'
SANCTI_06_12 = 'sancti:06-12:3:r'
SANCTI_06_12C = 'sancti:06-12c:4:r' # Bazylides
SANCTI_06_13 = 'sancti:06-13:3:w'
SANCTI_06_14 = 'sancti:06-14:3:w'
SANCTI_06_15 = 'sancti:06-15:4:w'
SANCTI_06_15PL = 'sancti:06-15pl:3:w'
SANCTI_06_17 = 'sancti:06-17r:3:w'
SANCTI_06_18 = 'sancti:06-18:3:r'
SANCTI_06_18C = 'sancti:06-18c:4:r' #
SANCTI_06_19 = 'sancti:06-19:3:r'
SANCTI_06_19C = 'sancti:06-19c:4:r' #
SANCTI_06_20 = 'sancti:06-20:4:r'
SANCTI_06_21 = 'sancti:06-21:3:w'
SANCTI_06_22 = 'sancti:06-22:3:w'
Expand All @@ -703,13 +722,15 @@

SANCTI_07_01 = 'sancti:07-01:1:r' # Feast of the Most Precious Blood
SANCTI_07_02 = 'sancti:07-02:2:w' # Feast of the Visitation of the Blessed Virgin Mary
SANCTI_07_02C = 'sancti:07-02cc:4:r' # Ss. Processi et Martiniani
SANCTI_07_03 = 'sancti:07-03r:3:r'
SANCTI_07_05 = 'sancti:07-05:3:w'
SANCTI_07_07 = 'sancti:07-07:3:w'
SANCTI_07_08 = 'sancti:07-08:3:w'
SANCTI_07_10 = 'sancti:07-10:3:r'
SANCTI_07_11 = 'sancti:07-11:4:r'
SANCTI_07_12 = 'sancti:07-12:3:r'
SANCTI_07_12C = 'sancti:07-12c:4:r' # Ss. Naboris et Felicis
SANCTI_07_13PL = 'sancti:07-13pl:3:w'
SANCTI_07_14 = 'sancti:07-14:3:w'
SANCTI_07_15 = 'sancti:07-15:3:w'
Expand All @@ -724,29 +745,38 @@
SANCTI_07_21 = 'sancti:07-21r:3:w'
SANCTI_07_22 = 'sancti:07-22:3:w'
SANCTI_07_23 = 'sancti:07-23:3:w'
SANCTI_07_23C = 'sancti:07-23c:4:r' #
SANCTI_07_24 = 'sancti:07-24r:4:r'
SANCTI_07_24PL = 'sancti:07-24pl:3:w'
SANCTI_07_25 = 'sancti:07-25:2:r' # St. James, Apostle
SANCTI_07_25C = 'sancti:07-25c:4:r' # St. Christopher
SANCTI_07_26 = 'sancti:07-26:2:w' # St. Anna, Mary's Mother
SANCTI_07_27 = 'sancti:07-27:4:r'
SANCTI_07_28 = 'sancti:07-28:3:r'
SANCTI_07_29 = 'sancti:07-29:3:r'
SANCTI_07_29C = 'sancti:07-29c:4:r' # śś. Feliksa, Symplicjusza, Faustyna i Beatryczy
SANCTI_07_30 = 'sancti:07-30:4:r'
SANCTI_07_31 = 'sancti:07-31:3:w'

SANCTI_08_01 = 'sancti:08-01r:4:r'
SANCTI_08_02 = 'sancti:08-02:3:r'
SANCTI_08_02C = 'sancti:08-02c:4:r' #
SANCTI_08_04 = 'sancti:08-04:3:w'
SANCTI_08_05 = 'sancti:08-05:3:w'
SANCTI_08_06 = 'sancti:08-06:2:r' # Transfiguration
SANCTI_08_06C = 'sancti:08-06c:4:r' #
SANCTI_08_07 = 'sancti:08-07:3:r'
SANCTI_08_07C = 'sancti:08-07c:4:r' #
SANCTI_08_08 = 'sancti:08-08r:3:r'
SANCTI_08_08C = 'sancti:08-08c:4:r' #
SANCTI_08_09 = 'sancti:08-09t:3:r' # Vigil of st. Laurent
SANCTI_08_09C = 'sancti:08-09c:4:r' #
SANCTI_08_10 = 'sancti:08-10:2:r' # St. Laurent
SANCTI_08_11 = 'sancti:08-11:4:r'
SANCTI_08_12 = 'sancti:08-12:3:w'
SANCTI_08_13 = 'sancti:08-13:4:r'
SANCTI_08_14 = 'sancti:08-14:2:w' # Vigil of Assumption of Mary
SANCTI_08_14C = 'sancti:08-14c:4:r' #
SANCTI_08_15 = 'sancti:08-15r:1:w' # Assumption of Mary
SANCTI_08_16 = 'sancti:08-16:2:w' # St. Joachim
SANCTI_08_17 = 'sancti:08-17:3:w'
Expand All @@ -755,15 +785,19 @@
SANCTI_08_20 = 'sancti:08-20:3:w'
SANCTI_08_21 = 'sancti:08-21:3:w'
SANCTI_08_22 = 'sancti:08-22:2:w' # Immaculate Heart of Mary
SANCTI_08_22C = 'sancti:08-22c:4:r' #
SANCTI_08_23 = 'sancti:08-23:3:w'
SANCTI_08_24 = 'sancti:08-24:2:r' # St. Bartholomew, Apostle
SANCTI_08_25 = 'sancti:08-25:3:w'
SANCTI_08_26 = 'sancti:08-26:4:r'
SANCTI_08_26PL = 'sancti:08-26pl:1:w'
SANCTI_08_27 = 'sancti:08-27:3:w'
SANCTI_08_28 = 'sancti:08-28:3:r'
SANCTI_08_28C = 'sancti:08-28c:4:r' #
SANCTI_08_29 = 'sancti:08-29:3:r'
SANCTI_08_29C = 'sancti:08-29c:4:r' #
SANCTI_08_30 = 'sancti:08-30:3:r'
SANCTI_08_30C = 'sancti:08-30c:4:r' #
SANCTI_08_31 = 'sancti:08-31:3:w'

SANCTI_09_01 = 'sancti:09-01:4:w'
Expand All @@ -780,13 +814,15 @@
SANCTI_09_14 = 'sancti:09-14:2:r' # Exaltation of the Cross
SANCTI_09_15 = 'sancti:09-15:2:w' # The Seven Dolors of the Blessed Virgin Mary
SANCTI_09_16 = 'sancti:09-16:3:r'
SANCTI_09_16C = 'sancti:09-16c:4:r' #
SANCTI_09_17 = 'sancti:09-17:4:w'
SANCTI_09_18 = 'sancti:09-18r:3:w'
SANCTI_09_19 = 'sancti:09-19:3:r'
SANCTI_09_20 = 'sancti:09-20:4:r'
SANCTI_09_21 = 'sancti:09-21:2:r' # St. Matthew, Apostle and Evangelist
SANCTI_09_22 = 'sancti:09-22:3:w'
SANCTI_09_23 = 'sancti:09-23:3:r'
SANCTI_09_23C = 'sancti:09-23c:4:r' #
SANCTI_09_24 = 'sancti:09-24:4:w'
SANCTI_09_25PL = 'sancti:09-25pl:3:w'
SANCTI_09_26 = 'sancti:09-26:4:r'
Expand All @@ -803,7 +839,9 @@
SANCTI_10_05 = 'sancti:10-05:4:r'
SANCTI_10_06 = 'sancti:10-06:3:w'
SANCTI_10_07 = 'sancti:10-07r:2:w' # Our Lady of the Rosary
SANCTI_10_07C = 'sancti:10-07c:4:r' # St. Mark I
SANCTI_10_08 = 'sancti:10-08r:3:w'
SANCTI_10_08C = 'sancti:10-08c:4:r' # Pro Ss. Sergio, Baccho, Marcello et Apulejo Martyribus
SANCTI_10_09 = 'sancti:10-09:3:w'
SANCTI_10_09PL = 'sancti:10-09pl:3:w'
SANCTI_10_10 = 'sancti:10-10:3:w'
Expand Down Expand Up @@ -1034,7 +1072,6 @@
(SANCTI_06_30, COMMEMORATION_SECTIONS),
(SANCTI_07_01, COMMEMORATION_SECTIONS),
(SANCTI_07_05, COMMEMORATION_SECTIONS),
(SANCTI_08_06, COMMEMORATION_SECTIONS),
(SANCTI_08_17, COMMEMORATION_SECTIONS),
(SANCTI_08_19, COMMEMORATION_SECTIONS),
(SANCTI_08_20, COMMEMORATION_SECTIONS),
Expand Down
Loading

0 comments on commit c6b50c0

Please sign in to comment.