@hebcal/icalendar 4.14.2 → 4.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/index.js +68 -10
  2. package/dist/index.mjs +68 -10
  3. package/package.json +10 -10
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! @hebcal/icalendar v4.14.2 */
1
+ /*! @hebcal/icalendar v4.15.0 */
2
2
  'use strict';
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
@@ -168,7 +168,7 @@ murmurhashJs.exports = murmur3;
168
168
  var murmur3_1 = murmurhashJs.exports.murmur3 = murmur3;
169
169
  murmurhashJs.exports.murmur2 = murmur2;
170
170
 
171
- /*! @hebcal/rest-api v3.8.6 */
171
+ /*! @hebcal/rest-api v3.12.0 */
172
172
 
173
173
  var Chanukah="Hanukkah, the Jewish festival of rededication. Also known as the Festival of Lights";var Pesach="Passover, the Feast of Unleavened Bread. Also called Chag HaMatzot (the Festival of Matzah), it commemorates the Exodus and freedom of the Israelites from ancient Egypt";var Purim="Celebration of Jewish deliverance as told by Megilat Esther. It commemorates a time when the Jewish people living in Persia were saved from extermination";var Shavuot="Festival of Weeks. Commemorates the giving of the Torah at Mount Sinai";var Sigd="Ethiopian Jewish holiday occurring 50 days after Yom Kippur";var Sukkot="Feast of Booths";var holidayDescription = {"Asara B'Tevet":"Fast commemorating the siege of Jerusalem",Chanukah:Chanukah,"Days of the Omer":"7 weeks from the second night of Pesach to the day before Shavuot","Lag BaOmer":"33rd day of counting the Omer","Leil Selichot":"Prayers for forgiveness in preparation for the High Holidays","Pesach Sheni":"Second Passover, one month after Passover",Pesach:Pesach,"Purim Katan":"Minor Purim celebration during Adar I on leap years",Purim:Purim,"Rosh Chodesh Nisan":"Start of month of Nisan on the Hebrew calendar. נִיסָן (transliterated Nisan or Nissan) is the 1st month of the Hebrew year, has 30 days, and corresponds to March or April on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon","Rosh Chodesh Iyyar":"Start of month of Iyyar on the Hebrew calendar. אִיָיר (transliterated Iyyar or Iyar) is the 2nd month of the Hebrew year, has 29 days, and corresponds to April or May on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon","Rosh Chodesh Sivan":"Start of month of Sivan on the Hebrew calendar. Sivan (סִיוָן) is the 3rd month of the Hebrew year, has 30 days, and corresponds to May or June on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon","Rosh Chodesh Tamuz":"Start of month of Tamuz on the Hebrew calendar. תַּמּוּז (transliterated Tamuz or Tammuz) is the 4th month of the Hebrew year, has 29 days, and corresponds to June or July on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon","Rosh Chodesh Av":"Start of month of Av on the Hebrew calendar. Av (אָב) is the 5th month of the Hebrew year, has 30 days, and corresponds to July or August on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon","Rosh Chodesh Elul":"Start of month of Elul on the Hebrew calendar. Elul (אֱלוּל) is the 6th month of the Hebrew year, has 29 days, and corresponds to August or September on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon","Rosh Chodesh Cheshvan":"Start of month of Cheshvan on the Hebrew calendar. חֶשְׁוָן (transliterated Cheshvan or Heshvan) is the 8th month of the Hebrew year, has 29 or 30 days, and corresponds to October or November on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon","Rosh Chodesh Kislev":"Start of month of Kislev on the Hebrew calendar. Kislev (כִּסְלֵו) is the 9th month of the Hebrew year, has 30 or 29 days, and corresponds to November or December on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon","Rosh Chodesh Tevet":"Start of month of Tevet on the Hebrew calendar. Tevet (טֵבֵת) is the 10th month of the Hebrew year, has 29 days, and corresponds to December or January on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon","Rosh Chodesh Sh'vat":"Start of month of Sh'vat on the Hebrew calendar. שְׁבָט (transliterated Sh'vat or Shevat) is the 11th month of the Hebrew year, has 30 days, and corresponds to January or February on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon","Rosh Chodesh Adar":"Start of month of Adar on the Hebrew calendar. Adar (אַדָר) is the 12th month of the Hebrew year, has 29 days, and corresponds to February or March on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon","Rosh Chodesh Adar I":"Start of month of Adar I (on leap years) on the Hebrew calendar. Adar I (אַדָר א׳) is the 12th month of the Hebrew year, occurs only on leap years, has 30 days, and corresponds to February or March on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon","Rosh Chodesh Adar II":"Start of month of Adar II (on leap years) on the Hebrew calendar. Adar II (אַדָר ב׳), sometimes \"Adar Bet\" or \"Adar Sheni\", is the 13th month of the Hebrew year, has 29 days, occurs only on leap years, and corresponds to February or March on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon","Rosh Hashana":"The Jewish New Year. Also spelled Rosh Hashanah","Rosh Hashana LaBehemot":"New Year for Tithing Animals","Shabbat Chazon":"Shabbat before Tish'a B'Av (Shabbat of Prophecy/Shabbat of Vision)","Shabbat HaChodesh":"Shabbat before Rosh Chodesh Nissan","Shabbat HaGadol":"Shabbat before Pesach","Shabbat Machar Chodesh":"When Shabbat falls the day before Rosh Chodesh","Shabbat Nachamu":"Shabbat after Tish'a B'Av (Shabbat of Consolation). The first of seven Shabbatot leading up to Rosh Hashanah. Named after the Haftarah (from Isaiah 40) which begins with the verse נַחֲמוּ נַחֲמוּ, עַמִּי (\"Comfort, oh comfort my people\")","Shabbat Parah":"Shabbat of the Red Heifer","Shabbat Rosh Chodesh":"When Shabbat falls on Rosh Chodesh","Shabbat Shekalim":"Shabbat before Rosh Chodesh Adar","Shabbat Shirah":"Shabbat of Song","Shabbat Shuva":"Shabbat that falls between Rosh Hashanah and Yom Kippur (Shabbat of Returning)","Shabbat Zachor":"Shabbat before Purim",Shavuot:Shavuot,"Shmini Atzeret":"Eighth Day of Assembly","Shushan Purim":"Purim celebrated in Jerusalem and walled cities",Sigd:Sigd,"Simchat Torah":"Day of Celebrating the Torah",Sukkot:Sukkot,"Ta'anit Bechorot":"Fast of the First Born","Ta'anit Esther":"Fast of Esther","Tish'a B'Av":"The Ninth of Av. Fast commemorating the destruction of the two Temples","Tu B'Av":"Minor Jewish holiday of love. Observed on the 15th day of the Hebrew month of Av","Tu BiShvat":"New Year for Trees","Tzom Gedaliah":"Fast of the Seventh Month. Commemorates the assassination of the Jewish governor of Judah","Tzom Tammuz":"Fast commemorating breaching of the walls of Jerusalem before the destruction of the Second Temple","Yom HaAliyah":"Recognizes Aliyah, immigration to the Jewish State of Israel","Yom HaAliyah School Observance":"Aliyah Day observed in Israeli schools","Yom HaAtzma'ut":"Israeli Independence Day. Commemorates the declaration of independence of Israel in 1948. Note that Hebcal displays modern holidays like Yom HaAtzma'ut according to the Israeli schedule. Although Yom HaAtzma'ut is normally observed on the 5th of Iyyar, it may be moved earlier or postponed if observance of the holiday (or Yom HaZikaron, which always precedes it) would conflict with Shabbat","Yom HaShoah":"Holocaust Memorial Day","Yom HaZikaron":"Israeli Memorial Day. Note that Hebcal displays modern holidays like Yom HaZikaron according to the Israeli schedule. Although Yom Hazikaron is normally observed on the 4th of Iyyar, it may be moved earlier or postponed if observance of the holiday (or Yom HaAtzma'ut, which always follows it) would conflict with Shabbat","Yom Kippur":"Day of Atonement","Yom Yerushalayim":"Jerusalem Day. Commemorates the re-unification of Jerusalem in 1967"};
