מועד קטן ג:ה · Moed Katan 3:5

הַקּוֹבֵר אֶת מֵתוֹ שְׁלֹשָׁה יָמִים קֹדֶם לָרֶגֶל, בָּטְלָה הֵימֶנּוּ גְּזֵרַת שִׁבְעָה. שְׁמֹנָה, בָּטְלָה הֵימֶנּוּ גְּזֵרַת שְׁלֹשִׁים, מִפְּנֵי שֶׁאָמְרוּ, שַׁבָּת עוֹלָה וְאֵינָהּ מַפְסֶקֶת, רְגָלִים מַפְסִיקִין וְאֵינָן עוֹלִין:
One who buries his deceased relative three days before a pilgrimage Festival has the decree of the seven- day period of mourning, i.e., the halakhot and prohibitions associated with that period, nullified for him by the Festival. He is not required to complete this seven-day mourning period after the Festival. If one buries his deceased relative eight days before a pilgrimage Festival, then the decree of thirty days is nullified for him. The restrictions that ordinarily apply during this thirty-day mourning period no longer apply after the Festival. This is because the Sages said a principle with regard to this issue: Shabbat counts as one of the days of mourning, although one may not mourn on it and it does not interrupt the mourning period, which continues after Shabbat. The pilgrimage Festivals, on the other hand, interrupt the mourning period, so that if one began mourning before such a Festival, then the mourning period is canceled by the Festival. They do not, however, count. If one did not begin mourning before the Festival, or if his relative died during the Festival, then he is required to complete his mourning period afterward, as the days of the Festival do not count toward the requisite days of mourning.

Word-by-word Breakdown (מילים ושרשים)

הַקּוֹבֵר → One who buries [ק - ב - ר]אֶת → his מֵתוֹ → deceased relative [מ - ו - ת]שְׁלֹשָׁה → three [ש - ל - ש]יָמִים → days [י - מ - ם]קֹדֶם → before [ק - ד - מ]לָרֶגֶל → the Festival [ר - ג - ל]בָּטְלָה → is nullified [ב - ט - ל]הֵימֶנּוּ → for him גְּזֵרַת → the decree of [ג - ז - ר]שִׁבְעָה → seven [ש - ב - ע]שְׁמֹנָה → eight [ש - מ - נ]בָּטְלָה → is nullified [ב - ט - ל]הֵימֶנּוּ → for him גְּזֵרַת → the decree of [ג - ז - ר]שְׁלֹשִׁים → thirty [ש - ל - ש]מִפְּנֵי → because [פ - נ - ה]שֶׁאָמְרוּ → they said [א - מ - ר]שַׁבָּת → Shabbat [ש - ב - ת]עוֹלָה → counts [ע - ל - ה]וְאֵינָהּ → and not מַפְסֶקֶת → it interrupts [פ - ס - ק]רְגָלִים → Festivals [ר - ג - ל]מַפְסִיקִין → interrupt [פ - ס - ק]וְאֵינָן → and not עוֹלִין → they count [ע - ל - ה]