Skip to content

Commit e906c8d

Browse files
committed
Run Sefaria link sanitization on Hebrew also
1 parent 938e7a8 commit e906c8d

16 files changed

+108
-102
lines changed

api_request_handler.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,11 @@ import {checkNotUndefined} from "./js/undefined";
7878
import {getWeekdayReading} from "./weekday_parshiot";
7979
import {ASERET_YIMEI_TESHUVA_REFS} from "./js/aseret_yimei_teshuva";
8080

81+
const standardHebrewTransformations = sefariaTextTypeTransformation(
82+
hebrew => (
83+
HtmlNormalizer.process(SefariaLinkSanitizer.process(hebrew))
84+
));
85+
8186
const standardEnglishTransformations = sefariaTextTypeTransformation(
8287
english => (
8388
HtmlNormalizer.process(
@@ -131,6 +136,7 @@ class Comment {
131136
[hebrew, english] = parseOtzarLaazeiRashi(hebrew as string);
132137
}
133138

139+
hebrew = standardHebrewTransformations(hebrew);
134140
hebrew = boldDibureiHamatchil(hebrew, englishName);
135141
hebrew = highlightRashiQuotations(hebrew);
136142
for (const processor of (
@@ -139,7 +145,7 @@ class Comment {
139145
CommentaryPrefixStripper,
140146
CommentaryParenthesesTransformer,
141147
ImageNumberingFormatter,
142-
HtmlNormalizer])) {
148+
])) {
143149
hebrew = processor.process(hebrew, englishName);
144150
}
145151

@@ -499,7 +505,8 @@ export abstract class AbstractApiRequestHandler {
499505

500506
// eslint-disable-next-line @typescript-eslint/no-unused-vars
501507
protected translateHebrewText(text: sefaria.TextType, ref: string): sefaria.TextType {
502-
return sefariaTextTypeTransformation(this.replaceLotsOfNonBreakingSpacesWithNewlines)(text);
508+
return standardHebrewTransformations(
509+
sefariaTextTypeTransformation(this.replaceLotsOfNonBreakingSpacesWithNewlines)(text));
503510
}
504511

505512
// eslint-disable-next-line @typescript-eslint/no-unused-vars

source_formatting/sefaria_link_sanitizer.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ export class SefariaLinkSanitizer extends HtmlVisitor {
3131
this.anchorStack.push("span");
3232
} else {
3333
this.anchorStack.push(false);
34-
console.error("!!!!!!!!!!!!!!!!!!!!!!", attributes);
3534
}
3635
}
3736

test_data/api_request_handler/Bava_Kamma.55a.expected-output.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1243,7 +1243,7 @@
12431243
},
12441244
"en": "",
12451245
"hadran": true,
1246-
"he": "<big><strong>הֲדַרַן עֲלָךְ שׁוֹר שֶׁנָּגַח אֶת הַפָּרָה</big></strong>",
1246+
"he": "<big><strong>הֲדַרַן עֲלָךְ שׁוֹר שֶׁנָּגַח אֶת הַפָּרָה</strong></big>",
12471247
"ref": "Bava Kamma 55a:16"
12481248
}
12491249
],

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,7 @@
489489
}
490490
},
491491
"en": "The beginning of tractate <i>Berakhot</i>, the first tractate in the first of the six orders of Mishna, opens with a discussion of the recitation of <i>Shema</i>, as the recitation of <i>Shema</i> encompasses an acceptance of the yoke of Heaven and of the mitzvot, and as such, forms the basis for all subsequent teachings. The Mishna opens with the laws regarding the appropriate time to recite <i>Shema</i>: <br><br><strong>MISHNA:</strong> <b>From when,</b> that is, from what time, does <b>one recite <i>Shema</i> in the evening? From the time when the priests enter to partake of their <i>teruma.</i></b> Until when does the time for the recitation of the evening <i>Shema</i> extend? <b>Until the end of the first watch.</b> The term used in the Torah (Deuteronomy 6:7) to indicate the time for the recitation of the evening <i>Shema</i> is <i>beshokhbekha</i>, when you lie down, which refers to the time in which individuals go to sleep. Therefore, the time for the recitation of <i>Shema</i> is the first portion of the night, when individuals typically prepare for sleep. <b>That is the statement of <span href=\"/topics/rabbi-eliezer-b-hyrcanus\" class=\"namedEntityLink\" data-slug=\"rabbi-eliezer-b-hyrcanus\">Rabbi Eliezer</span>.</b>",
492-
"he": "<big><strong>מֵאֵימָתַי</strong></big> קוֹרִין אֶת שְׁמַע בָּעֲרָבִין? מִשָּׁעָה שֶׁהַכֹּהֲנִים נִכְנָסִים לֶאֱכוֹל בִּתְרוּמָתָן. עַד סוֹף הָאַשְׁמוּרָה הָרִאשׁוֹנָה. דִּבְרֵי <a href=\"/topics/rabbi-eliezer-b-hyrcanus\" class=\"namedEntityLink\" data-slug=\"rabbi-eliezer-b-hyrcanus\">רַבִּי אֱלִיעֶזֶר</a>.",
492+
"he": "<big><strong>מֵאֵימָתַי</strong></big> קוֹרִין אֶת שְׁמַע בָּעֲרָבִין? מִשָּׁעָה שֶׁהַכֹּהֲנִים נִכְנָסִים לֶאֱכוֹל בִּתְרוּמָתָן. עַד סוֹף הָאַשְׁמוּרָה הָרִאשׁוֹנָה. דִּבְרֵי <span href=\"/topics/rabbi-eliezer-b-hyrcanus\" class=\"namedEntityLink\" data-slug=\"rabbi-eliezer-b-hyrcanus\">רַבִּי אֱלִיעֶזֶר</span>.",
493493
"ref": "Berakhot 2a:1",
494494
"steinsaltz_start_of_sugya": true
495495
},
@@ -691,7 +691,7 @@
691691
}
692692
},
693693
"en": "<b><span href=\"/topics/rabban-gamliel\" class=\"namedEntityLink\" data-slug=\"רג-(ambiguous)\">Rabban Gamliel</span> says:</b> One may recite <i>Shema</i> <b>until dawn,</b> indicating that <i>beshokhbekha</i> is to be understood as a reference to the entire time people sleep in their beds, the whole night.",
694-
"he": "<a href=\"/topics/rabban-gamliel\" class=\"namedEntityLink\" data-slug=\"רג-(ambiguous)\">רַבָּן גַּמְלִיאֵל</a> אוֹמֵר עַד שֶׁיַּעֲלֶה עַמּוּד הַשַּׁחַר.",
694+
"he": "<span href=\"/topics/rabban-gamliel\" class=\"namedEntityLink\" data-slug=\"רג-(ambiguous)\">רַבָּן גַּמְלִיאֵל</span> אוֹמֵר עַד שֶׁיַּעֲלֶה עַמּוּד הַשַּׁחַר.",
695695
"ref": "Berakhot 2a:3"
696696
},
697697
{

0 commit comments

Comments
 (0)