Moed Katan, Chapter Three, Mishnah Five
From here until the end, Moed Katan deals with mourning practices. There is no separate tractate in the Mishnah concerning mourning so the few halakhot that the Mishnah does contain are placed here. There are probably several reasons for this. First of all, as we shall see below, the Mishnah deals with the question of mourning which occurs right before a festival. On a deeper level, the week of mourning (the shivah) and the week of the festival seem to be flipsides of the same coin. Both are seven days long, one of celebration and one of sadness. It is forbidden to do work during the festival because one is supposed to be celebrating. During shivah it is forbidden to do work because one is supposed to be mourning. Similarly, marriages are prohibited during the festival and during the shivah. There are other halakhot which are shared by both holidays.
The two periods of mourning mentioned in our mishnah are shivah, seven days, and shloshim, thirty days. The first period is more intense and its restrictions are more numerous than the latter. The mishnah deals with the question of a person whose period of mourning is interrupted by a festival.
1) One who buries his dead three days before a festival, the decrees of shiva are annulled from him;
2) [One he buries his dead] eight days before a festival, the decrees of the shloshim [thirty days] are annulled from him.
3) Because they [the sages] said that Shabbat counts but does not interrupt, while festivals interrupt and do not count.
Section one: If one of a persons close relatives dies at least three days before the start of a festival, the festival annuls the shivah (the seven day period of mourning). When the festival is over he will not need to complete the shivah.
Today, the halakhah is that if the persons relative dies and is buried right right before the festival, even an hour before the festival, the shivah is cancelled. However, the mishnah and earlier halakhah held that at least three days of the shivah had to be observed. If three days were not observed than the shivah continues after the festival. These three days seem to be the essential period of mourning, more critical than the rest of the shivah.
Section two: If he buries a close relative eight days before the festival, he has begun to observe shloshim, the second stage of mourning when the festival begins and the festival annuls the remainder of shloshim. This would mean that after the festival there is no more mourning at all (except in the case of a dead parent).
Section three: This section explains the rationale of the previous two sections. Shabbat counts as part of the shivah and shloshim and does not interrupt either of them. The festivals, in contrast, do not count. This means that if someone dies on the festival, the mourners do not begin mourning until after the festival, when they will have a full period of shivah and shloshim. However, the festival does interrupt, such that if someone begins mourning three days before the festival the festival will annul shivah; eight days will annul shloshim.