[xml/sgml-commit] [SCM] linuxdoc-tools package for Debian. branch, experimental, updated. debian/0.9.60-7-ga985da1
Agustin Martin Domingo
agmartin at debian.org
Tue Apr 14 23:13:09 UTC 2009
The following commit has been merged in the experimental branch:
commit a985da18d2e85aec871978e45d31d572ddc45dc9
Author: Agustin Martin Domingo <agmartin at debian.org>
Date: Wed Apr 15 01:12:06 2009 +0200
fmt_latex2e.pl: cosmetic changes
diff --git a/lib/fmt/fmt_latex2e.pl b/lib/fmt/fmt_latex2e.pl
index 2fd4374..bb2a21e 100644
--- a/lib/fmt/fmt_latex2e.pl
+++ b/lib/fmt/fmt_latex2e.pl
@@ -123,8 +123,7 @@ $latex2e->{preASP} = sub {
# ------------------------------------------------------------------
my ($INFILE, $OUTFILE) = @_;
- # note the conversion of `sdata_dirs' list to an anonymous array to
- # make a single argument
+ # Note: `sdata_dirs' made an anonymous array to have a single argument
my $tex_char_maps = load_char_maps ('.2tex', [ Text::EntityMap::sdata_dirs() ]);
# ASCII char maps are used in the verbatim environment because TeX
@@ -244,64 +243,56 @@ $latex2e->{postASP} = sub
mkdir ($tmplatexdir, 0700)
or die "Could not create \"$tmplatexdir\" directory.\n";
- #
# check epsfile is specified in source file
- # check nameurl specified in source file
- #
{
my $epsf;
open $SGMLFILE, "<$filename.sgml";
- while (<$SGMLFILE>)
- {
- # for epsfile
- if ( s/^\s*<eps\s+file=(.*)>/$1/ )
- {
- s/\s+angle=.*//;
- s/\s+height=.*//;
- s/\"//g;
- $epsf = $_;
- chop ( $epsf );
- push @epsfiles, $epsf;
- }
- if ($latex2e->{output} eq "pdf")
- {
- if ( s/^\s*<img\s+src=(.*)>/$1/ )
- {
- s/\"//g;
- $epsf = $_;
- chop ( $epsf );
- push @epsfiles, $epsf;
- }
- }
+ while (<$SGMLFILE>){
+ # for epsfile
+ if ( s/^\s*<eps\s+file=(.*)>/$1/ ) {
+ s/\s+angle=.*//;
+ s/\s+height=.*//;
+ s/\"//g;
+ $epsf = $_;
+ chop ( $epsf );
+ push @epsfiles, $epsf;
}
+ if ($latex2e->{output} eq "pdf") {
+ if ( s/^\s*<img\s+src=(.*)>/$1/ ) {
+ s/\"//g;
+ $epsf = $_;
+ chop ( $epsf );
+ push @epsfiles, $epsf;
+ }
+ }
+ }
close $SGMLFILE;
}
+
+ # Parse TeX file and check nameurl specified in source file
{
my $urlid;
my $urlnam;
my $urldef;
- while (<$INFILE>)
- {
- push @texlines, $_;
- # for nameurl
- if ( /\\nameurl/ )
- {
- ($urlid, $urlnam) = ($_ =~ /\\nameurl{(.*)}{(.*)}/);
- print $urlnum . ": " . $urlid . "\n" if ( $global->{debug} );
-
- $urldef = latex2e_defnam($urlnum) . "url";
- s/\\nameurl{.*}{.*}/{\\em $urlnam} {\\tt \\$urldef}/;
- push @urlnames, $_;
- push @urldefines, "\\urldef{\\$urldef} \\url{$urlid}\n";
- $urlnum++;
- }
+
+ while (<$INFILE>){
+ # Read TeX file
+ push @texlines, $_;
+ # and check for nameurl
+ if ( /\\nameurl/ ){
+ ($urlid, $urlnam) = ($_ =~ /\\nameurl{(.*)}{(.*)}/);
+ print $urlnum . ": " . $urlid . "\n" if ( $global->{debug} );
+
+ $urldef = latex2e_defnam($urlnum) . "url";
+ s/\\nameurl{.*}{.*}/{\\em $urlnam} {\\tt \\$urldef}/;
+ push @urlnames, $_;
+ push @urldefines, "\\urldef{\\$urldef} \\url{$urlid}\n";
+ $urlnum++;
}
+ }
close $INFILE;
}
- open ($OUTFILE, "> $tmplatexnam.tex")
- or die "fmt_latex2e::postASP: Could not open \"$tmplatexnam.tex\" for write.\n";
-
# --------------------------------------------------------------------
# Set the correct \documentclass and packages options.
# --------------------------------------------------------------------
@@ -333,6 +324,9 @@ $latex2e->{postASP} = sub
$babeloptions = '';
}
+ open ($OUTFILE, "> $tmplatexnam.tex")
+ or die "fmt_latex2e::postASP: Could not open \"$tmplatexnam.tex\" for write.\n";
+
# Loop over the TeX file
my $inpreamble = 1;
while (defined($texlines[0])) {
@@ -407,9 +401,7 @@ $latex2e->{postASP} = sub
}
close $OUTFILE;
- #
# LaTeX, dvips, and assorted cleanups.
- #
if ($latex2e->{output} eq "tex") {
# comment out, because this backup action is not documented yet.
#
@@ -427,51 +419,40 @@ $latex2e->{postASP} = sub
return 0;
}
- #
# Run LaTeX in nonstop mode so it won't prompt & hang on errors.
# Suppress the output of LaTeX on all but the last pass, after
# references have been resolved. This avoids large numbers of
# spurious warnings.
- #
my $current_dir;
chop ($current_dir = `pwd`);
print $current_dir . "\n" if ( $global->{debug} );
- #
# copy epsfiles specified in tex file
- #
for my $epsf ( @epsfiles ) {
$tmpepsf = $tmplatexdir . "/" . $epsf;
print $epsf . " " . $tmpepsf . "\n" if ( $global->{debug} );
copy ("$epsf", "$tmpepsf") or die "can not copy graphics\n";
}
- #
# go to the temporary directory
chdir ($tmplatexdir);
my ($latexcommand) = "$latex2e->{latex} '\\nonstopmode\\input{$filename.tex}'";
- #
# We run pdflatex instead of latex if user selected pdf output
- #
if ($latex2e->{output} eq "pdf") {
$latexcommand = "pdflatex '\\nonstopmode\\input{$filename.tex}'";
}
- #
# run hlatex if hlatexp is used
# for pdf: how about status?(for hlatex and hlatexp)
- #
if ($latex2e->{latex} eq "hlatexp") {
#$latex2e->{output} = "ps" if ($latex2e->{output} eq "pdf");
$latexcommand = "hlatex '\\nonstopmode\\input{$filename.tex}'";
}
- #
# We use jlatex for Japanese encoded (euc-jp) characters.
# pdf support for Japanese are not yet. use ps for the time being.
- #
if ($global->{charset} eq "nippon") {
$latex2e->{output} = "ps" if ($latex2e->{output} eq "pdf");
$latexcommand = "$latex2e->{latex} '\\nonstopmode\\input{$filename.tex}'";
@@ -499,10 +480,10 @@ $latex2e->{postASP} = sub
unlink "$tmplatexnam.$suf";
}
}
- #
+
# go back to the working directory
chdir ($current_dir);
- #
+
# output dvi file
if ($latex2e->{output} eq "dvi") {
# comment out, because this backup action is not documented yet.
@@ -527,7 +508,7 @@ $latex2e->{postASP} = sub
}
return 0;
}
- #
+
# output pdf file
if ($latex2e->{output} eq "pdf") {
# comment out, because this backup action is not documented yet.
@@ -552,7 +533,7 @@ $latex2e->{postASP} = sub
}
return 0;
}
- #
+
# convert dvi into ps using dvips command
chdir ($tmplatexdir);
if ($latex2e->{dvips} eq "dvi2ps") {
--
linuxdoc-tools package for Debian.
More information about the debian-xml-sgml-commit
mailing list