added janky footnotes creating scripts
This commit is contained in:
parent
62080dab5c
commit
4588f0b172
7
footnote_scripts/1_create_footnotes
Normal file
7
footnote_scripts/1_create_footnotes
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
#!/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'
|
||||||
|
done
|
||||||
|
done
|
20
footnote_scripts/2_awkscript.awk
Normal file
20
footnote_scripts/2_awkscript.awk
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
#!/bin/awk
|
||||||
|
#uses file genereated from 1_create_footnotes to format each line of to be inserted into the final tsv
|
||||||
|
BEGIN{
|
||||||
|
FS="\t"
|
||||||
|
}
|
||||||
|
function printline(){
|
||||||
|
|
||||||
|
if ($2 != "" ){
|
||||||
|
book=$1
|
||||||
|
abbrev=$2
|
||||||
|
bookno=$3
|
||||||
|
chapter=$4
|
||||||
|
verseno=$5
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
printf("%s\t%s\t%d\t%d\t%d\t*\t%s\n",book,abbrev,bookno,chapter,verseno,$1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
{printline()}
|
16
footnote_scripts/3_integrate
Normal file
16
footnote_scripts/3_integrate
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
#!/bin/zsh
|
||||||
|
#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 )
|
||||||
|
printf '%s' "$line"
|
||||||
|
for i in {1..$count}; do
|
||||||
|
printf '*'
|
||||||
|
done
|
||||||
|
printf '\n'
|
||||||
|
grep "$start_of_line" notes_formatted
|
||||||
|
else
|
||||||
|
echo "$line"
|
||||||
|
fi
|
||||||
|
done<Genesis_from_tsv
|
Loading…
Reference in New Issue
Block a user