Skip to content

Commit

Permalink
Run Sefaria link sanitization on Hebrew also
Browse files Browse the repository at this point in the history
  • Loading branch information
ronshapiro committed Oct 8, 2024
1 parent 938e7a8 commit e906c8d
Show file tree
Hide file tree
Showing 16 changed files with 108 additions and 102 deletions.
11 changes: 9 additions & 2 deletions api_request_handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ import {checkNotUndefined} from "./js/undefined";
import {getWeekdayReading} from "./weekday_parshiot";
import {ASERET_YIMEI_TESHUVA_REFS} from "./js/aseret_yimei_teshuva";

const standardHebrewTransformations = sefariaTextTypeTransformation(
hebrew => (
HtmlNormalizer.process(SefariaLinkSanitizer.process(hebrew))
));

const standardEnglishTransformations = sefariaTextTypeTransformation(
english => (
HtmlNormalizer.process(
Expand Down Expand Up @@ -131,6 +136,7 @@ class Comment {
[hebrew, english] = parseOtzarLaazeiRashi(hebrew as string);
}

hebrew = standardHebrewTransformations(hebrew);
hebrew = boldDibureiHamatchil(hebrew, englishName);
hebrew = highlightRashiQuotations(hebrew);
for (const processor of (
Expand All @@ -139,7 +145,7 @@ class Comment {
CommentaryPrefixStripper,
CommentaryParenthesesTransformer,
ImageNumberingFormatter,
HtmlNormalizer])) {
])) {
hebrew = processor.process(hebrew, englishName);
}

Expand Down Expand Up @@ -499,7 +505,8 @@ export abstract class AbstractApiRequestHandler {

// eslint-disable-next-line @typescript-eslint/no-unused-vars
protected translateHebrewText(text: sefaria.TextType, ref: string): sefaria.TextType {
return sefariaTextTypeTransformation(this.replaceLotsOfNonBreakingSpacesWithNewlines)(text);
return standardHebrewTransformations(
sefariaTextTypeTransformation(this.replaceLotsOfNonBreakingSpacesWithNewlines)(text));
}

// eslint-disable-next-line @typescript-eslint/no-unused-vars
Expand Down
1 change: 0 additions & 1 deletion source_formatting/sefaria_link_sanitizer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ export class SefariaLinkSanitizer extends HtmlVisitor {
this.anchorStack.push("span");
} else {
this.anchorStack.push(false);
console.error("!!!!!!!!!!!!!!!!!!!!!!", attributes);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1243,7 +1243,7 @@
},
"en": "",
"hadran": true,
"he": "<big><strong>הֲדַרַן עֲלָךְ שׁוֹר שֶׁנָּגַח אֶת הַפָּרָה</big></strong>",
"he": "<big><strong>הֲדַרַן עֲלָךְ שׁוֹר שֶׁנָּגַח אֶת הַפָּרָה</strong></big>",
"ref": "Bava Kamma 55a:16"
}
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@
}
},
"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>",
"he": "<big><strong>מֵאֵימָתַי</strong></big> קוֹרִין אֶת שְׁמַע בָּעֲרָבִין? מִשָּׁעָה שֶׁהַכֹּהֲנִים נִכְנָסִים לֶאֱכוֹל בִּתְרוּמָתָן. עַד סוֹף הָאַשְׁמוּרָה הָרִאשׁוֹנָה. דִּבְרֵי <a href=\"/topics/rabbi-eliezer-b-hyrcanus\" class=\"namedEntityLink\" data-slug=\"rabbi-eliezer-b-hyrcanus\">רַבִּי אֱלִיעֶזֶר</a>.",
"he": "<big><strong>מֵאֵימָתַי</strong></big> קוֹרִין אֶת שְׁמַע בָּעֲרָבִין? מִשָּׁעָה שֶׁהַכֹּהֲנִים נִכְנָסִים לֶאֱכוֹל בִּתְרוּמָתָן. עַד סוֹף הָאַשְׁמוּרָה הָרִאשׁוֹנָה. דִּבְרֵי <span href=\"/topics/rabbi-eliezer-b-hyrcanus\" class=\"namedEntityLink\" data-slug=\"rabbi-eliezer-b-hyrcanus\">רַבִּי אֱלִיעֶזֶר</span>.",
"ref": "Berakhot 2a:1",
"steinsaltz_start_of_sugya": true
},
Expand Down Expand Up @@ -691,7 +691,7 @@
}
},
"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.",
"he": "<a href=\"/topics/rabban-gamliel\" class=\"namedEntityLink\" data-slug=\"רג-(ambiguous)\">רַבָּן גַּמְלִיאֵל</a> אוֹמֵר עַד שֶׁיַּעֲלֶה עַמּוּד הַשַּׁחַר.",
"he": "<span href=\"/topics/rabban-gamliel\" class=\"namedEntityLink\" data-slug=\"רג-(ambiguous)\">רַבָּן גַּמְלִיאֵל</span> אוֹמֵר עַד שֶׁיַּעֲלֶה עַמּוּד הַשַּׁחַר.",
"ref": "Berakhot 2a:3"
},
{
Expand Down
Loading

0 comments on commit e906c8d

Please sign in to comment.