Tips_and_Hacks/MAST_tW_PDF_Updater/FilesForUpdates/Reduce.Strongs.Linux.pl

37 lines
1.2 KiB
Perl

use 5.12.0;
use utf8;
use Cwd;
use File::Slurp;
use File::Basename;
use FindBin '$Bin';
use open IO => ":utf8";
$| = 1;
$" = "\n";
my ($pwd, $d, $fileSpec) = ($Bin, "\\", "\.usfm");
if ($^O eq "linux" || $^O eq "darwin") {$d = "/"}
chdir $pwd;
my $html_wrap = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "//www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="//www.w3.org/1999/xhtml"><body>';
say "Reduce.Strongs.Linux called";
my $fileText = read_file("$Bin/Temp/Strongs.html", binmode => 'utf8');
say "\$fileText\n$fileText\n";die;
if ($fileText =~ "Thayer.s") {
if ($fileText =~ /(<div class="vheading2">Thayer's Greek Lexicon.*?<\/iframe>)/) {
$fileText = "$html_wrap$1</body></html>";
$fileText =~ s/(<span class="greek2">)(.*?)(<\/span>)/$1<b>$2<\/b>$3/g;
}
}
elsif ($fileText =~ "Brown.Driver.Briggs") {
if ($fileText =~ /(<div class="vheading2">\nBrown-Driver-Briggs.*?\[font class="hebrew.*?<\/iframe>)/) {
$fileText = "$html_wrap$1</body></html>";
$fileText =~ s/(<font class="hebrew2">)(.*?)(<\/font>)/$1<font size="+1"><b>$2<\/b><\/font>$3/g;
}
}
else {die}
open OUT, ">:utf8", "$Bin/Temp/Strongs.html" or die;
say OUT $fileText;
close OUT;