updated footnote_scripts to final version

This commit is contained in:
Alexander Bocken 2020-08-14 00:49:50 +02:00
parent 9f39ef1481
commit ff97886534
3 changed files with 95 additions and 8 deletions

View File

@ -1,7 +1,19 @@
#!/bin/zsh
#first script used to create a file with nicer formatting, here just for Genesis
for chapter in {0..50}; do
for i in {0..50}; do
cat Gen_$chapter.html | grep "fnm$i" | tr '\n' '@' | perl -pe "s/<div class=\"v\" id=\"v([0-9]{1,2}).*?<\/span> (.*?)<\/div>/Genesis\tGen\t1\t$chapter\t\1\t\2\*/g" | perl -pe "s/<sup class=\"fnm\".*?<\/sup>//g" | perl -pe "s/<div class=\"fn\"><sup class=\"fnt\">.*?<\/sup> (.*?)<\/div>/\1/" | tr '@' '\n'
awk 'BEGIN{FS="\t"} {print $1}' books > tmp_book_files
while read book_file
do
book_short="$(grep $book_file books | awk 'BEGIN{FS="\t"} {print $3}')"
long_book="$(grep $book_file books | awk 'BEGIN{FS="\t"} {print $2}')"
book_no="$(grep $book_file books | awk 'BEGIN{FS="\t"} {print $4}')"
chapters=$( ls all_books/$book_file* | wc -l )
for chapter in {1..$chapters}
do
for i in {1..100}
do
cat all_books/"$book_file"_$chapter.html | grep "fnm$i" | tr '\n' '@' | perl -pe "s/<div class=\"v\" id=\"v([0-9]{1,2}).*?<\/span> (.*?)<\/div>/$long_book\t$book_short\t$book_no\t$chapter\t\1\t*/g" | perl -pe "s/<sup class=\"fnm\".*?<\/sup>//g" | perl -pe "s/<div class=\"fn\"><sup class=\"fnt\">.*?<\/sup> (.*?)<\/div>/\1/" | tr '@' '\n'
done
done
done < tmp_book_files
#format of books: file book_short book_long book_no
#Still leaves some html formatting in there for some reason, needs additional stripping

View File

@ -2,15 +2,15 @@
#Adds the footnotes in the right location in the larger tsv file
while read line; do
start_of_line="$(echo "$line" | awk 'BEGIN{FS="\t"}{printf("%s\t%s\t%d\t%d\t%d\t\n",$1,$2,$3,$4,$5)}')"
if grep -q "$start_of_line" notes_formatted; then
count=$( grep "$start_of_line" notes_formatted | wc -l )
if grep -q "$start_of_line" formatted_all_footnotes; then
count=$( grep "$start_of_line" formatted_all_footnotes | wc -l )
printf '%s' "$line"
for i in {1..$count}; do
printf '*'
done
printf '\n'
grep "$start_of_line" notes_formatted
grep "$start_of_line" formatted_all_footnotes
else
echo "$line"
fi
done<Genesis_from_tsv
done<bibel.tsv

75
footnote_scripts/books Normal file
View File

@ -0,0 +1,75 @@
EinlAT Die Schriften des Alten Testaments EinlAT 0
Gen Genesis Gen 1
Ex Exodus Ex 2
Lev Levitikus Lev 3
Num Numer Num 4
Dtn Deuteronomium Dtn 5
Jos Josua Jos 6
Ri Richter Ri 7
Rut Rut Rut 8
1.Sam 1 Samuel 1Sam 9
2.Sam 2 Samuel 2Sam 10
1.Kön 1 Könige 1Kön 11
2.Kön 2 Könige 2Kön 12
1.Chr 1 Chronik 1Chr 13
2.Chr 2 Chronik 2Chr 14
Esra Esra Esr 15
Neh Nehemia Neh 16
Tob Tobit Tob 17
Jdt Judit Jdt 18
Est Ester Est 19
1.Makk 1 Makkabäer 1Makk 20 0
2.Makk 2 Makkabäer 2Makk 21
Ijob Ijob Ijob 22
Ps Psalmen Ps 23
Spr Sprichwörter Spr 24
Koh Kohelet Koh 25
Hld Hohelied Hld 26
Weish Weisheit Weish 27
Sir Sirach Sir 28
Jes Jesaja Jes 29
Jer Jeremia Jer 30
Klgl Klagelieder Klgl 31
Bar Baruch Bar 32
Ez Ezechiel Ez 33
Dan Daniel Dan 34
Hos Hosea Hos 35
Joel Joel Joel 36
Am Amos Am 37
Obd Obadja Obd 38
Jona Jona Jona 39
Mi Micha Mi 40
Nah Nahum Nah 41
Hab Habakuk Hab 42
Zef Zefanja Zef 43
Hag Haggai Hag 44
Sach Sacharja Sach 45
Mal Maleachi Mal 46
EinlNT Die Schriften des Neuen Testaments EinlNT 47
Mt Matthäus Mt 48
Mk Markus Mk 48
Lk Lukas Lk 49
Joh Johannes Joh 51
Apg Apostelgeschichte Apg 51
Röm Römer Röm 52
1.Kor 1 Korinther 1Kor 54
2.Kor 2 Korinther 2Kor 55
Gal Galater Gal 55
Eph Epheser Eph 56
Phil Philliper Phil 58
Kol Kolosser Kol 59
1.Thess 1 Thessalonicher 1Thess 59
2.Thess 2 Thessalonicher 2Thess 60
1.Tim 1 Timotheus 1Tim 62
2.Tim 2 Timotheus 2Tim 63
Tit Titus Tit 63
Phlm Philemon Phlm 65
Hebr Hebräer Heb 65
Jak Jakobus Jak 66
1.Petr 1 Petrus 1Petr 68
2.Petr 2 Petrus 2Petr 69
1.Joh 1 Johannes 1Joh 70
2.Joh 2 Johannes 2Joh 71
3.Joh 3 Johannes 3Joh 72
Jud Judas Jud 72
Offb Offenbarung Offb 74