UPdating tool for Linux

This commit is contained in:
Henry Whitney 2019-04-16 14:40:01 -04:00
parent 34c07bf522
commit 6f5bc66de1
4 changed files with 42 additions and 19 deletions

View File

@ -664,7 +664,7 @@ Ezra 7:28 3289 counselors
Ezra 7:28 2388 ||
Ezra 7:28 5927 ||
Ezra 8:1 5927 ||
Ezra 8:3 3187
Ezra 8:3 3187 ||
Ezra 8:3 2145
Ezra 8:4 2145
Ezra 8:5 2145

View File

@ -12,12 +12,12 @@ use FindBin '$Bin';
use Cwd ;
my ($d) = ("\\");
my ($workDir, $textEditor, $repoPath, $browser, $blbRef) = ($Bin, "\\");
my ($workDir, $textEditor, $repoPath, $browser, $blbRef, $tN_page) = ($Bin, "\\");
my %abbr;
if ($^O eq "darwin" || $^O eq "linux") {$d = "/"}
open LOG, ">:utf8", "Logs${d}mine_log.log" or die ("$!");
open LOG, ">:utf8", "$Bin${d}Logs${d}mine_log.log" or die ("$!:\n$Bin$[d}Logs${d}mine_log.log");
while (<DATA>) {
chomp;
@ -47,8 +47,8 @@ my ($excFile, $topDir, $txtFile, $dataFile, $displayFile, $filePattern, $sn, $xf
"*\.md"
);
my ($missingLine, $bk, $ch, $vs, $ref, $strong, $word, $flag, $tNid, $abbr, $doFlag, $xmlFile, $outputFiles, $lbsBk);
my (%bkAbr, %wa);
my ($missingLine, $bk, $ch, $vs, $ref, $strong, $word, $flag, $tNid, $abbr, $doFlag, $xmlFile, $lbsBk);
my (%bkAbr, %wa, %tW_file);
my @tWfiles;
find( sub { push @tWfiles, $File::Find::name if ( m/^(.*)$filePattern$/ ) }, $topDir) ;
@ -81,11 +81,13 @@ sub GetUserDefaults {
while (my $thisLine = <$defaults>) {
chomp $thisLine;
if ($thisLine =~ /^Text editor: (.*)$/) {
$textEditor = "\"$1\"";
$textEditor = $1;
if ($^O eq "MSWin32" || $^O eq "MSWin64") {$textEditor =~ s/^(.*)$/"$1"/g;}
} elsif ($thisLine =~ /^Repository directory: (.*)$/) {
$repoPath = $1
} elsif ($thisLine =~ /^HTML browser: (.*)$/) {
$browser = "\"$1\"";
$browser = $1;
if ($^O eq "MSWin32" || $^O eq "MSWin64") {$textEditor =~ s/^(.*)$/"$1"/g;}
}
}
@ -133,8 +135,9 @@ sub ParseLine {
while (length $ch < $mxl) {$ch =~ s/^/0/}
while (length $vs < $mxl) {$vs =~ s/^/0/}
$xmlFile = "$repoPath/OSHB/${numBk}.xml";
say LOG "\n\$wa{$fullBk}/\$ch/\$vs: $wa{$fullBk}/$ch/$vs\nTo system:\n$textEditor $repoPath/en_tn/$wa{$fullBk}/$ch/$vs.md\n";
if ($^O eq "darwin") {system `$textEditor $repoPath/en_tn/$wa{$fullBk}/$ch/$vs.md`}
$tN_page = "$repoPath/en_tn/$wa{$fullBk}/$ch/${vs}.md";
say LOG "\n\$wa{$fullBk}/\$ch/\$vs: $wa{$fullBk}/$ch/$vs\nTo system:\n$textEditor $tN_page\n";
if ($^O eq "darwin") {system `$textEditor $tN_page`}
#say "open -a /Applications/Logos.app \"logos4:TextComparison;ref=BibleBHS.$lbsBk${sch}.$svs;res=esv,niv2011,niv,nasb95,nrsv,gs-netbible,nlt,leb,kjv1900\"";
if ($^O eq "darwin") {system `open -a /Applications/Logos.app "logos4:TextComparison;ref=BibleNIV.$lbsBk${sch}.$svs;res=esv,niv2011,niv,nasb95,nrsv,gs-netbible,nlt,leb,kjv1900"`}
}
@ -228,6 +231,7 @@ sub FindVerse {
sub ChecktWPages{
say "Checking tW pages";
say LOG "<<$word>>";
if ($word eq "") {
say "\nThere is no \$word for \$strong = $strong in $ref\n$thisULB\n";
@ -237,14 +241,16 @@ sub ChecktWPages{
say OUT "<p>";
foreach my $file ( @tWfiles ) {
my $fileText = read_file("$file", binmode => 'utf8');
my $foundHere;
# While finds entries and Strong's numbers
while ($fileText =~ /($strong)[^\d]|^(# [^\n]*\b$word\b)/g) {
$foundHere = 1;
#system `clear`;
my $abb = $file;
$abb =~ s/.md$//;
say OUT "$abb<br />\n";
$outputFiles .= "$file "
}
if ($foundHere == 1) {unless (exists $tW_file{$file}) {$tW_file{$file} = $file}}
}
say OUT "</p>";
}
@ -264,7 +270,7 @@ sub Finish {
my $abb = $file;
$abb =~ s/.md$//;
say OUT "$abb: $pre<span style=\"color:red\">$found</span>$post<br />\n";
$outputFiles .= "$file "
unless (exists $tW_file{$file}) {$tW_file{$file} = $file}
}
}
say OUT "</p>";
@ -278,23 +284,38 @@ sub Finish {
my $abb = $file;
$abb =~ s/.md$//;
say OUT "$abb: $pre<span style=\"color:red\">$found</span>$post<br />\n";
$outputFiles .= "$file "
unless (exists $tW_file{$file}) {$tW_file{$file} = $file}
}
}
say OUT "</p>";
my $tW_files;
foreach my $key (sort keys %tW_file) {
$tW_files .= "$key ";
}
say "\nOpening .md files.";
if ($^O eq "darwin") {
system `$browser https://www.blueletterbible.org/lang/lexicon/lexicon.cfm?strongs=$strong`;
system `$textEditor $outputFiles`;
system `$textEditor $tW_files`;
system `$textEditor $excFile`;}
if ($^O eq "linux") {
system `$browser https://www.blueletterbible.org/lang/lexicon/lexicon.cfm?strongs=$strong &`;
system `$textEditor $outputFiles &`;
system `$textEditor $excFile &`;}
#system `$browser https://www.blueletterbible.org/lang/lexicon/lexicon.cfm?strongs=$strong &`;
say "\$blbRef $blbRef";
#system `$browser $browser $blbRef &`;
say "\$tW_file: $tW_files";
#system `$textEditor $tW_files &`;
say "\$excFile: $excFile";
#system `$textEditor $excFile &`;
open OUT1, ">$Bin${d}Temp${d}ns.sh";
say OUT1 "$browser --new-window https://www.blueletterbible.org/lang/lexicon/lexicon.cfm?strongs=$strong $blbRef $displayFile & disown";
say OUT1 "$textEditor --new-window $tW_files $tN_page & disown";
#say OUT1 "$textEditor $excFile &";
close OUT1;
#system `cd Temp;. ./ns.sh &`
}
if ($^O eq "MSWin32" || $^O eq "MSWin64" ) {
system `START "" $browser https://www.blueletterbible.org/lang/lexicon/lexicon.cfm?strongs=$strong`;
say "\$outputFiles: $outputFiles";
system `START "" $textEditor $outputFiles`;
say "\$tW_file: $tW_files";
system `START "" $textEditor $tW_files`;
say "\$excFile: $excFile";
system `START "" $textEditor $excFile`;
$displayFile =~ s/\//\\/g;

View File

@ -0,0 +1,2 @@
firefox --new-window https://www.blueletterbible.org/lang/lexicon/lexicon.cfm?strongs=H2145 https://www.blueletterbible.org/net/ezr/8/3 /home/henry/Documents/WA_Repo/Tips_and_Hacks/MAST_tW_PDF_Updater/FilesForUpdates/Temp/mine_results.html & disown
komodo --new-window /home/henry/Documents/WA_Repo/en_tw/bible/kt/children.md /home/henry/Documents/WA_Repo/en_tn/ezr/08/03.md & disown

View File

@ -5,7 +5,7 @@ Here are the current defaults the scripts will be looking for.
===============
# For Linux
Text editor: gedit
Text editor: komodo
HTML browser: firefox
Repository directory: /home/henry/Documents/WA_Repo