calendarium-romanum / data-contrib

Contributed sanctorale data files (accuracy not guaranteed)
MIT License
0 stars 0 forks source link

romcal export: handle movable feasts #10

Open igneus opened 4 years ago

igneus commented 4 years ago

Some romcal calendars contain movable feasts - their entries usually look like this:

    // ...
    {
      "key": "ourLadyOfTheValley",
      "type": Types.MEMORIAL,

      // instead of a fixed date there's an instantly invoked function computing a movable date for the given year
      "moment": ( y => Dates.divineMercySunday( y ).add( 6, 'days'))( year ),

      "data": {
        "meta": {
          "liturgicalColor": LiturgicalColors.WHITE
        }
      }
    },
    // ...

When iterating through the calendar in bin/romcal-export.js it's impossible to distinguish them from fixed-date celebrations, so currently they are treated the same as fixed-date celebration and exported with the date they fell on in some example year used by the script. That's, of course, incorrect. The best way to handle them would be to print just a comment with (romcal) ID of the celebration and a note that the celebration is movable. (calendarium-romanum doesn't support movable celebrations in sanctorale data files.)

Since it seems to be impossible to detect movable celebrations at runtime, there's probably no other way but going through source code of all romcal calendars, finding movable celebrations and collecting their IDs to a blacklist. (It may be possible to automate this work using some JavaScript parser library and processing AST of the calendars, but it would probably require more effort than doing the work manually.)