├── output
└── .gitignore
├── intermediate
└── .gitignore
├── fonts
├── SBL_Hbrw.ttf
└── SBL_Font_End_User_License_Agreement.pdf
├── .gitmodules
├── scripts
├── Shulchan_Aruch_Harav
│ ├── Shulchan_Aruch_Harav.css
│ ├── name_Shulchan_Aruch_Harav.awk
│ ├── Shulchan_Aruch_Harav.awk
│ └── Shulchan_Aruch_Harav.bash
├── Kuzari
│ ├── Kuzari.css
│ ├── Kuzari.js
│ └── Kuzari.bash
├── nach
│ ├── nach.css
│ ├── nach.awk
│ └── nach.bash
├── chumash_rashi
│ ├── chumash_rashi.css
│ ├── chumash_rashi_parsha.awk
│ ├── chumash_rashi.awk
│ └── chumash_rashi.bash
├── talmud
│ ├── talmud.css
│ ├── talmud_name.awk
│ ├── talmud.awk
│ └── talmud.bash
├── releases.bash
├── rambam
│ ├── rambam.css
│ ├── rambam_one_perek.awk
│ ├── rambam_sefer.awk
│ ├── rambam_three_perek.awk
│ ├── rambam.awk
│ └── rambam.bash
├── Mishnah
│ ├── Mishnah.css
│ ├── index.js
│ ├── Mishnah.js
│ └── Mishnah.bash
├── Shulchan_Arukh
│ ├── Shulchan_Arukh.css
│ ├── Shulchan_Arukh.js
│ └── Shulchan_Arukh.bash
├── Chumash_Rashi_English
│ ├── chumash.js
│ ├── rashi.js
│ ├── Chumash_Rashi_English.css
│ ├── Chumash_Rashi_English.js
│ └── Chumash_Rashi_English.bash
├── Kitzur_Shulchan_Aruch
│ ├── Kitzur_Shulchan_Aruch.css
│ ├── Kitzur_Shulchan_Aruch.js
│ └── Kitzur_Shulchan_Aruch.bash
├── gmara_nocha
│ ├── gmara_nocha.css
│ ├── gmara_nocha_name.awk
│ ├── gmara_nocha.awk
│ └── gmara_nocha.bash
├── Arukh_HaShulchan
│ ├── Arukh_HaShulchan.css
│ ├── Arukh_HaShulchan.js
│ └── Arukh_HaShulchan.bash
├── Steinsaltz_talmud_Hebrew
│ ├── Steinsaltz_talmud_Hebrew.css
│ ├── talmud.js
│ ├── biur.js
│ ├── Steinsaltz_talmud_Hebrew.js
│ └── Steinsaltz_talmud_Hebrew.bash
├── Steinsaltz_talmud_H_E
│ ├── index.js
│ ├── Steinsaltz_talmud_H_E.css
│ ├── Steinsaltz_talmud_H_E.js
│ └── Steinsaltz_talmud_H_E.bash
├── shnaim_mikra
│ ├── shnaim_mikra_parsha.awk
│ ├── shnaim_mikra.css
│ ├── shnaim_mikra.awk
│ └── shnaim_mikra.bash
├── Mishnah_Berurah
│ ├── Mishnah_Berurah.css
│ ├── Mishnah_Berurah.js
│ └── Mishnah_Berurah.bash
├── apnx.py
├── Jastrow
│ ├── Jastrow.bash
│ └── Jastrow.js
└── sort_files.sh
├── makefile
├── Readme.md
├── sefaria
└── gematriya.js
└── license
/output/.gitignore:
--------------------------------------------------------------------------------
1 | !.gitignore
2 | *
3 |
--------------------------------------------------------------------------------
/intermediate/.gitignore:
--------------------------------------------------------------------------------
1 | *
2 | !.gitignore
3 |
--------------------------------------------------------------------------------
/fonts/SBL_Hbrw.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yparitcher/kindle-seforim/HEAD/fonts/SBL_Hbrw.ttf
--------------------------------------------------------------------------------
/.gitmodules:
--------------------------------------------------------------------------------
1 | [submodule "Orayta-Books"]
2 | path = Orayta-Books
3 | url = git@github.com:yparitcher/Orayta-Books.git
4 |
--------------------------------------------------------------------------------
/scripts/Shulchan_Aruch_Harav/Shulchan_Aruch_Harav.css:
--------------------------------------------------------------------------------
1 | body {
2 | direction: rtl;
3 | text-align: right;
4 | }
5 |
6 |
--------------------------------------------------------------------------------
/fonts/SBL_Font_End_User_License_Agreement.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/yparitcher/kindle-seforim/HEAD/fonts/SBL_Font_End_User_License_Agreement.pdf
--------------------------------------------------------------------------------
/scripts/Kuzari/Kuzari.css:
--------------------------------------------------------------------------------
1 | body {
2 | direction: rtl;
3 | text-align: right;
4 | }
5 | h2 {
6 | text-align: right;
7 | direction: rtl;
8 | }
9 |
10 |
--------------------------------------------------------------------------------
/scripts/nach/nach.css:
--------------------------------------------------------------------------------
1 | body {
2 | direction: rtl;
3 | text-align: right;
4 | }
5 | .posuk {
6 | font-size: large;
7 | }
8 | .posukh {
9 | font-size: medium;
10 | }
11 |
--------------------------------------------------------------------------------
/scripts/chumash_rashi/chumash_rashi.css:
--------------------------------------------------------------------------------
1 | body {
2 | direction: rtl;
3 | text-align: right;
4 | }
5 | .posuk, .rashih {
6 | font-size: large;
7 | }
8 | .posukh {
9 | font-size: medium;
10 | }
11 |
--------------------------------------------------------------------------------
/scripts/talmud/talmud.css:
--------------------------------------------------------------------------------
1 | body {
2 | direction: rtl;
3 | text-align: right;
4 | }
5 | .rashih {
6 | font-size: large;
7 | font-weight: bold;
8 | }
9 | .rashi {
10 | font-size: 0.8em;
11 | }
12 |
--------------------------------------------------------------------------------
/scripts/releases.bash:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | rm -r ./releases/*
4 | cp -ar ./output/* ./releases/
5 |
6 | cd ./releases
7 | for d in */*/; do
8 | cd $d
9 | zip -jmT "$(dirname $d)" * &
10 | cd -
11 | done
12 | wait
13 |
--------------------------------------------------------------------------------
/scripts/rambam/rambam.css:
--------------------------------------------------------------------------------
1 | body {
2 | font-size: 1.25em;
3 | direction: rtl;
4 | text-align: justify;
5 | text-align-last: right;
6 | }
7 | h4 {
8 | text-align: center;
9 | }
10 | .lawt {
11 | font-size: large;
12 | }
13 |
14 |
--------------------------------------------------------------------------------
/scripts/Mishnah/Mishnah.css:
--------------------------------------------------------------------------------
1 | body {
2 | direction: rtl;
3 | text-align: right;
4 | }
5 | h2, h3 {
6 | text-align: right;
7 | direction: rtl;
8 | }
9 | .mishnah {
10 | font-size: large;
11 | }
12 | .mishnahh {
13 | font-size: medium;
14 | }
15 |
--------------------------------------------------------------------------------
/scripts/Shulchan_Arukh/Shulchan_Arukh.css:
--------------------------------------------------------------------------------
1 | body {
2 | direction: rtl;
3 | text-align: right;
4 | }
5 | h2, h3 {
6 | text-align: right;
7 | direction: rtl;
8 | }
9 | .seif {
10 | font-size: large;
11 | }
12 | .seifh {
13 | font-size: medium;
14 | }
15 |
--------------------------------------------------------------------------------
/scripts/Chumash_Rashi_English/chumash.js:
--------------------------------------------------------------------------------
1 | var fs = require('fs');
2 |
3 | let jsonData = JSON.parse(fs.readFileSync(process.argv[2]));
4 |
5 | for (let x=0; x out;
12 | if (RT == "") { print RS > out; }
13 | if ((RT == "") && (number < 1017)) { number++; }
14 | }
15 |
--------------------------------------------------------------------------------
/scripts/Chumash_Rashi_English/Chumash_Rashi_English.css:
--------------------------------------------------------------------------------
1 | body {
2 | direction: rtl;
3 | }
4 | h2 {
5 | text-align: center;
6 | direction: rtl;
7 | }
8 | h3 {
9 | text-align: right;
10 | direction: rtl;
11 | }
12 | .right {
13 | direction: rtl;
14 | text-align: justify;
15 | text-align-last: right;
16 | }
17 | .left {
18 | direction: ltr;
19 | text-align: justify;
20 | text-align-last: left;
21 | }
22 |
23 |
--------------------------------------------------------------------------------
/scripts/rambam/rambam_sefer.awk:
--------------------------------------------------------------------------------
1 | #!/usr/bin/awk -f
2 |
3 | BEGIN {
4 | RS = "";
5 | number=1
6 | }
7 |
8 | BEGINFILE {
9 | out = FILENAME ".html"
10 | }
11 |
12 | {
13 | print > out;
14 | if ((number % 3) == 0 && RT == "") { print "***
" > out; }
15 | if (RT == "") { print RS > out; }
16 | if (RT == "") {number ++}
17 | }
18 |
--------------------------------------------------------------------------------
/scripts/talmud/talmud_name.awk:
--------------------------------------------------------------------------------
1 | #!/usr/bin/awk -f
2 |
3 | BEGIN {
4 | RS = "";
5 | FS = "\n";
6 | type = "0";
7 | out = ""
8 | OFS=""
9 | }
10 |
11 | {
12 | if (type == "") {
13 | sefer = gensub(/ *([^ <][^<]*[^ <]) *<\/h1>/, "\\1", 1, $1);
14 | gsub(/ /, "_", sefer)
15 | out = basefolder "/" sefer ".html"
16 | print type$0 > out;
17 |
18 | }
19 | type = RT;
20 | }
21 |
--------------------------------------------------------------------------------
/scripts/Steinsaltz_talmud_Hebrew/biur.js:
--------------------------------------------------------------------------------
1 | var fs = require('fs');
2 |
3 | let jsonData = JSON.parse(fs.readFileSync(process.argv[2]));
4 |
5 | for (let x=0; x out;
13 | if (RT == "") { print RS > out; }
14 | if (RT == "") {
15 | counter++;
16 | if (!(counter % 3) && (number < 339)) { number++; }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/scripts/shnaim_mikra/shnaim_mikra_parsha.awk:
--------------------------------------------------------------------------------
1 | #!/usr/bin/awk -f
2 |
3 | BEGIN {
4 | RS = "";
5 | FS = "\n";
6 | type = "0";
7 | out = ""
8 | OFS=""
9 | }
10 |
11 | {
12 | if (type == "") {
13 | parsha = gensub(/ *([^ <][^<]*[^ <]) *<\/h2>/, "\\1", 1, $1);
14 | gsub(/ /, "_", parsha)
15 | out = basefolder "/" parsha ".html"
16 | print type $0 > out;
17 |
18 | }
19 | type = RT;
20 | }
21 |
--------------------------------------------------------------------------------
/scripts/chumash_rashi/chumash_rashi_parsha.awk:
--------------------------------------------------------------------------------
1 | #!/usr/bin/awk -f
2 |
3 | BEGIN {
4 | RS = "";
5 | FS = "\n";
6 | type = "0";
7 | out = ""
8 | OFS=""
9 | }
10 |
11 | {
12 | if (type == "") {
13 | parsha = gensub(/ *([^ <][^<]*[^ <]) *<\/h2>/, "\\1", 1, $1);
14 | gsub(/ /, "_", parsha)
15 | out = basefolder "/" parsha ".html"
16 | print type $0 > out;
17 |
18 | }
19 | type = RT;
20 | }
21 |
--------------------------------------------------------------------------------
/scripts/Shulchan_Aruch_Harav/name_Shulchan_Aruch_Harav.awk:
--------------------------------------------------------------------------------
1 | #!/usr/bin/awk -f
2 |
3 | BEGIN {
4 | RS = "";
5 | FS = "\n";
6 | type = "0";
7 | out = ""
8 | OFS=""
9 | }
10 |
11 | {
12 | if (type == "") {
13 | sefer = gensub(/ *([^ <][^<]*[^ <]) *<\/h1>/, "\\1", 1, $1);
14 | gsub(/ /, "_", sefer)
15 | out = basefolder "/" sefer ".html"
16 | print type$0 > out;
17 |
18 | }
19 | type = RT;
20 | }
21 |
--------------------------------------------------------------------------------
/scripts/Mishnah_Berurah/Mishnah_Berurah.css:
--------------------------------------------------------------------------------
1 | body {
2 | direction: rtl;
3 | text-align: justify;
4 | text-align-last: auto;
5 | }
6 | h2 {
7 | direction: rtl;
8 | }
9 | h3 {
10 | text-align: right;
11 | direction: rtl;
12 | }
13 | .seif {
14 | font-weight: bold;
15 | margin-top: .35em;
16 | }
17 | .seifh, .pirushh {
18 | font-size: .5em;
19 | vertical-align: 30%;
20 | }
21 | .hagah {
22 | font-weight: normal;
23 | }
24 | .ph {
25 | font-weight: bold;
26 | }
27 |
28 |
--------------------------------------------------------------------------------
/scripts/gmara_nocha/gmara_nocha_name.awk:
--------------------------------------------------------------------------------
1 | #!/usr/bin/awk -f
2 |
3 | BEGIN {
4 | RS = "";
5 | FS = "\n";
6 | type = "0";
7 | out = ""
8 | OFS=""
9 | }
10 |
11 | {
12 | if (type == "") {
13 | sefer = gensub(/ ? ?()?([^ <][^<]*[^ <]) ?(<\/span>)?<\/h1>/, "\\2", 1, $1);
14 | gsub(/ /, "_", sefer)
15 | out = basefolder "/" sefer ".html"
16 | print type$0 > out;
17 |
18 | }
19 | type = RT;
20 | }
21 |
--------------------------------------------------------------------------------
/scripts/apnx.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 |
3 | import sys
4 | from calibre.devices.kindle.apnx import APNXBuilder
5 | apnx_builder = APNXBuilder()
6 |
7 | docs="./output"
8 | method = "accurate"
9 |
10 |
11 | for root, dirs, files in os.walk(docs):
12 | for name in files:
13 | mobi_path = os.path.join(root, name)
14 | if name.lower().endswith('.azw3'):
15 | apnx_path = os.path.join(root, os.path.splitext(name)[0] + '.apnx')
16 | apnx_builder.write_apnx(mobi_path, apnx_path, method)
17 |
--------------------------------------------------------------------------------
/scripts/Kuzari/Kuzari.js:
--------------------------------------------------------------------------------
1 | var fs = require('fs');
2 | let gematria = require(process.argv[3]);
3 | let jsonData = JSON.parse(fs.readFileSync(process.argv[2]));
4 |
5 | console.log("" + jsonData.heSectionRef + "");
6 | for (let x=0; x" + "מאמר " + mamar + "
");
10 | }
11 | for (let i=0; i' + jsonData.he[x][i] + "");
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/scripts/shnaim_mikra/shnaim_mikra.css:
--------------------------------------------------------------------------------
1 | body {
2 | direction: rtl;
3 | text-align: right;
4 | }
5 | .mikra {
6 | font-size: 1em;
7 | }
8 | .mikra2 {
9 | font-size: 0.9em;
10 | }
11 | .targum {
12 | font-size: 0.75em;
13 | }
14 | /*
15 | .aliya {
16 | font-size: 2em;
17 | margin-top: 0.67em;
18 | margin-bottom: 0.67em;
19 | margin-left: 0;
20 | margin-right: 0;
21 | font-weight: bold;
22 | }
23 | .num {
24 | font-weight: bold;
25 | }
26 | .parsha {
27 | font-weight: bold;
28 | }
29 | .copyright {
30 | direction: rtl;
31 | text-align: right;
32 | font-size: 0.5em;
33 | }
34 | */
35 |
--------------------------------------------------------------------------------
/makefile:
--------------------------------------------------------------------------------
1 |
2 | SHELL=/bin/bash
3 | SCRIPTS=./scripts/
4 |
5 | SEFORIM=shnaim_mikra rambam chumash_rashi nach talmud Steinsaltz_talmud_H_E Kitzur_Shulchan_Aruch Arukh_HaShulchan Shulchan_Arukh Mishnah gmara_nocha Steinsaltz_talmud_Hebrew Chumash_Rashi_English Shulchan_Aruch_Harav Mishnah_Berurah Jastrow Kuzari
6 |
7 | .PHONY: default all sort release apnx $(SEFORIM)
8 |
9 | default: all
10 |
11 | all:
12 | $(MAKE) $(SEFORIM)
13 | $(MAKE) apnx
14 | $(MAKE) release
15 |
16 | release:
17 | $(SCRIPTS)releases.bash
18 |
19 | apnx:
20 | calibre-debug $(SCRIPTS)apnx.py
21 |
22 | $(SEFORIM):
23 | $(SCRIPTS)$@/$@.bash
24 |
--------------------------------------------------------------------------------
/scripts/Mishnah/Mishnah.js:
--------------------------------------------------------------------------------
1 | var fs = require('fs');
2 | let gematria = require(process.argv[3]);
3 | let jsonData = JSON.parse(fs.readFileSync(process.argv[2]));
4 |
5 | console.log("" + jsonData.heSectionRef + "");
6 | for (let x=0; xפרק " + gematria(x+1) + "
");
9 | }
10 | for (let i=0; i{' + perek + '} ' + content + "");
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/scripts/gmara_nocha/gmara_nocha.awk:
--------------------------------------------------------------------------------
1 | #!/usr/bin/awk -f
2 |
3 | BEGIN {
4 | type = "0";
5 | perek = "0";
6 | RS = "[$^~]";
7 | FS = "\n";
8 | }
9 |
10 | {
11 | switch (type){
12 | case "$":
13 | printf "" $1 "
\n";
14 | break;
15 | case "^":
16 | printf "" $1 "
\n";
17 | perek = $1;
18 | break;
19 | case "~":
20 | {
21 | printf "" $1 "
";
22 | $1="";
23 | printf "%s", $0;
24 | printf "
\n";
25 | break;
26 | }
27 | default :
28 | break;
29 | }
30 | type = RT;
31 | }
32 |
--------------------------------------------------------------------------------
/scripts/nach/nach.awk:
--------------------------------------------------------------------------------
1 | #!/usr/bin/awk -f
2 |
3 | BEGIN {
4 | type = "0";
5 | RS = "[$~!]";
6 | FS = "\n";
7 | out = ""
8 | }
9 |
10 | {
11 | switch (type){
12 | case "$":
13 | sefer = gensub(/ *([^ ].*[^ ]) */, "\\1", 1, $1);
14 | gsub(/ /, "_", sefer)
15 | out = basefolder "/" sefer ".html"
16 | break;
17 | case "~":
18 | printf "" $1 "
\n" > out;
19 | break;
20 | case "!":
21 | {
22 | printf "" $1 "" > out;
23 | $1="";
24 | printf $0 > out;
25 | printf "
\n" > out;
26 | break;
27 | }
28 | default :
29 | break;
30 | }
31 | type = RT;
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/scripts/Kitzur_Shulchan_Aruch/Kitzur_Shulchan_Aruch.js:
--------------------------------------------------------------------------------
1 | var fs = require('fs');
2 | let gematria = require(process.argv[3]);
3 | let jsonData = JSON.parse(fs.readFileSync(process.argv[2]));
4 |
5 | console.log("" + jsonData.heSectionRef + "");
6 | for (let x=0; x" + jsonData.alts[x][0]["he"][0] + "");
10 | }
11 | }
12 | for (let i=0; i{' + seif + '} ' + jsonData.he[x][i] + "");
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/scripts/Shulchan_Aruch_Harav/Shulchan_Aruch_Harav.awk:
--------------------------------------------------------------------------------
1 | #!/usr/bin/awk -f
2 |
3 | BEGIN {
4 | type = "0";
5 | perek = "0";
6 | RS = "[$#~!]";
7 | FS = "\n";
8 | }
9 |
10 | {
11 | switch (type){
12 | case "$":
13 | printf "" $1 "\n";
14 | printf "" $1 "
\n";
15 | break;
16 | case "#":
17 | printf "" $1 "
\n";
18 | break;
19 | case "~":
20 | printf "" $1 "
\n";
21 | perek = $1;
22 | break;
23 | case "!":
24 | {
25 | printf ""$1 "";
26 | $1="";
27 | printf "%s", $0;
28 | printf "
\n";
29 | break;
30 | }
31 | default :
32 | break;
33 | }
34 | type = RT;
35 | }
36 |
--------------------------------------------------------------------------------
/scripts/Arukh_HaShulchan/Arukh_HaShulchan.js:
--------------------------------------------------------------------------------
1 | var fs = require('fs');
2 | let gematria = require(process.argv[3]);
3 | let jsonData = JSON.parse(fs.readFileSync(process.argv[2]));
4 |
5 | console.log("" + jsonData.heSectionRef + "");
6 | for (let x=0; x" + jsonData.alts[x][0]["he"][0] + "");
10 | }
11 | }
12 | for (let i=0; i');
17 | if (index==-1){index=0;}else{index+=4;}
18 | console.log( "" + gematria(x+1) + ") " + content.substring(0, index ) + "
");
19 | console.log('' + seif + ') ' + content.substring(index) + "
");
20 | } else {
21 | console.log('' + seif + ') ' + content + "
");
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/scripts/Shulchan_Arukh/Shulchan_Arukh.js:
--------------------------------------------------------------------------------
1 | var fs = require('fs');
2 | let gematria = require(process.argv[3]);
3 | let jsonData = JSON.parse(fs.readFileSync(process.argv[2]));
4 |
5 | console.log("" + jsonData.heSectionRef + "");
6 | for (let x=0; x" + jsonData.alts[x][0]["he"][0] + "");
10 | }
11 | }
12 | for (let i=0; i');
17 | if (index==-1){index=0;}else{index+=4;}
18 | console.log( "{" + gematria(x+1) + "} " + content.substring(0, index ) + "
");
19 | console.log('{' + seif + '} ' + content.substring(index) + "
");
20 | } else {
21 | console.log('{' + seif + '} ' + content + "
");
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/scripts/Steinsaltz_talmud_H_E/Steinsaltz_talmud_H_E.js:
--------------------------------------------------------------------------------
1 | var fs = require('fs');
2 | let gematria = require(process.argv[3]);
3 | let jsonData = JSON.parse(fs.readFileSync(process.argv[2]));
4 |
5 | console.log("" + jsonData.heSectionRef + "");
6 | for (let x=0; x" + jsonData.alts[x][0]["he"][0] + "");
10 | }
11 | var d = x+1;
12 | var daf;
13 | if (d%2 == 0) {
14 | daf = gematria(d/2) + ":"
15 | } else {
16 | daf = gematria((d+1)/2) + "."
17 | }
18 | console.log("" + daf + "
");
19 | }
20 | for (let i=0; i" + jsonData.alts[x][i]["he"][0] + "");
23 | }
24 | console.log('' + jsonData.he[x][i] + "
");
25 | if (jsonData.text[x]!= undefined && jsonData.text[x][i] != undefined ) {
26 | console.log('' + jsonData.text[x][i] + "
");
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/scripts/rambam/rambam.awk:
--------------------------------------------------------------------------------
1 | #!/usr/bin/awk -f
2 |
3 | BEGIN {
4 | type = "0";
5 | chap = "0";
6 | RS = "[$@~!]";
7 | FS = "\n"
8 | }
9 |
10 | {
11 | switch (type){
12 | case "$":
13 | printf "" $1 "
";
14 | $1="";
15 | $2="";
16 | printf $0
17 | printf "\n" ;
18 | break;
19 | case "@":
20 | printf "" $1 "
";
21 | $1="";
22 | printf $0
23 | printf "\n" ;
24 | break;
25 | case "~":
26 | printf "" $1 "
";
27 | if ((RT == "~" && $1 !~ /נוסח ברכות התפלה וסידורן/ && $1 !~/נוסח ברכת המזון/)||(RT == "")) chap = "1";
28 | $1="";
29 | printf $0;
30 | printf "\n" ;
31 | if (chap == "1")
32 | {
33 | printf "\n";
34 | chap = "0";
35 | }
36 | break;
37 | case "!":
38 | {
39 | printf "" $1 ")";
40 | $1="";
41 | printf $0
42 | printf "
\n" ;
43 | if (RT ~ /[$@~]/ || RT == "") printf "\n";
44 | break;
45 | }
46 | default :
47 | break;
48 | }
49 | type = RT;
50 |
51 | }
52 |
--------------------------------------------------------------------------------
/scripts/Steinsaltz_talmud_Hebrew/Steinsaltz_talmud_Hebrew.js:
--------------------------------------------------------------------------------
1 | var fs = require('fs');
2 | let gematria = require(process.argv[4]);
3 | let jsonData = JSON.parse(fs.readFileSync(process.argv[2]));
4 | let biurData = JSON.parse(fs.readFileSync(process.argv[3]));
5 |
6 | console.log("" + jsonData.heSectionRef + "");
7 | for (let x=0; x" + jsonData.alts[x][0]["he"][0] + "");
11 | }
12 | var d = x+1;
13 | var daf;
14 | if (d%2 == 0) {
15 | daf = gematria(d/2) + ":"
16 | } else {
17 | daf = gematria((d+1)/2) + "."
18 | }
19 | console.log("" + daf + "
");
20 | }
21 | for (let i=0; i" + jsonData.alts[x][i]["he"][0] + "");
24 | }
25 | console.log('' + jsonData.he[x][i] + "
");
26 | if (biurData.he[x]!= undefined && biurData.he[x][i] != undefined ) {
27 | console.log('' + biurData.he[x][i] + "
");
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/scripts/talmud/talmud.awk:
--------------------------------------------------------------------------------
1 | #!/usr/bin/awk -f
2 |
3 | BEGIN {
4 | type = "0";
5 | perek = "0";
6 | meforeshperek = "0";
7 | meforeshposuk = "0";
8 | RS = "[$^~]";
9 | FS = "\n";
10 | }
11 |
12 | FNR==NR{
13 | switch (type){
14 | case "^":
15 | meforeshperek = $1;
16 | break;
17 | case "~":
18 | {
19 | meforeshposuk = $1;
20 | $1 = "";
21 | meforesh[meforeshperek meforeshposuk]=$0;
22 | break;
23 | }
24 | default :
25 | break;
26 |
27 | }
28 | type = RT;
29 | next;
30 | }
31 |
32 | {
33 | switch (type){
34 | case "$":
35 | printf "" $1 "
\n";
36 | break;
37 | case "^":
38 | printf "" $1 "
\n";
39 | perek = $1;
40 | break;
41 | case "~":
42 | {
43 | count=perek $1;
44 | printf "" $1 "
";
45 | $1="";
46 | printf $0;
47 | printf "\n";
48 | if (meforesh[count] != ""){
49 | printf "רש״י
";
50 | printf meforesh[count];
51 | printf "\n" ;
52 | }
53 | break;
54 | }
55 | default :
56 | break;
57 | }
58 | type = RT;
59 |
60 | }
61 |
--------------------------------------------------------------------------------
/scripts/Jastrow/Jastrow.bash:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 |
4 | #####
5 | # directories
6 | #####
7 | startpoint="Jastrow"
8 | scripts="./scripts/$startpoint"
9 | intermediate="./intermediate/$startpoint"
10 | output="./output/$startpoint"
11 |
12 | if [[ ! -d "$intermediate" ]]; then mkdir -p "$intermediate"; fi;
13 |
14 | #counter=1
15 | #while read i; do
16 | # dest="$(printf '%02d' $counter)_$i"
17 | # dest="${dest// /_}"
18 | # if [[ ! -f "$intermediate/$dest.json" ]]; then
19 | # wget -O "$intermediate/$dest.json" "https://www.sefaria.org/api/texts/$i?pad=0";
20 | # fi;
21 | # counter=$(($counter+1));
22 | #done << EOF
23 | #EOF
24 |
25 | uri="Jastrow,_א"
26 |
27 | if [[ ! -f "$intermediate/$startpoint" ]]; then
28 | while [[ -n "$uri" ]]; do
29 | wget -qO "$intermediate/$startpoint.json" "https://www.sefaria.org/api/texts/$uri?multiple=1000";
30 | uri=$(node "$scripts/$startpoint.js" "$intermediate/$startpoint" "$intermediate/$startpoint.json")
31 | echo $uri
32 | if [[ -f "$intermediate/$startpoint.json" ]]; then
33 | rm "$intermediate/$startpoint.json";
34 | fi
35 | done
36 | fi
37 |
38 | if [[ ! -d "$output" ]]; then mkdir -p "$output"; fi;
39 |
40 | pyglossary "$intermediate/$startpoint" "$output/$startpoint.ifo" --write-options=sametypesequence=h --read-format=Tabfile
41 |
42 |
--------------------------------------------------------------------------------
/scripts/Mishnah_Berurah/Mishnah_Berurah.js:
--------------------------------------------------------------------------------
1 | var fs = require('fs');
2 | var path = require('path');
3 | let gematria = require(process.argv[3]);
4 | let jsonData = JSON.parse(fs.readFileSync(process.argv[2]));
5 | let x = parseInt(path.basename(process.argv[2], ".json"))
6 |
7 | if (jsonData.alts[0] != undefined){
8 | console.log("" + jsonData.alts[0]["he"][0] + "
");
9 | }
10 | for (let i=0; i');
16 | if (index==-1){index=0;}else{index+=4;}
17 | console.log( "" + gematria(x) + ") " + content.substring(0, index ) + "
");
18 | console.log('' + seif + ') ' + content.substring(index) + "
");
19 | } else {
20 | console.log('' + seif + ') ' + content + "
");
21 | }
22 | for (let y=0; y' + jsonData.commentary[y].he + "");
26 | }
27 | }
28 | }
29 |
30 |
--------------------------------------------------------------------------------
/scripts/chumash_rashi/chumash_rashi.awk:
--------------------------------------------------------------------------------
1 | #!/usr/bin/awk -f
2 |
3 | BEGIN {
4 | type = "0";
5 | perek = "0";
6 | meforeshperek = "0";
7 | meforeshposuk = "0";
8 | RS = "[$^@~!]";
9 | FS = "\n";
10 | }
11 |
12 | FNR==NR{
13 | switch (type){
14 | case "~":
15 | meforeshperek = $1;
16 | break;
17 | case "!":
18 | {
19 | meforeshposuk = $1;
20 | $1 = "";
21 | meforesh[meforeshperek meforeshposuk]=$0;
22 | break;
23 | }
24 | default :
25 | break;
26 |
27 | }
28 | type = RT;
29 | next;
30 | }
31 |
32 | {
33 | switch (type){
34 | case "$":
35 | printf "" $1 "
\n";
36 | break;
37 | case "^":
38 | printf "" $1 "
\n";
39 | break;
40 | case "@":
41 | printf "" $1 "
\n";
42 | break;
43 | case "~":
44 | printf "" $1 "
\n";
45 | perek = $1;
46 | break;
47 | case "!":
48 | {
49 | count=perek $1;
50 | printf "" $1 "";
51 | $1="";
52 | printf $0;
53 | printf "
\n";
54 | if (meforesh[count] != ""){
55 | printf "";
56 | printf meforesh[count];
57 | printf "\n" ;
58 | }
59 | break;
60 | }
61 | default :
62 | break;
63 | }
64 | type = RT;
65 |
66 | }
67 |
--------------------------------------------------------------------------------
/scripts/shnaim_mikra/shnaim_mikra.awk:
--------------------------------------------------------------------------------
1 | #!/usr/bin/awk -f
2 |
3 | BEGIN {
4 | type = "0";
5 | perek = "0";
6 | meforeshperek = "0";
7 | meforeshposuk = "0";
8 | RS = "[$^@~!]";
9 | FS = "\n";
10 | }
11 |
12 | FNR==NR{
13 | switch (type){
14 | case "~":
15 | meforeshperek = $1;
16 | break;
17 | case "!":
18 | {
19 | meforeshposuk = $1;
20 | $1 = "";
21 | meforesh[meforeshperek meforeshposuk]=$0;
22 | break;
23 | }
24 | default :
25 | break;
26 |
27 | }
28 | type = RT;
29 | next;
30 | }
31 |
32 | {
33 | switch (type){
34 | case "$":
35 | printf "" $1 "
\n";
36 | break;
37 | case "^":
38 | printf "" $1 "
\n";
39 | break;
40 | case "@":
41 | printf "" $1 "
\n";
42 | break;
43 | case "~":
44 | printf "" $1 "
\n";
45 | perek = $1;
46 | break;
47 | case "!":
48 | {
49 | count=perek $1;
50 | printf "" $1 "";
51 | $1="";
52 | printf $0;
53 | printf "";
54 | printf $0;
55 | printf "\n";
56 | if (meforesh[count] != ""){
57 | printf "";
58 | printf meforesh[count];
59 | printf "
\n" ;
60 | }
61 | break;
62 | }
63 | default :
64 | break;
65 | }
66 | type = RT;
67 |
68 | }
69 |
--------------------------------------------------------------------------------
/scripts/Jastrow/Jastrow.js:
--------------------------------------------------------------------------------
1 | const fs = require('fs');
2 | let fn = process.argv[2];
3 | let jsonData = JSON.parse(fs.readFileSync(process.argv[3]));
4 |
5 | let regexp = /(\u0590|\u0591|\u0592|\u0593|\u0594|\u0595|\u0596|\u0597|\u0598|\u0599|\u059A|\u059B|\u059C|\u059D|\u059E|\u059F|\u05A0|\u05A1|\u05A2|\u05A3|\u05A4|\u05A5|\u05A6|\u05A7|\u05A8|\u05A9|\u05AA|\u05AB|\u05AC|\u05AD|\u05AE|\u05AF|\u05B0|\u05B1|\u05B2|\u05B3|\u05B4|\u05B5|\u05B6|\u05B7|\u05B8|\u05B9|\u05BA|\u05BB|\u05BC|\u05BD|\u05BE|\u05BF|\u05C0|\u05C1|\u05C2|\u05C3|\u05C4|\u05C5|\u05C6|\u05C7|\u05C8|\u05C9|\u05CA|\u05CB|\u05CC|\u05CD|\u05CE|\u05CF)/g
6 | let superscript = / (\u00B9|\u00B2|\u00B3|\u2070|\u2071|\u2072|\u2073|\u2074|\u2075|\u2076|\u2077|\u2078|\u2079)/
7 | let roman = / (I+)/
8 |
9 | for (let x=0; x' --page-breaks-before '/')
22 | if [[ $ext == "epub" ]]; then args+=(--no-default-epub-cover); fi;
23 | if [[ $5 == "embed" ]]; then args+=(--embed-font-family "SBL Hebrew"); fi;
24 | ebook-convert "${args[@]}"
25 | }
26 |
27 |
28 | if [[ ! -d "$intermediate" ]]; then mkdir -p "$intermediate"; fi;
29 | if [[ ! -f "$intermediate/$startpoint.json" ]]; then
30 | wget -O "$intermediate/$startpoint.json" "https://www.sefaria.org/api/texts/$startpoint?pad=0&vhe=Sefer_haKuzari_-_Project_Ben-Yehuda";
31 | fi;
32 |
33 | for i in $intermediate/*.json; do
34 | dest="$(basename --suffix .json $i)"
35 | node "$scripts/$startpoint.js" "$i" "../../$source/gematriya.js" > "$intermediate/$dest.html"
36 | done
37 |
38 | if [[ ! -d "$output/kindle" ]]; then mkdir -p "$output/kindle"; fi;
39 | if [[ ! -d "$output/epub" ]]; then mkdir -p "$output/epub"; fi;
40 |
41 | for i in $intermediate/*.html; do
42 | name=$(basename --suffix=.html $i)
43 | convertsefer "$i" "$output/kindle/" "$name" "azw3" &
44 | convertsefer "$i" "$output/epub/" "$name" "epub" &
45 | wait
46 | done
47 |
--------------------------------------------------------------------------------
/scripts/Kitzur_Shulchan_Aruch/Kitzur_Shulchan_Aruch.bash:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 |
4 | #####
5 | # directories
6 | #####
7 | startpoint="Kitzur_Shulchan_Aruch"
8 | scripts="./scripts/$startpoint"
9 | css="$scripts/$startpoint.css"
10 | intermediate="./intermediate/$startpoint"
11 | source="./sefaria"
12 | output="./output/$startpoint"
13 | gematriya="$source/gematriya.js"
14 |
15 | convertsefer() {
16 |
17 | input=$1
18 | folderout=$2
19 | fileout=$3
20 | ext=$4
21 | args=("$input" "$folderout$fileout.$ext" --subset-embedded-fonts --extra-css "$css" --chapter '//*[name()="h2"]' --chapter-mark "none" --language "he" --base-font-size "16" --authors 'הרב שלמה גאנצפריד' --toc-title "תוכן ענינים" --comments 'The Kitzur Shulchan Aruch by Rabbi Shlomo Ganzfried, via sefaria & http://www.toratemetfreeware.com under the CC 2.5' --sr1-replace '
' --page-breaks-before '/')
22 | if [[ $ext == "epub" ]]; then args+=(--no-default-epub-cover); fi;
23 | if [[ $5 == "embed" ]]; then args+=(--embed-font-family "SBL Hebrew"); fi;
24 | ebook-convert "${args[@]}"
25 | }
26 |
27 |
28 | if [[ ! -d "$intermediate" ]]; then mkdir -p "$intermediate"; fi;
29 | if [[ ! -f "$intermediate/$startpoint.json" ]]; then
30 | wget -O "$intermediate/$startpoint.json" "https://www.sefaria.org/api/texts/$startpoint?pad=0";
31 | fi;
32 |
33 | for i in $intermediate/*.json; do
34 | dest="$(basename --suffix .json $i)"
35 | node "$scripts/$startpoint.js" "$i" "../../$source/gematriya.js" > "$intermediate/$dest.html"
36 | done
37 |
38 | if [[ ! -d "$output/kindle" ]]; then mkdir -p "$output/kindle"; fi;
39 | if [[ ! -d "$output/epub" ]]; then mkdir -p "$output/epub"; fi;
40 |
41 | for i in $intermediate/*.html; do
42 | name=$(basename --suffix=.html $i)
43 | convertsefer "$i" "$output/kindle/" "$name" "azw3" &
44 | convertsefer "$i" "$output/epub/" "$name" "epub" &
45 | wait
46 | done
47 |
--------------------------------------------------------------------------------
/scripts/nach/nach.bash:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 |
4 | #####
5 | # directories
6 | #####
7 | scripts="./scripts/nach"
8 | css="$scripts/nach.css"
9 | intermediate="./intermediate/nach"
10 | source="./Orayta-Books/BooksSrc"
11 | rashisource="/005_mprsi_mkra/03_rsi/1_torh"
12 | mikrasource="/001_mkra/01_torh"
13 | output="./output/nach"
14 |
15 |
16 | convertsefer() {
17 |
18 | input=$1
19 | folderout=$2
20 | fileout=$3
21 | title=$(echo $fileout | sed -e 's/_/ /g' )
22 | ext=$4
23 | args=("$input" "$folderout$fileout.$ext" --subset-embedded-fonts --extra-css "$css" --chapter '//*[@class="perekh"]' --chapter-mark "pagebreak" --start-reading-at '//*[@class="perekh"]' --language "he" --base-font-size "16" --title "$title" --authors 'נ"ך' --level1-toc '//*[@class="perekh"]' --toc-title "תוכן ענינים")
24 | if [[ $ext == "epub" ]]; then args+=(--no-default-epub-cover); fi;
25 | if [[ $5 == "embed" ]]; then args+=(--embed-font-family "SBL Hebrew"); fi;
26 | ebook-convert "${args[@]}"
27 | }
28 |
29 |
30 | if [[ ! -d "$intermediate" ]]; then mkdir -p "$intermediate"; fi;
31 |
32 | for i in $source/001_mkra/02_nbiaim/*.txt $source/001_mkra/03_ctobim/*.txt; do
33 | $scripts/nach.awk -v "basefolder=$intermediate" $i;
34 | done
35 |
36 |
37 | #if [[ ! -d "$output/kindle_font" ]]; then mkdir -p "$output/kindle_font"; fi;
38 | if [[ ! -d "$output/kindle" ]]; then mkdir -p "$output/kindle"; fi;
39 |
40 | if [[ ! -d "$output/epub" ]]; then mkdir -p "$output/epub"; fi;
41 | #if [[ ! -d "$output/epub_font" ]]; then mkdir -p "$output/epub_font"; fi;
42 |
43 | for i in $intermediate/*.html; do
44 | name=$(basename --suffix=.html $i)
45 | convertsefer "$i" "$output/kindle/" "$name" "azw3" &
46 | #convertsefer "$i" "$output/kindle_font/" "$name" "azw3" "embed" &
47 | convertsefer "$i" "$output/epub/" "$name" "epub" &
48 | #convertsefer "$i" "$output/epub_font/" "$name" "epub" "embed" &
49 | wait
50 | done
51 |
--------------------------------------------------------------------------------
/scripts/Mishnah/Mishnah.bash:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | set -e
4 |
5 | #####
6 | # directories
7 | #####
8 | startpoint="Mishnah"
9 | scripts="./scripts/$startpoint"
10 | css="$scripts/$startpoint.css"
11 | intermediate="./intermediate/$startpoint"
12 | source="./sefaria"
13 | output="./output/$startpoint"
14 | gematriya="$source/gematriya.js"
15 |
16 | convertsefer() {
17 |
18 | input=$1
19 | folderout=$2
20 | fileout=$3
21 | ext=$4
22 | args=("$input" "$folderout$fileout.$ext" --subset-embedded-fonts --extra-css "$css" --chapter '//*[name()="h2" or name()="h3"]' --chapter-mark "none" --language "he" --base-font-size "14" --authors 'משנה' --toc-title "תוכן ענינים" --comments 'The Mishnah, via sefaria under the CC-BY-SA' --sr1-replace '
' --page-breaks-before '/')
23 | if [[ $ext == "epub" ]]; then args+=(--no-default-epub-cover); fi;
24 | if [[ $5 == "embed" ]]; then args+=(--embed-font-family "SBL Hebrew"); fi;
25 | ebook-convert "${args[@]}"
26 | }
27 |
28 |
29 | if [[ ! -d "$intermediate" ]]; then mkdir -p "$intermediate"; fi;
30 |
31 | counter=1
32 | while read i; do
33 | dest="$(printf '%02d' $counter)_$i"
34 | dest="${dest// /_}"
35 | if [[ ! -f "$intermediate/$dest.json" ]]; then
36 | wget -O "$intermediate/$dest.json" "https://www.sefaria.org/api/texts/$i?pad=0";
37 | fi;
38 | counter=$(($counter+1));
39 | done << EOF
40 | $(node $scripts/index.js "$source/index.json")
41 | EOF
42 |
43 | for i in $intermediate/*.json; do
44 | dest="$(basename --suffix .json $i)"
45 | node "$scripts/$startpoint.js" "$i" "../../$source/gematriya.js" > "$intermediate/$dest.html"
46 | done
47 |
48 | if [[ ! -d "$output/kindle" ]]; then mkdir -p "$output/kindle"; fi;
49 | if [[ ! -d "$output/epub" ]]; then mkdir -p "$output/epub"; fi;
50 |
51 | for i in $intermediate/*.html; do
52 | name=$(basename --suffix=.html $i)
53 | convertsefer "$i" "$output/kindle/" "$name" "azw3" &
54 | convertsefer "$i" "$output/epub/" "$name" "epub" &
55 | wait
56 | done
57 |
--------------------------------------------------------------------------------
/scripts/Shulchan_Arukh/Shulchan_Arukh.bash:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | set -e
4 |
5 | #####
6 | # directories
7 | #####
8 | startpoint="Shulchan_Arukh"
9 | scripts="./scripts/$startpoint"
10 | css="$scripts/$startpoint.css"
11 | intermediate="./intermediate/$startpoint"
12 | source="./sefaria"
13 | output="./output/$startpoint"
14 | gematriya="$source/gematriya.js"
15 | chelek=("Orach_Chayim" "Yoreh_De'ah" "Even_HaEzer" "Choshen_Mishpat")
16 |
17 | convertsefer() {
18 |
19 | input=$1
20 | folderout=$2
21 | fileout=$3
22 | ext=$4
23 | args=("$input" "$folderout$fileout.$ext" --subset-embedded-fonts --extra-css "$css" --chapter '//*[name()="h2" or name()="h3"]' --chapter-mark "none" --language "he" --base-font-size "16" --authors 'יוסף קארו' --toc-title "תוכן ענינים" --comments 'The Shulchan Aruch, via sefaria under the CC-BY-SA' --page-breaks-before '/')
24 | if [[ $ext == "epub" ]]; then args+=(--no-default-epub-cover); fi;
25 | if [[ $5 == "embed" ]]; then args+=(--embed-font-family "SBL Hebrew"); fi;
26 | ebook-convert "${args[@]}"
27 | }
28 |
29 |
30 | if [[ ! -d "$intermediate" ]]; then mkdir -p "$intermediate"; fi;
31 | for i in ${chelek[@]}; do
32 | apiname="$startpoint,_$i"
33 | if [[ ! -f "$intermediate/$apiname.json" ]]; then
34 | wget -O "$intermediate/$apiname.json" "https://www.sefaria.org/api/texts/$apiname?pad=0";
35 | fi;
36 | done
37 |
38 | for i in $intermediate/*.json; do
39 | dest="$(basename --suffix .json $i)"
40 | node "$scripts/$startpoint.js" "$i" "../../$source/gematriya.js" > "$intermediate/$dest.html"
41 | sed -i -e 's#]*>##g' -e 's#
##g' "$intermediate/$dest.html"
42 | done
43 |
44 | if [[ ! -d "$output/kindle" ]]; then mkdir -p "$output/kindle"; fi;
45 | if [[ ! -d "$output/epub" ]]; then mkdir -p "$output/epub"; fi;
46 |
47 | for i in $intermediate/*.html; do
48 | name=$(basename --suffix=.html $i)
49 | convertsefer "$i" "$output/kindle/" "$name" "azw3" &
50 | convertsefer "$i" "$output/epub/" "$name" "epub" &
51 | wait
52 | done
53 |
--------------------------------------------------------------------------------
/scripts/Arukh_HaShulchan/Arukh_HaShulchan.bash:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | set -e
4 |
5 | #####
6 | # directories
7 | #####
8 | startpoint="Arukh_HaShulchan"
9 | scripts="./scripts/$startpoint"
10 | css="$scripts/$startpoint.css"
11 | intermediate="./intermediate/$startpoint"
12 | source="./sefaria"
13 | output="./output/$startpoint"
14 | gematriya="$source/gematriya.js"
15 | chelek=("Orach_Chaim" "Yoreh_De'ah" "Even_HaEzer" "Choshen_Mishpat")
16 |
17 | convertsefer() {
18 |
19 | input=$1
20 | folderout=$2
21 | fileout=$3
22 | ext=$4
23 | args=("$input" "$folderout$fileout.$ext" --subset-embedded-fonts --extra-css "$css" --chapter '//*[name()="h2" or name()="h3"]' --chapter-mark "none" --language "he" --base-font-size "16" --authors 'יחיאל מיכל הלוי אפשטיין' --toc-title "תוכן ענינים" --level1-toc '//*[name()="h2"]' --level2-toc '//*[name()="h3"]' --comments 'The Arukh HaShulchan, via sefaria under the CC-BY-SA' --page-breaks-before '/')
24 | if [[ $ext == "epub" ]]; then args+=(--no-default-epub-cover); fi;
25 | if [[ $5 == "embed" ]]; then args+=(--embed-font-family "SBL Hebrew"); fi;
26 | ebook-convert "${args[@]}"
27 | }
28 |
29 |
30 | if [[ ! -d "$intermediate" ]]; then mkdir -p "$intermediate"; fi;
31 | for i in ${chelek[@]}; do
32 | apiname="$startpoint,_$i"
33 | if [[ ! -f "$intermediate/$apiname.json" ]]; then
34 | wget -O "$intermediate/$apiname.json" "https://www.sefaria.org/api/texts/$apiname?pad=0";
35 | fi;
36 | done
37 |
38 | for i in $intermediate/*.json; do
39 | dest="$(basename --suffix .json $i)"
40 | node "$scripts/$startpoint.js" "$i" "../../$source/gematriya.js" > "$intermediate/$dest.html"
41 | sed -i -e 's#]*>##g' -e 's#
##g' "$intermediate/$dest.html"
42 | done
43 |
44 | if [[ ! -d "$output/kindle" ]]; then mkdir -p "$output/kindle"; fi;
45 | if [[ ! -d "$output/epub" ]]; then mkdir -p "$output/epub"; fi;
46 |
47 | for i in $intermediate/*.html; do
48 | name=$(basename --suffix=.html $i)
49 | convertsefer "$i" "$output/kindle/" "$name" "azw3" &
50 | convertsefer "$i" "$output/epub/" "$name" "epub" &
51 | wait
52 | done
53 |
--------------------------------------------------------------------------------
/scripts/Steinsaltz_talmud_H_E/Steinsaltz_talmud_H_E.bash:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 |
4 | #####
5 | # directories
6 | #####
7 | startpoint="Steinsaltz_talmud_H_E"
8 | scripts="./scripts/$startpoint"
9 | css="$scripts/$startpoint.css"
10 | intermediate="./intermediate/$startpoint"
11 | source="./sefaria"
12 | output="./output/$startpoint"
13 | gematriya="$source/gematriya.js"
14 |
15 | convertsefer() {
16 |
17 | input=$1
18 | folderout=$2
19 | fileout=$3
20 | ext=$4
21 | args=("$input" "$folderout$fileout.$ext" --subset-embedded-fonts --extra-css "$css" --chapter '//*[name()="h2" or name()="h3"]' --chapter-mark "none" --language "he" --base-font-size "14" --authors 'תלמוד' --toc-title "תוכן ענינים" --comments 'The William Davidson digital edition of the Koren Noé Talmud, with commentary by Rabbi Adin Steinsaltz Even-Israel via sefaria under the CC BY-NC 4.0' --sr1-replace '
' --page-breaks-before '/')
22 | if [[ $ext == "epub" ]]; then args+=(--no-default-epub-cover); fi;
23 | if [[ $5 == "embed" ]]; then args+=(--embed-font-family "SBL Hebrew"); fi;
24 | ebook-convert "${args[@]}"
25 | }
26 |
27 |
28 | if [[ ! -d "$intermediate" ]]; then mkdir -p "$intermediate"; fi;
29 |
30 | counter=1
31 | while read i; do
32 | dest="$(printf '%02d' $counter)_$i"
33 | dest="${dest// /_}"
34 | if [[ ! -f "$intermediate/$dest.json" ]]; then
35 | wget -O "$intermediate/$dest.json" "https://www.sefaria.org/api/texts/$i?pad=0";
36 | fi;
37 | counter=$(($counter+1));
38 | done << EOF
39 | $(node $scripts/index.js "$source/index.json")
40 | EOF
41 |
42 | for i in $intermediate/*.json; do
43 | dest="$(basename --suffix .json $i)"
44 | node "$scripts/$startpoint.js" "$i" "../../$source/gematriya.js" > "$intermediate/$dest.html"
45 | done
46 |
47 | if [[ ! -d "$output/kindle" ]]; then mkdir -p "$output/kindle"; fi;
48 | if [[ ! -d "$output/epub" ]]; then mkdir -p "$output/epub"; fi;
49 |
50 | for i in $intermediate/*.html; do
51 | name=$(basename --suffix=.html $i)
52 | convertsefer "$i" "$output/kindle/" "$name" "azw3" &
53 | convertsefer "$i" "$output/epub/" "$name" "epub" &
54 | wait
55 | done
56 |
--------------------------------------------------------------------------------
/Readme.md:
--------------------------------------------------------------------------------
1 | # kindle-seforim
2 | kindle-seforim is a collection of seforim in kindle ebook format, and in epub format, based on [Orayta-Books](https://github.com/MosheWagner/Orayta-Books) & [sefaria](https://www.sefaria.org).
3 |
4 | This is a work in progress so there will be updates and changes coming.
5 |
6 | Please file an issue if there are any mistakes or if you need a different format or sefer.
7 |
8 | ## Ebooks
9 | To download just the finished ebooks [kindleseforim.paritcher.com](https://kindleseforim.paritcher.com).
10 |
11 | ## Status
12 | - Shnaim Mikra
13 | - Rambam with marks for 3 chapter
14 | - Chumash with Rashi
15 | - Nach
16 | - Talmud with Rashi
17 | - Steinsaltz talmud hebrew/english
18 |
19 | ## TODO
20 | - add more seforim.
21 |
22 | ## Setup
23 | - clone the reository.
24 | - you may need to run `git submodules init` and `git submodules update` to get the submodule libraries.
25 |
26 | ##Usage
27 | - run the scripts using `make script_name` for example `make rambam` to parse the html and save to `intermediate` then convert the html to a kindle ebook (.azw3) in `output`
28 | - to zip up the completed files for release `make release`
29 |
30 | ## Acknowledgements
31 | kindle-seforim uses the following libraries:
32 |
33 | - [Orayta-Books](https://github.com/MosheWagner/Orayta-Books) source of the seforim.
34 | licensed under the CC and or GDPL licenses
35 | - [wikisource](https://he.wikisource.org) source of the seforim.
36 | licensed under the CC 3.0 license
37 | - [sefaria](https://www.sefaria.org) source of the seforim.
38 | licensed under the CC license
39 | - [calibre](https://calibre-ebook.com/) ebook conversion library.
40 | Copyright (c) Kovid Goyal
41 | licensed under the GNU GPL v3 license
42 |
43 | Thank you
44 |
45 | ## License
46 | kindle-seforim is Copyright (c) 2018 [Yparitcher](https://github.com/yparitcher)
47 |
48 | ebooks licensed under the authors license mostly [CC BY-NC-SA](https://creativecommons.org/licenses/by-nc-sa/2.5/legalcode)
49 |
50 | for font licenses look in the fonts folder
51 |
52 | scripts source code licensed under [The MIT License (MIT)](http://opensource.org/licenses/mit-license.php)
53 |
--------------------------------------------------------------------------------
/scripts/Mishnah_Berurah/Mishnah_Berurah.bash:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | set -e
4 |
5 | #####
6 | # directories
7 | #####
8 | startpoint="Mishnah_Berurah"
9 | scripts="./scripts/$startpoint"
10 | css="$scripts/$startpoint.css"
11 | intermediate="./intermediate/$startpoint"
12 | source="./sefaria"
13 | output="./output/$startpoint"
14 | gematriya="$source/gematriya.js"
15 | shulchanaruch="Shulchan_Arukh,_Orach_Chayim"
16 |
17 | convertsefer() {
18 |
19 | input=$1
20 | folderout=$2
21 | fileout=$3
22 | ext=$4
23 | args=("$input" "$folderout$fileout.$ext" --subset-embedded-fonts --extra-css "$css" --chapter '//*[name()="h2" or name()="h3"]' --chapter-mark "none" --language "he" --authors 'חפץ חיים' --toc-title "תוכן ענינים" --comments 'The Mishnah Berurah, via sefaria under the CC-BY-SA' --page-breaks-before '/')
24 | if [[ $ext == "epub" ]]; then args+=(--no-default-epub-cover); fi;
25 | if [[ $5 == "embed" ]]; then args+=(--embed-font-family "SBL Hebrew"); fi;
26 | ebook-convert "${args[@]}"
27 | }
28 |
29 |
30 | if [[ ! -d "$intermediate" ]]; then mkdir -p "$intermediate"; fi;
31 |
32 | for i in {1..697}; do
33 | if [[ ! -f "$intermediate/$i.json" ]]; then
34 | wget -O "$intermediate/$i.json" "https://www.sefaria.org/api/texts/$shulchanaruch.$i?commentary=1";
35 | fi;
36 | done
37 |
38 | echo "משנה ברורה" > "$intermediate/$startpoint.html"
39 |
40 | for i in {1..697}; do
41 | node "$scripts/$startpoint.js" "$intermediate/$i.json" "../../$source/gematriya.js" >> "$intermediate/$startpoint.html"
42 | done
43 |
44 | sed -i -e 's#]*>##g' -e 's#
##g' -e 's#(\([^)]*\)) \([^–]*\) – #"pirush">\1) \2 #' "$intermediate/$startpoint.html"
45 |
46 | if [[ ! -d "$output/kindle" ]]; then mkdir -p "$output/kindle"; fi;
47 | if [[ ! -d "$output/epub" ]]; then mkdir -p "$output/epub"; fi;
48 |
49 | for i in $intermediate/*.html; do
50 | name=$(basename --suffix=.html $i)
51 | convertsefer "$i" "$output/kindle/" "$name" "azw3" &
52 | convertsefer "$i" "$output/epub/" "$name" "epub" &
53 | wait
54 | done
55 |
--------------------------------------------------------------------------------
/scripts/gmara_nocha/gmara_nocha.bash:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | set -e
4 |
5 | #####
6 | # directories
7 | #####
8 | scripts="./scripts/gmara_nocha"
9 | css="$scripts/gmara_nocha.css"
10 | intermediate="./intermediate/gmara_nocha"
11 | source="./Orayta-Books/BooksSrc/032_gmara_nocha"
12 | output="./output/gmara_nocha"
13 |
14 |
15 | convertsefer() {
16 |
17 | input=$1
18 | folderout=$2
19 | fileout=$3
20 | title=$(echo $fileout | sed -e 's/_/ /g' )
21 | ext=$4
22 | args=("$input" "$folderout$fileout.$ext" --subset-embedded-fonts --extra-css "$css" --chapter '//*[@class="perekh"]' --chapter-mark "pagebreak" --start-reading-at '//*[@class="seferh"]' --language "he" --base-font-size "16" --title "$title" --authors 'תלמוד' --level1-toc '//*[@class="perekh"]' --level2-toc '//*[@class="dafh"]' --toc-title "תוכן ענינים")
23 | if [[ $ext == "epub" ]]; then args+=(--no-default-epub-cover); fi;
24 | if [[ $5 == "embed" ]]; then args+=(--embed-font-family "SBL Hebrew"); fi;
25 | ebook-convert "${args[@]}"
26 | }
27 |
28 |
29 | if [[ ! -d "$intermediate/temp" ]]; then mkdir -p "$intermediate/temp"; fi;
30 |
31 | for i in $source/*.txt; do
32 | dest=$(basename $i)
33 | sed -E 's/^#/\^/' $i > $intermediate/temp/$dest;
34 | done
35 |
36 | for i in $intermediate/temp/*.txt; do
37 | $scripts/gmara_nocha.awk "$i" > "$intermediate/$(basename --suffix _L1.txt $i)"
38 | done
39 |
40 | for i in $intermediate/*.txt; do
41 | $scripts/gmara_nocha_name.awk -v "basefolder=$intermediate" $i
42 | done
43 |
44 |
45 | #if [[ ! -d "$output/kindle_font" ]]; then mkdir -p "$output/kindle_font"; fi;
46 | if [[ ! -d "$output/kindle" ]]; then mkdir -p "$output/kindle"; fi;
47 |
48 | if [[ ! -d "$output/epub" ]]; then mkdir -p "$output/epub"; fi;
49 | #if [[ ! -d "$output/epub_font" ]]; then mkdir -p "$output/epub_font"; fi;
50 |
51 | for i in $intermediate/*.html; do
52 | name=$(basename --suffix=.html $i)
53 | convertsefer "$i" "$output/kindle/" "$name" "azw3" &
54 | # convertsefer "$i" "$output/kindle_font/" "$name" "azw3" "embed" &
55 | convertsefer "$i" "$output/epub/" "$name" "epub" &
56 | # convertsefer "$i" "$output/epub_font/" "$name" "epub" "embed" &
57 | wait
58 | done
59 |
--------------------------------------------------------------------------------
/scripts/Chumash_Rashi_English/Chumash_Rashi_English.js:
--------------------------------------------------------------------------------
1 | var fs = require('fs');
2 | let gematria = require(process.argv[4]);
3 | let jsonData = JSON.parse(fs.readFileSync(process.argv[2]));
4 | let commentaryData = JSON.parse(fs.readFileSync(process.argv[3]));
5 | let directory = process.argv[5];
6 | let count = fs.readFileSync(process.argv[6]);
7 | let file = null;
8 |
9 | for (let x=0; x' + jsonData.alts[x][i]["he"][0] + "\n");
18 | fs.appendFileSync(file, '' + jsonData.alts[x][i]["he"][0] + "
\n");
19 | fs.appendFileSync(file, '' + "פרק " + gematria(x+1) + "
\n");
20 | } else if (jsonData.alts[x] != undefined && jsonData.alts[x][i] != undefined){
21 | fs.appendFileSync(file, '' + jsonData.alts[x][i]["he"][0] + "
\n");
22 | } else if (i == 0){
23 | fs.appendFileSync(file, '' + "פרק " + gematria(x+1) + "
\n");
24 | }
25 | fs.appendFileSync(file, '' + gematria(i+1) + " " + jsonData.he[x][i] + "
\n");
26 | if (jsonData.text[x] != "" && jsonData.text[x][i] != undefined) {
27 | fs.appendFileSync(file, '' + jsonData.text[x][i] + "
\n");
28 | }
29 | if (commentaryData.he[x]!= undefined && commentaryData.he[x][i] != 0 && commentaryData.he[x][i] != undefined ) {
30 | for (let y=0; y' + commentaryData.he[x][i][y] + "\n");
32 | if (commentaryData.text[x] != undefined && commentaryData.text[x][i] != undefined && commentaryData.text[x][i][y] != undefined) {
33 | fs.appendFileSync(file, '' + commentaryData.text[x][i][y] + "
\n");
34 | }
35 | }
36 | }
37 | }
38 | }
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/scripts/Shulchan_Aruch_Harav/Shulchan_Aruch_Harav.bash:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | set -e
4 |
5 | #####
6 | # directories
7 | #####
8 | startpoint="Shulchan_Aruch_Harav"
9 | scripts="./scripts/$startpoint"
10 | css="$scripts/$startpoint.css"
11 | intermediate="./intermediate/$startpoint"
12 | source="./Orayta-Books/BooksSrc/080_poskim_ahronim/030_solhn_uroc_hrb"
13 | output="./output/$startpoint"
14 |
15 |
16 | convertsefer() {
17 |
18 | input=$1
19 | folderout=$2
20 | fileout=$3
21 | title=$(echo $fileout | sed -e 's/_/ /g' )
22 | ext=$4
23 | args=("$input" "$folderout$fileout.$ext" --subset-embedded-fonts --extra-css "$css" --chapter '//*[@class="Siman"]' --chapter-mark "pagebreak" --start-reading-at '//*[@class="seferh"]' --language "he" --base-font-size "16" --title "$title" --authors 'הרבי הזקן' --level1-toc '//*[@class="halachos"]' --level2-toc '//*[@class="Siman"]' --toc-title "תוכן ענינים")
24 | if [[ $ext == "epub" ]]; then args+=(--no-default-epub-cover); fi;
25 | if [[ $5 == "embed" ]]; then args+=(--embed-font-family "SBL Hebrew"); fi;
26 | ebook-convert "${args[@]}"
27 | }
28 |
29 |
30 | if [[ ! -d "$intermediate" ]]; then mkdir -p "$intermediate"; fi;
31 | if [[ ! -d "$intermediate/temp" ]]; then mkdir -p "$intermediate/temp"; fi;
32 |
33 | for i in $source/*.txt; do
34 | dest=$(basename $i)
35 | sed -E -e 's/<//g' -e 's/>//g' -e 's/<.?sup>//g' -e 's/ / /g' -e 's/<.?div[^>]*>//g' -e '/a target/d' -e '/a href/d' $i > $intermediate/temp/$dest;
36 | done
37 |
38 | for i in $intermediate/temp/*.txt; do
39 | "$scripts/$startpoint.awk" "$i" > "$intermediate/$(basename $i)"
40 | done
41 |
42 | for i in $intermediate/*.txt; do
43 | "$scripts/name_$startpoint.awk" -v "basefolder=$intermediate" $i
44 | done
45 |
46 | #if [[ ! -d "$output/kindle_font" ]]; then mkdir -p "$output/kindle_font"; fi;
47 | if [[ ! -d "$output/kindle" ]]; then mkdir -p "$output/kindle"; fi;
48 |
49 | if [[ ! -d "$output/epub" ]]; then mkdir -p "$output/epub"; fi;
50 | #if [[ ! -d "$output/epub_font" ]]; then mkdir -p "$output/epub_font"; fi;
51 |
52 | for i in $intermediate/*.html; do
53 | name=$(basename --suffix=.html $i)
54 | convertsefer "$i" "$output/kindle/" "$name" "azw3" &
55 | # convertsefer "$i" "$output/kindle_font/" "$name" "azw3" "embed" &
56 | convertsefer "$i" "$output/epub/" "$name" "epub" &
57 | # convertsefer "$i" "$output/epub_font/" "$name" "epub" "embed" &
58 | wait
59 | done
60 |
--------------------------------------------------------------------------------
/scripts/shnaim_mikra/shnaim_mikra.bash:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 |
4 | #####
5 | # directories
6 | #####
7 | scripts="./scripts/shnaim_mikra"
8 | css="$scripts/shnaim_mikra.css"
9 | intermediate="./intermediate/shnaim_mikra"
10 | source="./Orayta-Books/BooksSrc"
11 | targumsource="/005_mprsi_mkra/01_trgom"
12 | mikrasource="/001_mkra/01_torh"
13 | output="./output/shnaim_mikra"
14 |
15 |
16 | convertsefer() {
17 |
18 | input=$1
19 | folderout=$2
20 | fileout=$3
21 | title=$(echo $fileout | sed -e 's/_/ /g' )
22 | ext=$4
23 | args=("$input" "$folderout$fileout.$ext" --subset-embedded-fonts --extra-css "$css" --chapter '//*[@class="parshah" or @class="aliyah"]' --chapter-mark "pagebreak" --start-reading-at '//*[@class="parshah"]' --language "he" --base-font-size "16" --title "$title" --authors 'שניים מקרא' --level1-toc '//*[@class="parshah" or @class="aliyah"]' --toc-title "תוכן ענינים")
24 | if [[ $ext == "epub" ]]; then args+=(--no-default-epub-cover); fi;
25 | if [[ $5 == "embed" ]]; then args+=(--embed-font-family "SBL Hebrew"); fi;
26 | ebook-convert "${args[@]}"
27 | }
28 |
29 |
30 | if [[ ! -d "$intermediate/mikra" ]]
31 | then mkdir -p "$intermediate/mikra"
32 | fi
33 |
34 | for i in $source$mikrasource/*.txt; do
35 | dest=$(basename $i)
36 | sed -e 's#
\([^<>]\{1,7\}\)#@ \1#g' $i > $intermediate/mikra/$dest;
37 | done
38 |
39 | for i in $source$targumsource/*.txt; do
40 | targumname=$(basename $i)
41 | prefix=${targumname:0:2}
42 | mikraname=$intermediate/mikra/a$prefix*.txt
43 | $scripts/shnaim_mikra.awk $i $intermediate/mikra/$(basename $mikraname) > $intermediate/$(basename $mikraname)
44 | done
45 |
46 | for i in $intermediate/*.txt; do
47 | $scripts/shnaim_mikra_parsha.awk -v "basefolder=$intermediate" $i
48 | done
49 |
50 |
51 | #if [[ ! -d "$output/kindle_font" ]]; then mkdir -p "$output/kindle_font"; fi;
52 | if [[ ! -d "$output/kindle" ]]; then mkdir -p "$output/kindle"; fi;
53 |
54 | if [[ ! -d "$output/epub" ]]; then mkdir -p "$output/epub"; fi;
55 | #if [[ ! -d "$output/epub_font" ]]; then mkdir -p "$output/epub_font"; fi;
56 |
57 | for i in $intermediate/*.html; do
58 | name=$(basename --suffix=.html $i)
59 | convertsefer "$i" "$output/kindle/" "$name" "azw3" &
60 | # convertsefer "$i" "$output/kindle_font/" "$name" "azw3" "embed" &
61 | convertsefer "$i" "$output/epub/" "$name" "epub" &
62 | # convertsefer "$i" "$output/epub_font/" "$name" "epub" "embed" &
63 | wait
64 | done
65 |
--------------------------------------------------------------------------------
/scripts/talmud/talmud.bash:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 |
4 | #####
5 | # directories
6 | #####
7 | scripts="./scripts/talmud"
8 | css="$scripts/talmud.css"
9 | intermediate="./intermediate/talmud"
10 | source="./Orayta-Books/BooksSrc"
11 | rashisource="/040_rasonim_ss/01_rsi"
12 | mikrasource="/030_tlmod_bbli"
13 | output="./output/talmud"
14 |
15 |
16 | convertsefer() {
17 |
18 | input=$1
19 | folderout=$2
20 | fileout=$3
21 | title=$(echo $fileout | sed -e 's/_/ /g' )
22 | ext=$4
23 | args=("$input" "$folderout$fileout.$ext" --subset-embedded-fonts --extra-css "$css" --chapter '//*[@class="perekh"]' --chapter-mark "pagebreak" --start-reading-at '//*[@class="seferh"]' --language "he" --base-font-size "16" --title "$title" --authors 'תלמוד' --level1-toc '//*[@class="perekh"]' --level2-toc '//*[@class="dafh"]' --toc-title "תוכן ענינים")
24 | if [[ $ext == "epub" ]]; then args+=(--no-default-epub-cover); fi;
25 | if [[ $5 == "embed" ]]; then args+=(--embed-font-family "SBL Hebrew"); fi;
26 | ebook-convert "${args[@]}"
27 | }
28 |
29 |
30 | if [[ ! -d "$intermediate/mikra" ]]; then mkdir -p "$intermediate/mikra"; fi;
31 |
32 | for i in $source$mikrasource/*.txt; do
33 | dest=$(basename $i)
34 | sed -E 's###g' $i > $intermediate/mikra/$dest;
35 | done
36 |
37 | if [[ ! -d "$intermediate/rashi" ]]; then mkdir -p "$intermediate/rashi"; fi;
38 |
39 | for i in $source$rashisource/*.txt; do
40 | dest=$(basename $i)
41 | sed -e 's#<[bB]>##g' -e 's#[bB]>.#. - #g' $i > $intermediate/rashi/$dest;
42 | done
43 |
44 | for i in $intermediate/rashi/*.txt; do
45 | rashiname="$(basename --suffix 2.txt $i)"
46 | mikraname=$intermediate/mikra/"$rashiname"1.txt
47 | $scripts/talmud.awk "$i" "$mikraname" > "$intermediate/$(basename --suffix _L1.txt $mikraname).txt"
48 | done
49 |
50 | for i in $intermediate/*.txt; do
51 | $scripts/talmud_name.awk -v "basefolder=$intermediate" $i
52 | done
53 |
54 |
55 | #if [[ ! -d "$output/kindle_font" ]]; then mkdir -p "$output/kindle_font"; fi;
56 | if [[ ! -d "$output/kindle" ]]; then mkdir -p "$output/kindle"; fi;
57 |
58 | if [[ ! -d "$output/epub" ]]; then mkdir -p "$output/epub"; fi;
59 | #if [[ ! -d "$output/epub_font" ]]; then mkdir -p "$output/epub_font"; fi;
60 |
61 | for i in $intermediate/*.html; do
62 | name=$(basename --suffix=.html $i)
63 | convertsefer "$i" "$output/kindle/" "$name" "azw3" &
64 | # convertsefer "$i" "$output/kindle_font/" "$name" "azw3" "embed" &
65 | convertsefer "$i" "$output/epub/" "$name" "epub" &
66 | # convertsefer "$i" "$output/epub_font/" "$name" "epub" "embed" &
67 | wait
68 | done
69 |
--------------------------------------------------------------------------------
/scripts/Steinsaltz_talmud_Hebrew/Steinsaltz_talmud_Hebrew.bash:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 |
4 | #####
5 | # directories
6 | #####
7 | startpoint="Steinsaltz_talmud_Hebrew"
8 | scripts="./scripts/$startpoint"
9 | css="$scripts/$startpoint.css"
10 | intermediate="./intermediate/$startpoint"
11 | source="./sefaria"
12 | output="./output/$startpoint"
13 | gematriya="$source/gematriya.js"
14 |
15 | convertsefer() {
16 |
17 | input=$1
18 | folderout=$2
19 | fileout=$3
20 | ext=$4
21 | args=("$input" "$folderout$fileout.$ext" --subset-embedded-fonts --extra-css "$css" --chapter '//*[name()="h2" or name()="h3"]' --chapter-mark "none" --language "he" --base-font-size "14" --authors 'תלמוד' --toc-title "תוכן ענינים" --comments 'The William Davidson digital edition of the Koren Noé Talmud, with commentary by Rabbi Adin Steinsaltz Even-Israel via sefaria under the CC BY-NC 4.0' --sr1-replace '
' --page-breaks-before '/')
22 | if [[ $ext == "epub" ]]; then args+=(--no-default-epub-cover); fi;
23 | if [[ $5 == "embed" ]]; then args+=(--embed-font-family "SBL Hebrew"); fi;
24 | ebook-convert "${args[@]}"
25 | }
26 |
27 |
28 | if [[ ! -d "$intermediate" ]]; then mkdir -p "$intermediate"; fi;
29 |
30 | counter=1
31 | while read i; do
32 | dest="$(printf '%02d' $counter)_$i"
33 | dest="${dest// /_}"
34 | if [[ ! -f "$intermediate/$dest.json" ]]; then
35 | wget -O "$intermediate/$dest.json" "https://www.sefaria.org/api/texts/$i?pad=0";
36 | fi;
37 | counter=$(($counter+1));
38 | done << EOF
39 | $(node $scripts/talmud.js "$source/index.json")
40 | EOF
41 |
42 | if [[ ! -d "$intermediate/biur" ]]; then mkdir -p "$intermediate/biur"; fi;
43 |
44 | counter=1
45 | while read i; do
46 | dest="$(printf '%02d' $counter)_$i"
47 | dest="${dest//Steinsaltz on /}"
48 | dest="${dest// /_}"
49 | if [[ ! -f "$intermediate/biur/$dest.json" ]]; then
50 | wget -O "$intermediate/biur/$dest.json" "https://www.sefaria.org/api/texts/$i?pad=0";
51 | fi;
52 | counter=$(($counter+1));
53 | done << EOF
54 | $(node $scripts/biur.js "$source/index.json")
55 | EOF
56 |
57 | for i in $intermediate/*.json; do
58 | biur="$intermediate/biur/$(basename $i)"
59 | if [ -f "$biur" ]; then
60 | dest="$(basename --suffix .json $i)"
61 | node "$scripts/$startpoint.js" "$i" "$biur" "../../$source/gematriya.js" > "$intermediate/$dest.html"
62 | fi
63 | done
64 |
65 | if [[ ! -d "$output/kindle" ]]; then mkdir -p "$output/kindle"; fi;
66 | if [[ ! -d "$output/epub" ]]; then mkdir -p "$output/epub"; fi;
67 |
68 | for i in $intermediate/*.html; do
69 | name=$(basename --suffix=.html $i)
70 | convertsefer "$i" "$output/kindle/" "$name" "azw3" &
71 | convertsefer "$i" "$output/epub/" "$name" "epub" &
72 | wait
73 | done
74 |
--------------------------------------------------------------------------------
/scripts/chumash_rashi/chumash_rashi.bash:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 |
4 | #####
5 | # directories
6 | #####
7 | scripts="./scripts/chumash_rashi"
8 | css="$scripts/chumash_rashi.css"
9 | intermediate="./intermediate/chumash_rashi"
10 | source="./Orayta-Books/BooksSrc"
11 | rashisource="/005_mprsi_mkra/03_rsi/1_torh"
12 | mikrasource="/001_mkra/01_torh"
13 | output="./output/chumash_rashi"
14 |
15 |
16 | convertsefer() {
17 |
18 | input=$1
19 | folderout=$2
20 | fileout=$3
21 | title=$(echo $fileout | sed -e 's/_/ /g' )
22 | ext=$4
23 | args=("$input" "$folderout$fileout.$ext" --subset-embedded-fonts --extra-css "$css" --chapter '//*[@class="parshah" or @class="aliyah"]' --chapter-mark "pagebreak" --start-reading-at '//*[@class="parshah"]' --language "he" --base-font-size "16" --title "$title" --authors 'חומש רשי' --level1-toc '//*[@class="parshah" or @class="aliyah"]' --toc-title "תוכן ענינים")
24 | if [[ $ext == "epub" ]]; then args+=(--no-default-epub-cover); fi;
25 | if [[ $5 == "embed" ]]; then args+=(--embed-font-family "SBL Hebrew"); fi;
26 | ebook-convert "${args[@]}"
27 | }
28 |
29 |
30 | if [[ ! -d "$intermediate/mikra" ]]; then mkdir -p "$intermediate/mikra"; fi;
31 |
32 | for i in $source$mikrasource/*.txt; do
33 | dest=$(basename $i)
34 | sed -e 's#
\([^<>]\{1,7\}\)#@ \1#g' $i > $intermediate/mikra/$dest;
35 | done
36 |
37 | if [[ ! -d "$intermediate/rashi" ]]; then mkdir -p "$intermediate/rashi"; fi;
38 |
39 | for i in $source$rashisource/*.txt; do
40 | dest=$(basename $i)
41 | sed -e 's#{{[^{}]\{1,2\}}} ##g' -e 's###g' -e 's## - #g' $i > $intermediate/rashi/$dest;
42 | done
43 |
44 | for i in $intermediate/rashi/*.txt; do
45 | rashiname=$(basename $i)
46 | prefix=${rashiname:0:2}
47 | mikraname=$intermediate/mikra/a$prefix*.txt
48 | $scripts/chumash_rashi.awk $i $intermediate/mikra/$(basename $mikraname) > $intermediate/$(basename $mikraname)
49 | done
50 |
51 | for i in $intermediate/*.txt; do
52 | $scripts/chumash_rashi_parsha.awk -v "basefolder=$intermediate" $i
53 | done
54 |
55 |
56 | #if [[ ! -d "$output/kindle_font" ]]; then mkdir -p "$output/kindle_font"; fi;
57 | if [[ ! -d "$output/kindle" ]]; then mkdir -p "$output/kindle"; fi;
58 |
59 | if [[ ! -d "$output/epub" ]]; then mkdir -p "$output/epub"; fi;
60 | #if [[ ! -d "$output/epub_font" ]]; then mkdir -p "$output/epub_font"; fi;
61 |
62 | for i in $intermediate/*.html; do
63 | name=$(basename --suffix=.html $i)
64 | convertsefer "$i" "$output/kindle/" "$name" "azw3" &
65 | # convertsefer "$i" "$output/kindle_font/" "$name" "azw3" "embed" &
66 | convertsefer "$i" "$output/epub/" "$name" "epub" &
67 | # convertsefer "$i" "$output/epub_font/" "$name" "epub" "embed" &
68 | wait
69 | done
70 |
--------------------------------------------------------------------------------
/scripts/Chumash_Rashi_English/Chumash_Rashi_English.bash:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 |
4 | #####
5 | # directories
6 | #####
7 | startpoint="Chumash_Rashi_English"
8 | scripts="./scripts/$startpoint"
9 | css="$scripts/$startpoint.css"
10 | intermediate="./intermediate/$startpoint"
11 | source="./sefaria"
12 | output="./output/$startpoint"
13 | gematriya="$source/gematriya.js"
14 | commentary="rashi"
15 |
16 | convertsefer() {
17 |
18 | input=$1
19 | folderout=$2
20 | fileout=$3
21 | ext=$4
22 | args=("$input" "$folderout$fileout.$ext" --subset-embedded-fonts --extra-css "$css" --chapter '//*[name()="h2" or name()="h3"]' --chapter-mark "none" --language "he" --base-font-size "14" --authors 'חומש רשי' --toc-title "תוכן ענינים" --comments 'Rashi Chumash, Metsudah Publications, 2009 via sefaria under the CC BY 3.0' --sr1-replace '
' --page-breaks-before '/')
23 | if [[ $ext == "epub" ]]; then args+=(--no-default-epub-cover); fi;
24 | if [[ $5 == "embed" ]]; then args+=(--embed-font-family "SBL Hebrew"); fi;
25 | ebook-convert "${args[@]}"
26 | }
27 |
28 |
29 | if [[ ! -d "$intermediate" ]]; then mkdir -p "$intermediate"; fi;
30 |
31 | counter=1
32 | while read i; do
33 | dest="$(printf '%02d' $counter)_$i"
34 | dest="${dest// /_}"
35 | if [[ ! -f "$intermediate/$dest.json" ]]; then
36 | wget -O "$intermediate/$dest.json" "https://www.sefaria.org/api/texts/$i?pad=0&ven=Metsudah_Chumash,_Metsudah_Publications,_2009&vhe=Tanach_with_Ta'amei_Hamikra";
37 | fi;
38 | counter=$(($counter+1));
39 | done << EOF
40 | $(node $scripts/chumash.js "$source/index.json")
41 | EOF
42 |
43 | if [[ ! -d "$intermediate/$commentary" ]]; then mkdir -p "$intermediate/$commentary"; fi;
44 |
45 | counter=1
46 | while read i; do
47 | dest="$(printf '%02d' $counter)_$i"
48 | dest="${dest//Rashi on /}"
49 | dest="${dest// /_}"
50 | if [[ ! -f "$intermediate/$commentary/$dest.json" ]]; then
51 | wget -O "$intermediate/$commentary/$dest.json" "https://www.sefaria.org/api/texts/$i?pad=0&ven=Rashi_Chumash,_Metsudah_Publications,_2009&vhe=Rashi_Chumash,_Metsudah_Publications,_2009";
52 | fi;
53 | counter=$(($counter+1));
54 | done << EOF
55 | $(node $scripts/rashi.js "$source/index.json")
56 | EOF
57 |
58 | echo "0" > "$intermediate/count"
59 |
60 | for i in $intermediate/*.json; do
61 | alt="$intermediate/$commentary/$(basename $i)"
62 | if [ -f "$alt" ]; then
63 | dest="$(basename --suffix .json $i)"
64 | node "$scripts/$startpoint.js" "$i" "$alt" "../../$source/gematriya.js" "$intermediate/" "$intermediate/count"
65 | fi
66 | done
67 |
68 | if [[ ! -d "$output/kindle" ]]; then mkdir -p "$output/kindle"; fi;
69 | if [[ ! -d "$output/epub" ]]; then mkdir -p "$output/epub"; fi;
70 |
71 | for i in $intermediate/*.html; do
72 | name=$(basename --suffix=.html $i)
73 | convertsefer "$i" "$output/kindle/" "$name" "azw3" &
74 | convertsefer "$i" "$output/epub/" "$name" "epub" &
75 | wait
76 | done
77 |
--------------------------------------------------------------------------------
/scripts/sort_files.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | #
3 | # Copyright (c) 2018 Y Paritcher
4 | #
5 |
6 | start=a_root.html
7 | root=./source/
8 | sorted=./sorted/
9 | #current=$root
10 |
11 | splitfiles(){
12 |
13 | # if [[ $split != "" ]]
14 | # then echo "$split"
15 | # fi
16 |
17 | for i in $@; do
18 |
19 | start="$(iconv -f WINDOWS-1255 "$root$i" | grep -a '' | sed 's/' -e '' -e '' | sed -e 's/.*' | sed 's/.*' | sed 's/' | sed 's/.*' | sed 's/.*' | sed 's/.*' | sed 's/.*