174
174
 
@@ -267,6 +267,9 @@ function getEventCategories(ev) {
267
267
 
268
268
  case core.flags.MINOR_HOLIDAY:
269
269
  return ['holiday', 'minor'];
270
+
271
+ case core.flags.MISHNA_YOMI:
272
+ return ['mishnayomi'];
270
273
  // fall through to string-based category
271
274
  }
272
275
 
@@ -322,6 +325,10 @@ function getCalendarTitle(events, options) {
322
325
  title += ' Diaspora';
323
326
  }
324
327
 
328
+ if (options.subscribe == '1') {
329
+ return title;
330
+ }
331
+
325
332
  if (options.isHebrewYear || events.length == 0) {
326
333
  title += ' ' + options.year;
327
334
  } else {
@@ -363,7 +370,7 @@ function getHolidayDescription(ev, firstSentence = false) {
363
370
 
364
371
  return str;
365
372
  }
366
- const HOLIDAY_IGNORE_MASK = core.flags.DAF_YOMI | core.flags.OMER_COUNT | core.flags.SHABBAT_MEVARCHIM | core.flags.MOLAD | core.flags.USER_EVENT | core.flags.HEBREW_DATE;
373
+ const HOLIDAY_IGNORE_MASK$1 = core.flags.DAF_YOMI | core.flags.OMER_COUNT | core.flags.SHABBAT_MEVARCHIM | core.flags.MOLAD | core.flags.USER_EVENT | core.flags.HEBREW_DATE;
367
374
  /**
368
375
  * Makes mulit-line text that summarizes Torah & Haftarah
369
376
  * @param {Event} ev
@@ -374,7 +381,7 @@ const HOLIDAY_IGNORE_MASK = core.flags.DAF_YOMI | core.flags.OMER_COUNT | core.f
374
381
  function makeTorahMemoText(ev, il) {
375
382
  const mask = ev.getFlags();
376
383
 
377
- if (mask & HOLIDAY_IGNORE_MASK) {
384
+ if (mask & HOLIDAY_IGNORE_MASK$1) {
378
385
  return '';
379
386
  }
380
387
 
@@ -447,12 +454,13 @@ function shouldRenderBrief(ev) {
447
454
  }
448
455
  }
449
456
 
450
- var version="4.14.2";
457
+ var version="4.15.0";
451
458
 
452
459
  const VTIMEZONE = {};
453
460
  const CATEGORY = {
454
461
  candles: 'Holiday',
455
462
  dafyomi: 'Daf Yomi',
463
+ mishnayomi: 'Mishna Yomi',
456
464
  havdalah: 'Holiday',
457
465
  hebdate: null,
458
466
  holiday: 'Holiday',
@@ -497,6 +505,7 @@ function appendTrackingToUrl(url, options) {
497
505
  }
498
506
 
499
507
  const encoder = new TextEncoder();
508
+ const char74re = /(.{1,74})/g;
500
509
  /**
501
510
  * Represents an RFC 2445 iCalendar VEVENT
502
511
  */
@@ -520,6 +529,8 @@ class IcalEvent {
520
529
  this.locationName = ev.locationName;
521
530
  } else if (mask & core.flags.DAF_YOMI) {
522
531
  this.locationName = core.Locale.gettext('Daf Yomi');
532
+ } else if (mask & core.flags.MISHNA_YOMI) {
533
+ this.locationName = core.Locale.gettext('Mishna Yomi');
523
534
  } else if (timed && options.location && options.location.name) {
524
535
  const comma = options.location.name.indexOf(',');
525
536
  this.locationName = comma == -1 ? options.location.name : options.location.name.substring(0, comma);
@@ -674,6 +685,19 @@ class IcalEvent {
674
685
 
675
686
 
676
687
  static fold(line) {
688
+ let isASCII = true;
689
+
690
+ for (let i = 0; i < line.length; i++) {
691
+ if (line.charCodeAt(i) > 255) {
692
+ isASCII = false;
693
+ break;
694
+ }
695
+ }
696
+
697
+ if (isASCII) {
698
+ return line.length <= 74 ? line : line.match(char74re).join('\r\n ');
699
+ }
700
+
677
701
  if (encoder.encode(line).length <= 74) {
678
702
  return line;
679
703
  } // iterate unicode character by character, making sure
@@ -682,17 +706,21 @@ class IcalEvent {
682
706
 
683
707
  let result = '';
684
708
  let current = '';
709
+ let len = 0;
685
710
 
686
711
  for (let i = 0; i < line.length; i++) {
687
- const candidate = current + line[i];
688
- const len = encoder.encode(candidate).length;
712
+ const char = line[i];
713
+ const octets = char.charCodeAt(0) < 256 ? 1 : encoder.encode(char).length;
714
+ const newlen = len + octets;
689
715
 
690
- if (len < 75) {
691
- current = candidate;
716
+ if (newlen < 75) {
717
+ current += char;
718
+ len = newlen;
692
719
  } else {
693
720
  result += current + '\r\n ';
694
721
  line = line.substring(i);
695
722
  current = '';
723
+ len = 0;
696
724
  i = -1;
697
725
  }
698
726
  }
@@ -755,6 +783,35 @@ function eventToIcal(ev, options) {
755
783
  const ical = new IcalEvent(ev, options);
756
784
  return ical.toString();
757
785
  }
786
+ const torahMemoCache = new Map();
787
+ const HOLIDAY_IGNORE_MASK = core.flags.DAF_YOMI | core.flags.OMER_COUNT | core.flags.SHABBAT_MEVARCHIM | core.flags.MOLAD | core.flags.USER_EVENT | core.flags.MISHNA_YOMI | core.flags.HEBREW_DATE;
788
+ /**
789
+ * @private
790
+ * @param {Event} ev
791
+ * @param {boolean} il
792
+ * @return {string}
793
+ */
794
+
795
+ function makeTorahMemo(ev, il) {
796
+ if (ev.getFlags() & HOLIDAY_IGNORE_MASK) {
797
+ return '';
798
+ }
799
+
800
+ const hd = ev.getDate();
801
+ const yy = hd.getFullYear();
802
+ const mm = hd.getMonth();
803
+ const dd = hd.getDate();
804
+ const key = [yy, mm, dd, il ? '1' : '0', ev.getDesc()].join('-');
805
+ let memo = torahMemoCache.get(key);
806
+
807
+ if (typeof memo === 'string') {
808
+ return memo;
809
+ }
810
+
811
+ memo = makeTorahMemoText(ev, il).replace(/\n/g, '\\n');
812
+ torahMemoCache.set(key, memo);
813
+ return memo;
814
+ }
758
815
  /**
759
816
  * @private
760
817
  * @param {Event} e
@@ -762,6 +819,7 @@ function eventToIcal(ev, options) {
762
819
  * @return {string}
763
820
  */
764
821
 
822
+
765
823
  function createMemo(e, options) {
766
824
  const desc = e.getDesc();
767
825
  const candles = desc === 'Havdalah' || desc === 'Candle lighting';
@@ -777,7 +835,7 @@ function createMemo(e, options) {
777
835
  }
778
836
 
779
837
  const url = appendTrackingToUrl(e.url(), options);
780
- const torahMemo = makeTorahMemoText(e, options.il).replace(/\n/g, '\\n');
838
+ const torahMemo = makeTorahMemo(e, options.il);
781
839
 
782
840
  if (mask & core.flags.PARSHA_HASHAVUA) {
783
841
  return torahMemo + '\\n\\n' + url;
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- /*! @hebcal/icalendar v4.14.2 */
1
+ /*! @hebcal/icalendar v4.15.0 */
2
2
  import { flags, Locale } from '@hebcal/core';
3
3
  import * as leyn from '@hebcal/leyning';
4
4
  import { promises } from 'fs';
@@ -144,7 +144,7 @@ murmurhashJs.exports = murmur3;
144
144
  var murmur3_1 = murmurhashJs.exports.murmur3 = murmur3;
145
145
  murmurhashJs.exports.murmur2 = murmur2;
146
146
 
147
- /*! @hebcal/rest-api v3.8.6 */
147
+ /*! @hebcal/rest-api v3.12.0 */
148
148
 
149
149
  var Chanukah="Hanukkah, the Jewish festival of rededication. Also known as the Festival of Lights";var Pesach="Passover, the Feast of Unleavened Bread. Also called Chag HaMatzot (the Festival of Matzah), it commemorates the Exodus and freedom of the Israelites from ancient Egypt";var Purim="Celebration of Jewish deliverance as told by Megilat Esther. It commemorates a time when the Jewish people living in Persia were saved from extermination";var Shavuot="Festival of Weeks. Commemorates the giving of the Torah at Mount Sinai";var Sigd="Ethiopian Jewish holiday occurring 50 days after Yom Kippur";var Sukkot="Feast of Booths";var holidayDescription = {"Asara B'Tevet":"Fast commemorating the siege of Jerusalem",Chanukah:Chanukah,"Days of the Omer":"7 weeks from the second night of Pesach to the day before Shavuot","Lag BaOmer":"33rd day of counting the Omer","Leil Selichot":"Prayers for forgiveness in preparation for the High Holidays","Pesach Sheni":"Second Passover, one month after Passover",Pesach:Pesach,"Purim Katan":"Minor Purim celebration during Adar I on leap years",Purim:Purim,"Rosh Chodesh Nisan":"Start of month of Nisan on the Hebrew calendar. נִיסָן (transliterated Nisan or Nissan) is the 1st month of the Hebrew year, has 30 days, and corresponds to March or April on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon","Rosh Chodesh Iyyar":"Start of month of Iyyar on the Hebrew calendar. אִיָיר (transliterated Iyyar or Iyar) is the 2nd month of the Hebrew year, has 29 days, and corresponds to April or May on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon","Rosh Chodesh Sivan":"Start of month of Sivan on the Hebrew calendar. Sivan (סִיוָן) is the 3rd month of the Hebrew year, has 30 days, and corresponds to May or June on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon","Rosh Chodesh Tamuz":"Start of month of Tamuz on the Hebrew calendar. תַּמּוּז (transliterated Tamuz or Tammuz) is the 4th month of the Hebrew year, has 29 days, and corresponds to June or July on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon","Rosh Chodesh Av":"Start of month of Av on the Hebrew calendar. Av (אָב) is the 5th month of the Hebrew year, has 30 days, and corresponds to July or August on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon","Rosh Chodesh Elul":"Start of month of Elul on the Hebrew calendar. Elul (אֱלוּל) is the 6th month of the Hebrew year, has 29 days, and corresponds to August or September on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon","Rosh Chodesh Cheshvan":"Start of month of Cheshvan on the Hebrew calendar. חֶשְׁוָן (transliterated Cheshvan or Heshvan) is the 8th month of the Hebrew year, has 29 or 30 days, and corresponds to October or November on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon","Rosh Chodesh Kislev":"Start of month of Kislev on the Hebrew calendar. Kislev (כִּסְלֵו) is the 9th month of the Hebrew year, has 30 or 29 days, and corresponds to November or December on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon","Rosh Chodesh Tevet":"Start of month of Tevet on the Hebrew calendar. Tevet (טֵבֵת) is the 10th month of the Hebrew year, has 29 days, and corresponds to December or January on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon","Rosh Chodesh Sh'vat":"Start of month of Sh'vat on the Hebrew calendar. שְׁבָט (transliterated Sh'vat or Shevat) is the 11th month of the Hebrew year, has 30 days, and corresponds to January or February on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon","Rosh Chodesh Adar":"Start of month of Adar on the Hebrew calendar. Adar (אַדָר) is the 12th month of the Hebrew year, has 29 days, and corresponds to February or March on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon","Rosh Chodesh Adar I":"Start of month of Adar I (on leap years) on the Hebrew calendar. Adar I (אַדָר א׳) is the 12th month of the Hebrew year, occurs only on leap years, has 30 days, and corresponds to February or March on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon","Rosh Chodesh Adar II":"Start of month of Adar II (on leap years) on the Hebrew calendar. Adar II (אַדָר ב׳), sometimes \"Adar Bet\" or \"Adar Sheni\", is the 13th month of the Hebrew year, has 29 days, occurs only on leap years, and corresponds to February or March on the Gregorian calendar. רֹאשׁ חוֹדֶשׁ, transliterated Rosh Chodesh or Rosh Hodesh, is a minor holiday that occurs at the beginning of every month in the Hebrew calendar. It is marked by the birth of a new moon","Rosh Hashana":"The Jewish New Year. Also spelled Rosh Hashanah","Rosh Hashana LaBehemot":"New Year for Tithing Animals","Shabbat Chazon":"Shabbat before Tish'a B'Av (Shabbat of Prophecy/Shabbat of Vision)","Shabbat HaChodesh":"Shabbat before Rosh Chodesh Nissan","Shabbat HaGadol":"Shabbat before Pesach","Shabbat Machar Chodesh":"When Shabbat falls the day before Rosh Chodesh","Shabbat Nachamu":"Shabbat after Tish'a B'Av (Shabbat of Consolation). The first of seven Shabbatot leading up to Rosh Hashanah. Named after the Haftarah (from Isaiah 40) which begins with the verse נַחֲמוּ נַחֲמוּ, עַמִּי (\"Comfort, oh comfort my people\")","Shabbat Parah":"Shabbat of the Red Heifer","Shabbat Rosh Chodesh":"When Shabbat falls on Rosh Chodesh","Shabbat Shekalim":"Shabbat before Rosh Chodesh Adar","Shabbat Shirah":"Shabbat of Song","Shabbat Shuva":"Shabbat that falls between Rosh Hashanah and Yom Kippur (Shabbat of Returning)","Shabbat Zachor":"Shabbat before Purim",Shavuot:Shavuot,"Shmini Atzeret":"Eighth Day of Assembly","Shushan Purim":"Purim celebrated in Jerusalem and walled cities",Sigd:Sigd,"Simchat Torah":"Day of Celebrating the Torah",Sukkot:Sukkot,"Ta'anit Bechorot":"Fast of the First Born","Ta'anit Esther":"Fast of Esther","Tish'a B'Av":"The Ninth of Av. Fast commemorating the destruction of the two Temples","Tu B'Av":"Minor Jewish holiday of love. Observed on the 15th day of the Hebrew month of Av","Tu BiShvat":"New Year for Trees","Tzom Gedaliah":"Fast of the Seventh Month. Commemorates the assassination of the Jewish governor of Judah","Tzom Tammuz":"Fast commemorating breaching of the walls of Jerusalem before the destruction of the Second Temple","Yom HaAliyah":"Recognizes Aliyah, immigration to the Jewish State of Israel","Yom HaAliyah School Observance":"Aliyah Day observed in Israeli schools","Yom HaAtzma'ut":"Israeli Independence Day. Commemorates the declaration of independence of Israel in 1948. Note that Hebcal displays modern holidays like Yom HaAtzma'ut according to the Israeli schedule. Although Yom HaAtzma'ut is normally observed on the 5th of Iyyar, it may be moved earlier or postponed if observance of the holiday (or Yom HaZikaron, which always precedes it) would conflict with Shabbat","Yom HaShoah":"Holocaust Memorial Day","Yom HaZikaron":"Israeli Memorial Day. Note that Hebcal displays modern holidays like Yom HaZikaron according to the Israeli schedule. Although Yom Hazikaron is normally observed on the 4th of Iyyar, it may be moved earlier or postponed if observance of the holiday (or Yom HaAtzma'ut, which always follows it) would conflict with Shabbat","Yom Kippur":"Day of Atonement","Yom Yerushalayim":"Jerusalem Day. Commemorates the re-unification of Jerusalem in 1967"};
150
150
 
@@ -243,6 +243,9 @@ function getEventCategories(ev) {
243
243
 
244
244
  case flags.MINOR_HOLIDAY:
245
245
  return ['holiday', 'minor'];
246
+
247
+ case flags.MISHNA_YOMI:
248
+ return ['mishnayomi'];
246
249
  // fall through to string-based category
247
250
  }
248
251
 
@@ -298,6 +301,10 @@ function getCalendarTitle(events, options) {
298
301
  title += ' Diaspora';
299
302
  }
300
303
 
304
+ if (options.subscribe == '1') {
305
+ return title;
306
+ }
307
+
301
308
  if (options.isHebrewYear || events.length == 0) {
302
309
  title += ' ' + options.year;
303
310
  } else {
@@ -339,7 +346,7 @@ function getHolidayDescription(ev, firstSentence = false) {
339
346
 
340
347
  return str;
341
348
  }
342
- const HOLIDAY_IGNORE_MASK = flags.DAF_YOMI | flags.OMER_COUNT | flags.SHABBAT_MEVARCHIM | flags.MOLAD | flags.USER_EVENT | flags.HEBREW_DATE;
349
+ const HOLIDAY_IGNORE_MASK$1 = flags.DAF_YOMI | flags.OMER_COUNT | flags.SHABBAT_MEVARCHIM | flags.MOLAD | flags.USER_EVENT | flags.HEBREW_DATE;
343
350
  /**
344
351
  * Makes mulit-line text that summarizes Torah & Haftarah
345
352
  * @param {Event} ev
@@ -350,7 +357,7 @@ const HOLIDAY_IGNORE_MASK = flags.DAF_YOMI | flags.OMER_COUNT | flags.SHABBAT_ME
350
357
  function makeTorahMemoText(ev, il) {
351
358
  const mask = ev.getFlags();
352
359
 
353
- if (mask & HOLIDAY_IGNORE_MASK) {
360
+ if (mask & HOLIDAY_IGNORE_MASK$1) {
354
361
  return '';
355
362
  }
356
363
 
@@ -423,12 +430,13 @@ function shouldRenderBrief(ev) {
423
430
  }
424
431
  }
425
432
 
426
- var version="4.14.2";
433
+ var version="4.15.0";
427
434
 
428
435
  const VTIMEZONE = {};
429
436
  const CATEGORY = {
430
437
  candles: 'Holiday',
431
438
  dafyomi: 'Daf Yomi',
439
+ mishnayomi: 'Mishna Yomi',
432
440
  havdalah: 'Holiday',
433
441
  hebdate: null,
434
442
  holiday: 'Holiday',
@@ -473,6 +481,7 @@ function appendTrackingToUrl(url, options) {
473
481
  }
474
482
 
475
483
  const encoder = new TextEncoder();
484
+ const char74re = /(.{1,74})/g;
476
485
  /**
477
486
  * Represents an RFC 2445 iCalendar VEVENT
478
487
  */
@@ -496,6 +505,8 @@ class IcalEvent {
496
505
  this.locationName = ev.locationName;
497
506
  } else if (mask & flags.DAF_YOMI) {
498
507
  this.locationName = Locale.gettext('Daf Yomi');
508
+ } else if (mask & flags.MISHNA_YOMI) {
509
+ this.locationName = Locale.gettext('Mishna Yomi');
499
510
  } else if (timed && options.location && options.location.name) {
500
511
  const comma = options.location.name.indexOf(',');
501
512
  this.locationName = comma == -1 ? options.location.name : options.location.name.substring(0, comma);
@@ -650,6 +661,19 @@ class IcalEvent {
650
661
 
651
662
 
652
663
  static fold(line) {
664
+ let isASCII = true;
665
+
666
+ for (let i = 0; i < line.length; i++) {
667
+ if (line.charCodeAt(i) > 255) {
668
+ isASCII = false;
669
+ break;
670
+ }
671
+ }
672
+
673
+ if (isASCII) {
674
+ return line.length <= 74 ? line : line.match(char74re).join('\r\n ');
675
+ }
676
+
653
677
  if (encoder.encode(line).length <= 74) {
654
678
  return line;
655
679
  } // iterate unicode character by character, making sure
@@ -658,17 +682,21 @@ class IcalEvent {
658
682
 
659
683
  let result = '';
660
684
  let current = '';
685
+ let len = 0;
661
686
 
662
687
  for (let i = 0; i < line.length; i++) {
663
- const candidate = current + line[i];
664
- const len = encoder.encode(candidate).length;
688
+ const char = line[i];
689
+ const octets = char.charCodeAt(0) < 256 ? 1 : encoder.encode(char).length;
690
+ const newlen = len + octets;
665
691
 
666
- if (len < 75) {
667
- current = candidate;
692
+ if (newlen < 75) {
693
+ current += char;
694
+ len = newlen;
668
695
  } else {
669
696
  result += current + '\r\n ';
670
697
  line = line.substring(i);
671
698
  current = '';
699
+ len = 0;
672
700
  i = -1;
673
701
  }
674
702
  }
@@ -731,6 +759,35 @@ function eventToIcal(ev, options) {
731
759
  const ical = new IcalEvent(ev, options);
732
760
  return ical.toString();
733
761
  }
762
+ const torahMemoCache = new Map();
763
+ const HOLIDAY_IGNORE_MASK = flags.DAF_YOMI | flags.OMER_COUNT | flags.SHABBAT_MEVARCHIM | flags.MOLAD | flags.USER_EVENT | flags.MISHNA_YOMI | flags.HEBREW_DATE;
764
+ /**
765
+ * @private
766
+ * @param {Event} ev
767
+ * @param {boolean} il
768
+ * @return {string}
769
+ */
770
+
771
+ function makeTorahMemo(ev, il) {
772
+ if (ev.getFlags() & HOLIDAY_IGNORE_MASK) {
773
+ return '';
774
+ }
775
+
776
+ const hd = ev.getDate();
777
+ const yy = hd.getFullYear();
778
+ const mm = hd.getMonth();
779
+ const dd = hd.getDate();
780
+ const key = [yy, mm, dd, il ? '1' : '0', ev.getDesc()].join('-');
781
+ let memo = torahMemoCache.get(key);
782
+
783
+ if (typeof memo === 'string') {
784
+ return memo;
785
+ }
786
+
787
+ memo = makeTorahMemoText(ev, il).replace(/\n/g, '\\n');
788
+ torahMemoCache.set(key, memo);
789
+ return memo;
790
+ }
734
791
  /**
735
792
  * @private
736
793
  * @param {Event} e
@@ -738,6 +795,7 @@ function eventToIcal(ev, options) {
738
795
  * @return {string}
739
796
  */
740
797
 
798
+
741
799
  function createMemo(e, options) {
742
800
  const desc = e.getDesc();
743
801
  const candles = desc === 'Havdalah' || desc === 'Candle lighting';
@@ -753,7 +811,7 @@ function createMemo(e, options) {
753
811
  }
754
812
 
755
813
  const url = appendTrackingToUrl(e.url(), options);
756
- const torahMemo = makeTorahMemoText(e, options.il).replace(/\n/g, '\\n');
814
+ const torahMemo = makeTorahMemo(e, options.il);
757
815
 
758
816
  if (mask & flags.PARSHA_HASHAVUA) {
759
817
  return torahMemo + '\\n\\n' + url;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hebcal/icalendar",
3
- "version": "4.14.2",
3
+ "version": "4.15.0",
4
4
  "author": "Michael J. Radwin (https://github.com/mjradwin)",
5
5
  "keywords": [
6
6
  "ical",
@@ -24,8 +24,8 @@
24
24
  "url": "https://github.com/hebcal/hebcal-icalendar/issues"
25
25
  },
26
26
  "dependencies": {
27
- "@hebcal/core": "^3.27.0",
28
- "@hebcal/rest-api": "^3.8.6"
27
+ "@hebcal/core": "^3.33.1",
28
+ "@hebcal/rest-api": "^3.12.0"
29
29
  },
30
30
  "scripts": {
31
31
  "build": "rollup -c",
@@ -55,19 +55,19 @@
55
55
  },
56
56
  "devDependencies": {
57
57
  "@ava/babel": "^2.0.0",
58
- "@babel/core": "^7.15.8",
59
- "@babel/preset-env": "^7.15.8",
60
- "@babel/register": "^7.14.5",
58
+ "@babel/core": "^7.16.10",
59
+ "@babel/preset-env": "^7.16.11",
60
+ "@babel/register": "^7.16.9",
61
61
  "@rollup/plugin-babel": "^5.3.0",
62
- "@rollup/plugin-commonjs": "^20.0.0",
62
+ "@rollup/plugin-commonjs": "^21.0.1",
63
63
  "@rollup/plugin-json": "^4.1.0",
64
- "@rollup/plugin-node-resolve": "^13.0.6",
64
+ "@rollup/plugin-node-resolve": "^13.1.3",
65
65
  "ava": "^3.15.0",
66
- "eslint": "^7.32.0",
66
+ "eslint": "^8.7.0",
67
67
  "eslint-config-google": "^0.14.0",
68
68
  "jsdoc": "^3.6.7",
69
69
  "jsdoc-to-markdown": "^7.1.0",
70
70
  "murmurhash-js": "^1.0.0",
71
- "rollup": "^2.58.0"
71
+ "rollup": "^2.64.0"
72
72
  }
73
73
  }