Skip to content

Commit 4d9405c

Browse files
committed
Strip Peninei Halacha prefixes
1 parent e906c8d commit 4d9405c

14 files changed

+307
-328
lines changed

api_request_handler.ts

+17-5
Original file line numberDiff line numberDiff line change
@@ -162,19 +162,15 @@ class Comment {
162162

163163
const talmudPageLink = _internalLinkableRef?.toUrlPathname();
164164

165+
[sourceRef, sourceHeRef] = Comment.maybeRewriteRefNames(englishName, sourceRef, sourceHeRef);
165166
if (englishName === "Shulchan Arukh") {
166-
sourceRef = stripPossiblePrefix(sourceRef, "Shulchan Arukh, ");
167-
sourceHeRef = stripPossiblePrefix(sourceHeRef, "שולחן ערוך, ");
168167
const subtitle = shulchanArukhChapterTitle(ref);
169168
if (subtitle) {
170169
sourceHeRef = `${sourceHeRef} - ${subtitle}`;
171170
if (ref.endsWith(":1")) {
172171
hebrew = ShulchanArukhHeaderRemover.process(hebrew, englishName);
173172
}
174173
}
175-
} else if (englishName === "Mishneh Torah") {
176-
sourceRef = stripPossiblePrefix(sourceRef, "Mishneh Torah, ");
177-
sourceHeRef = stripPossiblePrefix(sourceHeRef, "משנה תורה, ");
178174
}
179175

180176
return new Comment(
@@ -190,6 +186,22 @@ class Comment {
190186
);
191187
}
192188

189+
static maybeRewriteRefNames(
190+
englishName: string, sourceRef: string, sourceHeRef: string,
191+
): [string, string] {
192+
if (englishName === "Shulchan Arukh") {
193+
sourceRef = stripPossiblePrefix(sourceRef, "Shulchan Arukh, ");
194+
sourceHeRef = stripPossiblePrefix(sourceHeRef, "שולחן ערוך, ");
195+
} else if (englishName === "Mishneh Torah") {
196+
sourceRef = stripPossiblePrefix(sourceRef, "Mishneh Torah, ");
197+
sourceHeRef = stripPossiblePrefix(sourceHeRef, "משנה תורה, ");
198+
} else if (englishName === "Peninei Halakhah") {
199+
sourceRef = stripPossiblePrefix(sourceRef, "Peninei Halakhah, ");
200+
sourceHeRef = stripPossiblePrefix(sourceHeRef, "פניני הלכה, ");
201+
}
202+
return [sourceRef, sourceHeRef];
203+
}
204+
193205
constructor(
194206
readonly englishName: string,
195207
readonly hebrew: sefaria.TextType,

test_data/api_request_handler/Berakhot.2a.expected-output.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -238,15 +238,15 @@
238238
"en": "The time to recite the evening Keriat Shema is “when you lie down” – when people lie on their beds to sleep, which starts when it gets dark. The Chachamim established a sign for the beginning of this time, when three medium-sized stars can be seen in the sky. This is because large stars are also visible during the day or at bein hashemashot (twilight). However, when three medium-size stars (according to the naked eye) emerge after them, it is a sign that night has begun (HaZemanim BaHalachah chapters 49-50). This time is called tzeit hakochavim. To avoid error, and to prevent mistaking big stars for medium ones, the Rishonim write that one must wait until he sees three small stars appear in the sky (Talmidei Rabbeinu Yonah; Shulchan Aruch 235:1).",
239239
"he": "זמן קריאת שמע של לילה הוא \"וּבְשָׁכְבְּךָ\" – בזמן שאנשים שוכבים על מיטתם. ותחילתו כשמחשיך, וקבעו לזה חכמים סימן: משיצאו שלושה כוכבים בינוניים. משום שהכוכבים שנראים לנו גדולים, כדוגמת נוגה, מאדים וצדק, נראים גם ביום או בבין השמשות. אבל כשיצאו שלושת הכוכבים שאחריהם, שהם נראים לנו בינוניים, אז הוא סימן לתחילת הלילה <span class=\"parenthesized\">(הזמנים בהלכה פרקים מט-נ)</span>. זמן זה נקרא 'צאת הכוכבים'. וכדי שלא יטעה אדם לחשוב שהגדולים הם הבינוניים, כתבו הראשונים שימתין עד שיראה שלושה כוכבים קטנים <span class=\"parenthesized\">(תר\"י, שו\"ע או\"ח רלה, א)</span>.",
240240
"ref": "Peninei Halakhah, Prayer 25:5:2",
241-
"sourceHeRef": "פניני הלכה, תפילה כה:ה:ב",
242-
"sourceRef": "Peninei Halakhah, Prayer 25:5:2"
241+
"sourceHeRef": "תפילה כה:ה:ב",
242+
"sourceRef": "Prayer 25:5:2"
243243
},
244244
{
245245
"en": "Even though according to Rabbi Yehudah the time to recite Ma’ariv and Birkot Keriat Shema starts at plag haminchah, the time of Keriat Shema itself does not begin until tzeit hakochavim. Therefore, a person praying before tzeit hakochavim must repeat the three paragraphs of Shema after tzeit hakochavim (Shulchan Aruch 235:1).",
246246
"he": "ואף שלדעת רבי יהודה זמן תפילת ערבית וברכות קריאת שמע מתחיל מפלג המנחה, זמן קריאת שמע מצאת הכוכבים. לפיכך צריך המתפלל לפני צאת הכוכבים לחזור ולקרוא את שלוש פרשיות שמע אחר צאת הכוכבים <span class=\"parenthesized\">(שו\"ע או\"ח רלה, א)</span>.",
247247
"ref": "Peninei Halakhah, Prayer 25:6:3",
248-
"sourceHeRef": "פניני הלכה, תפילה כה:ו:ג",
249-
"sourceRef": "Peninei Halakhah, Prayer 25:6:3"
248+
"sourceHeRef": "תפילה כה:ו:ג",
249+
"sourceRef": "Prayer 25:6:3"
250250
}
251251
]
252252
}

0 commit comments

Comments
 (0)