PDF cleanup of books before Zech

This commit is contained in:
Henry Whitney 2019-04-10 16:29:39 -04:00
parent 47a9779dc9
commit 3e54bd22ae
7 changed files with 103 additions and 104 deletions

View File

@ -8,12 +8,12 @@ my ($pwd, $d) = ($Bin, "\\");
if ($^O eq "darwin" || $^O eq "linux") {$d = "/"}
# /Users/Henry/Documents/git.Door43/en_tw/ForPDF/FilesForUpdates/CombineULBandNASBwithCodes.pl
my ($ulb, $nasb) = ("Temp${d}ULB_text.txt", "Data${d}NASB_Strongs.txt");
my ($ulb, $nasb) = ("$Bin${d}Temp${d}ULB_text.txt", "$Bin${d}Data${d}NASB_Strongs.txt");
my ($ref, $val, $textEditor);
my (%codes);
open LOG, ">:utf8", "Logs${d}log.log" or die;
open OUT, ">:utf8", "Temp${d}ULB_NASB_Strongs.txt" or die;
open LOG, ">:utf8", "$Bin${d}Logs${d}log.log" or die;
open OUT, ">:utf8", "$Bin${d}Temp${d}ULB_NASB_Strongs.txt" or die;
#say "\$pwd: $pwd${d}User${d}User_defaults.txt";
#say " /media/henry/92C6F7E3C6F7C58F/Users/henry/WA_Repo/Tips_and_Hacks/MAST_tW_PDF_Updater/FilesForUpdates/User/User_defaults.txt";
@ -29,7 +29,7 @@ open (my $defaults, "<:utf8", "$Bin${d}User${d}$udf") or die "$Bin${d}User${d}$u
while (my $thisLine = <$defaults>) {
chomp $thisLine;
if ($thisLine =~ /^Text editor: (.*)$/) {
say LOG "$thisLine";
#say LOG "$thisLine";
$textEditor = $1;
}
}
@ -55,6 +55,7 @@ open ($file, "<:utf8", "$ulb") or die "$ulb:\n$!";
while (my $line = <$file>) {
chomp $line;
#say LOG $line;
if ($line =~ /^([^\t]*)\t(.*)$/) {
($ref, $val) = ($1, $2);
if (exists $codes{$ref}) {
@ -66,9 +67,9 @@ while (my $line = <$file>) {
close OUT;
# say "Calling \$textEditor $textEditor";
if ($^O eq "darwin") {
system ("open -a $textEditor $nasb");
system ("open -a $textEditor $Bin${d}Temp${d}ULB_NASB_Strongs.txt");
}
close LOG;
print "\n\tDone\n\n\tOutput is in $nasb\n\n";
print "\n\tDone\n\n\tOutput is in $Bin${d}Temp${d}ULB_NASB_Strongs.txt\n\n";

View File

@ -340,3 +340,21 @@
954
1869
7050
7576
5193
2764
1696
7200
7368
2706
3220
3293
3760
5769
3318
241
2790
7725
3533
7993
6924

View File

@ -231,7 +231,7 @@ Ruth 4:16 3947 ||
Ruth 4:16 7896 ||
Ruth 4:16 2436 ||
Ruth 4:16 539 ||
Ruth 4:17 7121
Ruth 4:17 7121 ||
Esther 1:1 7651 ||
Esther 1:1 6242 ||
@ -1223,28 +1223,28 @@ Ecclesiastes 12:5 1364 ||
Ecclesiastes 12:5 1870 ||
Ecclesiastes 12:5 5006 ||
Ecclesiastes 12:5 5445 ||
Ecclesiastes 12:5 6565
Ecclesiastes 12:5 6565 ||
Ecclesiastes 12:5 1980 ||
Ecclesiastes 12:5 120 ||
Ecclesiastes 12:5 5437 ||
Ecclesiastes 12:6 7576
Ecclesiastes 12:6 7576 ||
Ecclesiastes 12:6 2256 ||
Ecclesiastes 12:6 4002
Ecclesiastes 12:6 953
Ecclesiastes 12:7 776
Ecclesiastes 12:6 4002 spring
Ecclesiastes 12:6 953 well
Ecclesiastes 12:7 776 earth
Ecclesiastes 12:7 5414 ||
Ecclesiastes 12:9 3148 ||
Ecclesiastes 12:9 5750 ||
Ecclesiastes 12:9 1847
Ecclesiastes 12:9 2713
Ecclesiastes 12:9 2713 searched out
Ecclesiastes 12:9 1847 knowledge
Ecclesiastes 12:10 4672 ||
Ecclesiastes 12:10 2656 ||
Ecclesiastes 12:10 3789 ||
Ecclesiastes 12:11 5193
Ecclesiastes 12:11 5193 ||
Ecclesiastes 12:11 5414 ||
Ecclesiastes 12:12 3148 ||
Ecclesiastes 12:12 6213 ||
Ecclesiastes 12:13 4687
Ecclesiastes 12:13 4687 commandments
Ecclesiastes 12:14 935 ||
Ecclesiastes 12:14 4941 ||
@ -2896,6 +2896,7 @@ Micah 4:13 1854 ||
Micah 5:1 1323 ||
Micah 5:1 5221 ||
Micah 5:2 3318 ||
Micah 5:2 5769 everlasting
Micah 5:3 5414 ||
Micah 5:4 5797 strength
Micah 5:4 3427 ||
@ -2946,75 +2947,68 @@ Micah 6:10 374 ||
Micah 6:10 2194 ||
Micah 6:11 68 ||
Micah 6:12 3427 ||
Micah 6:12 1696
Micah 6:12 7423
Micah 6:12 1696 ||
Micah 6:12 7423 deceitful
Micah 6:12 6310 ||
Micah 6:13 2470
Micah 6:13 5221
Micah 6:13 2470 ||
Micah 6:13 5221 ||
Micah 6:13 8074 making ... desolate
Micah 6:14 398 ||
Micah 6:14 5253
Micah 6:14 5253 ||
Micah 6:14 5414 ||
Micah 6:15 8354
Micah 6:16 2708
Micah 6:15 8354 ||
Micah 6:16 5414 ||
Micah 6:16 3427 ||
Micah 7:1 398 ||
Micah 7:1 1063
Micah 7:2 6
Micah 7:2 6679
Micah 7:2 2764
Micah 7:3 1696
Micah 7:3 1942
Micah 7:3 5315
Micah 7:4 4534
Micah 7:4 6486
Micah 7:1 1063 fig
Micah 7:2 6679 ||
Micah 7:2 2764 ||
Micah 7:3 1942 ||
Micah 7:3 1696 ||
Micah 7:4 2312 ||
Micah 7:4 6486 punishment
Micah 7:4 935 ||
Micah 7:5 7901
Micah 7:5 2436
Micah 7:5 8104
Micah 7:5 6607
Micah 7:5 7901 ||
Micah 7:5 2436 ||
Micah 7:5 8104 ||
Micah 7:5 6310 ||
Micah 7:6 1323
Micah 7:6 3618
Micah 7:6 341
Micah 7:7 3176
Micah 7:8 5307
Micah 7:6 1323 daughter
Micah 7:6 3618 ||
Micah 7:6 341 enemies
Micah 7:7 3176 wait
Micah 7:8 5307 fall
Micah 7:8 3427 ||
Micah 7:9 7379
Micah 7:9 6213 ||
Micah 7:9 3318
Micah 7:9 7200
Micah 7:10 7200
Micah 7:9 3318 ||
Micah 7:9 7200 ||
Micah 7:9 6666 justice
Micah 7:10 7200 ||
Micah 7:10 5869 ||
Micah 7:11 1129 ||
Micah 7:11 7368
Micah 7:11 2706
Micah 7:11 7368 ||
Micah 7:11 2706 ||
Micah 7:12 935 ||
Micah 7:12 5892 ||
Micah 7:12 4692
Micah 7:12 3220
Micah 7:12 3220 ||
Micah 7:13 3427 ||
Micah 7:14 7931
Micah 7:14 3293
Micah 7:14 3760
Micah 7:14 5769
Micah 7:15 3318
Micah 7:16 7200
Micah 7:14 3293 ||
Micah 7:14 3760 ||
Micah 7:14 5769 ||
Micah 7:15 3318 ||
Micah 7:16 7200 ||
Micah 7:16 7760 ||
Micah 7:16 6310 ||
Micah 7:16 241
Micah 7:16 2790
Micah 7:17 776
Micah 7:17 4526
Micah 7:18 5375
Micah 7:18 5771
Micah 7:18 639
Micah 7:19 7725
Micah 7:19 3533
Micah 7:19 7993
Micah 7:16 241 ||
Micah 7:16 2790 ||
Micah 7:17 776 earth
Micah 7:18 639 anger
Micah 7:19 7725 ||
Micah 7:19 3533 ||
Micah 7:19 7993 ||
Micah 7:20 5414 ||
Micah 7:20 2617
Micah 7:20 6924
Micah 7:20 571 truth
Micah 7:20 2617 covenant faithfulness
Micah 7:20 6924 ||
Nahum 1:2 1167 ||

View File

@ -24,7 +24,7 @@ my (%hash);
my ($whatami, $inFile);
my ($book, $chap, $vers, $text, $outText, $newV, $newC, $newB, $outFile, $usfmText, $metathesis, $repoPath, $ulbPath);
open(LOG, ">:utf8", "Logs${d}log.log") or die "${d}Logs${d}log.log:\n$!";
open(LOG, ">:utf8", "$Bin${d}Logs${d}log.log") or die "$Bin${d}${d}Logs${d}log.log:\n$!";
my ($udf) = "User_defaults.windows.txt";
if ($^O eq "linux") {$udf = "User_defaults.linux.txt"}
@ -34,11 +34,11 @@ open (my $defaults, "<:utf8", "User${d}$udf") or die "User${d}$udf:\n$!";
GetUserDefaults();
say LOG "\$inDir: $inDir";
#say LOG "\$inDir: |$inDir|";
chdir("$repoPath");
opendir THISDIR, "." or die "serious dainbramage: $!";
my @infiles = grep /$fileSpec$/i, readdir *THISDIR;
say LOG "\$repoPath: $repoPath, \$fileSpec: $fileSpec\n\@infiles:\n@infiles";
#say LOG "\$repoPath: $repoPath, \$fileSpec: $fileSpec\n\@infiles:\n@infiles";
closedir THISDIR;
chdir("$pwd");
ProcessFiles();
@ -60,7 +60,7 @@ sub GetUserDefaults {
die "No path to repo found" if $repoPath eq "";
($repoPath) = ("$repoPath${d}$ulbPath");
say LOG "\$repoPath: $repoPath";
#say LOG "\$repoPath: $repoPath";
close $defaults;
}
@ -74,54 +74,40 @@ sub ProcessFiles {
open(OUT, ">:utf8", "Temp${d}ULB_text.txt") or die "Temp${d}ULB_text.txt:\n$!";
@infiles = sort @infiles;
foreach $inFile (@infiles) {
#say LOG "$repoPath${d}$inFile";
open IN, "$repoPath${d}$inFile" or die "$repoPath${d}$inFile\n$!";
my $metathesis;
while (<IN>) {
chomp;
#say LOG "\t$_";
if (/\\c (\d*)/) {$ch = $1}
elsif (/^\\h (.*)$/) {$bk = $1}
elsif (/^\\v (\d*)( .*)$/) {
my ($verseText) = ($2);
$vs = $1;
$thisFile .= "\n$bk $ch:$vs\t$metathesis$verseText";
#say LOG "<0>\t$bk $ch:$vs\t$metathesis$verseText";
$metathesis = "";
} elsif (/^\\s5/) {
$thisFile .= "\n-----"
} elsif (/^\\[pqm].?$/) {
$thisFile .= " "
$thisFile .= " ";
#say LOG "<1>\t| |";
} elsif (/^\\[pqm].?( .*)/) {
$thisFile .= " $1"
$thisFile .= " $1";
#say LOG "<3> $1";
} elsif (/^\\d (.*)/) {$metathesis = "$1 "}
}
close IN;
}
$thisFile =~ s/\\f \+.*?\\f\*//g;
$thisFile =~ s/\\qs\*//g;
$thisFile =~ s/\\q\d //g;
$thisFile =~ s/\\f \+.*?\\f\*//g;
#say LOG "\$thisFile:\n$thisFile";
$thisFile =~ s/— /—/g;
$thisFile =~ s/ / /g;
open OUT, ">$Bin${d}Temp${d}ULB_text.txt" or die "$!";
say OUT $thisFile;
close OUT;
}
sub SearchAndReplace {
my $thisxLine = shift;
$thisxLine =~ s/\\s5.*$/\n-------\n/;
say LOG "<0>\t$thisxLine";
if ($thisxLine =~ s/\\h (.+) *$//) {$book = $1;$newB = 1}
elsif ($thisxLine =~ s/\\c (\d+)//) {$chap = $1; $newC = 1}
elsif ($thisxLine =~ s/\\v (\d+(-\d+)?) (.*)$/$3/) {
#print OUT "\n$outText\n";
$vers = $1;
$newV = 1;
$thisxLine = "\n$book $chap:$vers\t$metathesis$thisxLine";
$metathesis = "";
say LOG "<1>\t<$book> $chap:$vers\t$thisxLine";
}
elsif ($thisxLine =~ s/^\\q\d? (.*)$/ $1/) {}
elsif ($thisxLine =~ s/^\\m (.*)$/ $1/) {}
elsif ($thisxLine =~ s/^\\d (.*)//) {$metathesis = "$1 "}
elsif ($thisxLine =~ s/^\\[qpm]$//) {}
say LOG "<2>\t|$thisxLine|";
return $thisxLine;
}

View File

@ -28,11 +28,11 @@ open (my $defaults, "<:utf8", "User${d}$udf") or die "User${d}$udf:\n$!";
GetUserDefaults();
my ($excFile, $topDir, $txtFile, $dataFile, $displayFile, $filePattern, $sn, $xfAbr, $thisULB) = (
"Exceptions${d}Exceptions_tWs_from_OSHB.txt",
"$Bin${d}Exceptions${d}Exceptions_tWs_from_OSHB.txt",
"$repoPath${d}en_tw/bible",
"Temp${d}ULB_NASB_Strongs.txt",
"User${d}tW_work_OT.txt",
"Temp${d}mine_results.html",
"$Bin${d}Temp${d}ULB_NASB_Strongs.txt",
"$Bin${d}User${d}tW_work_OT.txt",
"$Bin${d}Temp${d}mine_results.html",
"*\.md"
);
@ -65,7 +65,7 @@ close LOG;
print "\n\tDone.\n\n";
sub GetUserDefaults {
open (my $defaults, "<:utf8", "User${d}$udf") or die "User${d}$udf:\n$!";
open (my $defaults, "<:utf8", "$Bin${d}User${d}$udf") or die "$Bin${d}User${d}$udf:\n$!";
while (my $thisLine = <$defaults>) {
chomp $thisLine;

View File

@ -5,7 +5,7 @@
# Deuteronomy deu Deut De
# Joshua jos Josh Jos
# Judges jdg Judg Jdg
# Ruth rut Ruth Ru
Ruth rut Ruth Ru
# 1 Samuel 1sa 1Sam 1Sa
# 2 Samuel 2sa 2Sam 2Sa
# 1 Kings 1ki 1Kgs 1Ki
@ -18,7 +18,7 @@
# Job job Job Job
# Psalms psa Ps Ps
# Proverbs pro Prov Pr
# Ecclesiastes ecc Eccl Ec
Ecclesiastes ecc Eccl Ec
# Song of Songs sng Song So
# Isaiah isa Isa Is
# Jeremiah jer Jer Je
@ -30,7 +30,7 @@
# Amos amo Amos Am
# Obadiah oba Obad Ob
# Jonah jon Jonah Jon
# Micah mic Mic Mic
Micah mic Mic Mic
# Nahum nam Nah Na
# Habakkuk hab Hab Hab
# Zephaniah zep Zeph Zep

View File

@ -1,5 +1,5 @@
echo Making ULB
perl "MakeULB.3.pl"
perl "MakeULB.4.pl"
echo Combining ULB and NASB
perl "CombineULBandNASBwithCodes.pl";
echo Building extract file