App-Chart
view release on metacpan or search on metacpan
doc/mung-html.pl view on Meta::CPAN
print "$url\n";
}
# @external_gnu
# $manual is at www.gnu.org.
# $subdir is the subdirectory of http://www.gnu.org/software/ to find
# it, defaulting to
# http://www.gnu.org/software/PACKAGE/manual/index.html
# http://www.gnu.org/software/PACKAGE/manual/html_node/Foo.html
#
foreach my $elem (@external_gnu) {
my ($elem_manual, $subdir);
if (ref $elem) {
($elem_manual, $subdir) = @$elem;
} else {
$elem_manual = $elem;
$subdir = "$manual/manual/html_node";
}
if ($elem_manual ne $manual) { next; }
if ($node eq 'Top') {
$url = "http://www.gnu.org/software/$subdir/index.html";
} else {
$url = "http://www.gnu.org/software/$subdir/$node.html";
}
if ($option_verbose) {
print " -> $url\n";
}
return $url;
}
# @external_gnu_onepage
# $manual is at www.gnu.org, but only in single_page html form
# http://www.gnu.org/software/$package/$manual.html
#
foreach my $elem (@external_gnu_onepage) {
my ($elem_manual, $subdir) = @$elem;
if ($elem_manual ne $manual) { next; }
if ($node eq 'Top') {
$url = "http://www.gnu.org/software/$subdir/$manual.html";
} else {
$url = "http://www.gnu.org/software/$subdir/manual.html#$node";
}
if ($option_verbose) {
print " -> $url\n";
}
return $url;
}
#
if ($option_verbose) {
print " unchanged\n";
}
return $url;
}
#------------------------------------------------------------------------------
# png sizes
my $image_count = 0;
sub mung_img_sizes {
my ($body) = @_;
$body =~ s{<img (src="([^"]+)")}{
my $filename = $2;
$image_count++;
my $info = Image::ExifTool::ImageInfo($filename);
if (my $error = $info->{'Error'}) {
print "$progname: cannot get image info for '$filename': $error\n";
}
"<img width=$info->{'ImageWidth'} height=$info->{'ImageHeight'} $1"
}egi;
return $body;
}
#------------------------------------------------------------------------------
# copyright at end
my $texi_filename = "$FindBin::Bin/chart.texi";
sub mung_copyright {
my ($body, $filename) = @_;
my $see_copying = '';
if ($filename =~ m{/Copying\.html$}) {
my $link = ($body =~ /href="#Copying"/
? '#Copying'
: 'Copying.html');
my $see_copying = "\n(see <a href=\"$link\">Copying</a>)";
}
my $texi = File::Slurp::read_file($texi_filename);
$texi =~ /(Copyright.*?)\n\n/ or die;
my $copyright = $1;
$body =~ s{</body>}{<hr width="100%">
<p>
$copyright
<p>
Chart is free software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Free Software
Foundation; either version 3, or (at your option) any later version$see_copying.
</p>
</body>};
# in one-file output there's already a <hr> at end of file, don't repeat
$body =~ s{<hr>(\s*<hr width=)}{$1};
return $body;
}
#------------------------------------------------------------------------------
# footer link back to home page
( run in 0.919 second using v1.01-cache-2.11-cpan-df04353d9ac )