Skip to content
Permalink
Browse files

fix image re-use

also, fix output from config script.

typos in filenames.
  • Loading branch information
Dan Gildea
Dan Gildea committed Mar 6, 2020
1 parent 79c499d commit 8a4c74a0a6cbbe2443a02fda9a38ea3182c25bd5
Showing with 20 additions and 9 deletions.
  1. +4 −5 config/config.pl
  2. +16 −4 latex2html.pin
@@ -1274,8 +1274,8 @@ package main;
my $testpath = $path . $_;
# if(!$gs_lib && -d $testpath && -s "$testpath${dd}gs_init.ps") {
# 2017-04-11, 2019-12-03 shige: 2-24)
if ($testpath =~ /tlgs/) { $gs_stand_ps = "landscape.ps"; }
else { $gs_stand_ps = "gs_init_ps"; }
if ($testpath =~ /tlgs/) { $gs_stand_ps = "landscap.ps"; }
else { $gs_stand_ps = "gs_init.ps"; }
if(!$gs_lib && -d $testpath && -s "$testpath${dd}$gs_stand_ps") {
push(@right_paths,L2hos->path2os($testpath));
$gs_lib = 1;
@@ -1389,9 +1389,9 @@ package main;
$vers = $1;
($major_vers) = $vers =~ /^(\d+)/;
}
&checking('if pnmcrop can crop from one direction');
if ($major_vers =~ /^199/) {
# try left crop
&checking('if pnmcrop can crop from one direction');
my $timg = "config${dd}timg.pnm";
($stat,$msg,$err) = &get_out_err("$pnmcrop -l $timg");
} elsif ($major_vers > 8) {
@@ -1408,7 +1408,6 @@ package main;
$newcfg{'PNMCROPOPT'} = ' -sides ';
}
} else { $newcfg{'PNMCROPOPT'} = ' -sides '; }
print "\n$pnmcrop";
$msg = 'there is nothing to crop'; $stat = '';
} else {
print "\nThis $vers for $pnmcrop is not recognisable.";
@@ -1525,8 +1524,8 @@ package main;
$msg = $msg || $err;
my $vers = '';
if ($msg =~ /(^|\s*)Version.*\s([\d\.]+)\s*([\n\r]|$)/is) { $vers = $2; }
&checking('if ppmtogif can make transparent GIFs');
if ($vers =~ /^199/) {
&checking('if ppmtogif can make transparent GIFs');
# '-h' is an invalid option. Nevertheless it forces ppmtogif to output a
# usage information to stderr. We'll have a closer look at that.
($stat,$msg,$err) = &get_out_err("$ppmtogif -h");
@@ -2295,7 +2295,7 @@ sub translate {
if (-f "${PREFIX}internals.pl") {
my $file = "${PREFIX}internals.pl";
if ($file !~ /^\Q$dd\E/) {
if (!L2hos->is_absolute_path($file)) {
$file = ".$dd$file";
}
require ($file);
@@ -3569,10 +3569,14 @@ sub process_undefined_environment {
# }
# quotes will not be there with HTML 2.0
$size =~ s/\"//g if ($HTML_VERSION < 2.2);
if ($size && /\s$size\s/) {
# if ($size && /\s$size\s/) {
# 2020-03-03 shige:
if ($size && /;$size$/) {
# Size is OK; recycle it!
++$global_page_num;
$_ = $cached ; # ...perhaps restoring the desired size.
# 2020-03-03 shige:
s/;$size$//;
s/(${PREFIX}T?img)\d+\.($IMAGE_TYPE|html)/
&rename_html($&,"$1$global_page_num.$2")/geo;
} else {
@@ -3939,6 +3943,8 @@ sub call_dvips {
sub make_images {
local($name, $contents, $raw_contents, $uucontents, $page_num,
$uucontents, %page_map, $img);
# 2020-03-03 shige:
local $imgsize;
# It is necessary to run LaTeX this early because we need the log file
# which contains information used to determine equation alignment
if ( $latex_body =~ /newpage/) {
@@ -4036,7 +4042,9 @@ sub make_images {
$contents = $latex_body{$name};
if ($page_num =~ /^\d+\#\d+$/) { # If it is a page number
do { # Extract the page, convert and save it
$img = &extract_image($page_num,$orig_name_map{$page_num});
# $img = &extract_image($page_num,$orig_name_map{$page_num});
# 2020-03-03 shige:
($img, $imgsize) = &extract_image($page_num,$orig_name_map{$page_num});
if ($contents =~ /$htmlimage_rx/) {
$uucontents = &special_encoding($env,$2,$contents);
} elsif ($contents =~ /$htmlimage_pr_rx/) {
@@ -4046,6 +4054,8 @@ sub make_images {
}
if (($HTML_VERSION >=3.2)||!($contents=~/$order_sensitive_rx/)){
$cached_env_img{$uucontents} = $img;
# 2020-03-03 shige:
if ($imgsize) { $cached_env_img{$uucontents} .= ";$imgsize"; }
} else {
# Blow it away so it is not saved for next time
delete $cached_env_img{$uucontents};
@@ -10288,7 +10298,9 @@ sub embed_image {
$result .= ">";
# }
}
join('',$anch1, $result, $anch2);
# join('',$anch1, $result, $anch2);
# 2020-03-03 shige:
(join('',$anch1, $result, $anch2), $imagesize);
}
# MRO: added PNG support

0 comments on commit 8a4c74a

Please sign in to comment.
You can’t perform that action at this time.