[xml/sgml-commit] [SCM] linuxdoc-tools package for Debian. branch, master, updated. debian/0.9.60-24-gf1f1363
Agustin Martin Domingo
agmartin at debian.org
Mon Jun 15 12:30:29 UTC 2009
The following commit has been merged in the master branch:
commit b51f8428a5cf373e594b77a186dd1a85f82f0a7b
Author: Agustin Martin Domingo <agmartin at debian.org>
Date: Tue Apr 14 00:26:17 2009 +0200
fmt_latex2e.pl::postASP: Rearrange post processing of TeX file.
* Where applies, check for matches only in linuxdoc-tools provided
preamble. In that preamble, do not retry matches where a different
incompatible one succeeded. Only '\nameurl' test seems to go
outside that preamble.
* Cosmetic changes.
diff --git a/lib/fmt/fmt_latex2e.pl b/lib/fmt/fmt_latex2e.pl
index cce02de..2fd4374 100644
--- a/lib/fmt/fmt_latex2e.pl
+++ b/lib/fmt/fmt_latex2e.pl
@@ -6,7 +6,7 @@
#
# Copyright © 1996, Cees de Groot
# Copyright © 2000, Juan Jose Amor (Support for PDF files)
-# Copyright © 2006-2008, Agustin Martin (Better LaTeX packages handling, misc changes)
+# Copyright © 2006-2009, Agustin Martin
# ------------------------------------------------------------------
package LinuxDocTools::fmt_latex2e;
@@ -327,75 +327,81 @@ $latex2e->{postASP} = sub
# Getting babel options
my $babeloptions = $langlit || "english";
- if (($global->{charset} eq "nippon") ||
- ($global->{charset} eq "euc-kr"))
- {
- $babeloptions = '';
- }
+ if ( ($global->{charset} eq "nippon")
+ ||
+ ($global->{charset} eq "euc-kr")) {
+ $babeloptions = '';
+ }
+ # Loop over the TeX file
+ my $inpreamble = 1;
while (defined($texlines[0])) {
$_ = shift @texlines;
- # Set right class name and options in the header
- if (/^\\documentclass\[\@CLASSOPTIONS\@\]/) {
- s/\@(ARTICLE|REPORT|BOOK)\@/$classprefix . lc($1)/e;
- s/\@CLASSOPTIONS\@/$classoptions/;
- $_ = $_ . "\\makeindex\n" if ($latex2e->{makeindex});
- }
-
- # Set right babel options
- if (/^\\usepackage\[\@BABELOPTIONS\@\]{babel}/) {
- if ( $babeloptions ) {
- s/\@BABELOPTIONS\@/$babeloptions/;
- } else {
- s/^/%%/;
- }
- }
-
- if (/^\\usepackage.epsfig/ && ($global->{charset} eq "euc-kr")) {
- $hlatexopt = "[noautojosa]" if ($latex2e->{latex} eq "hlatexp");
- $_ = $_ . "\\usepackage" . "$hlatexopt" . "{hangul}\n";
- }
-
- # Deal with input encoding
- if ( /\\usepackage\[\@CHARSET\@\]\{inputenc\}/ ) {
- if ( $global->{charset} eq "latin" ) {
- s/\@CHARSET\@/latin1/;
- } else {
- s/^/%%/;
- }
- }
+ if ( $inpreamble ) {
+ if (/%end-preamble/) {
+ $inpreamble = '';
- # nippon or euc-kr do not use T1 encoding
- if ((/\\usepackage\[T1\]\{fontenc\}/) &&
- (($global->{charset} eq "nippon") ||
- ($global->{charset} eq "euc-kr")))
- {
- s/^/%%/;
- }
+ if ($latex2e->{pagenumber}) {
+ $_ = $_ . '\setcounter{page}{' .
+ $latex2e->{pagenumber} .
+ "}\n";
+ } else {
+ $_ = $_ . "\\pagestyle{empty}\n";
+ }
- if (/%end-preamble/) {
- if ($latex2e->{pagenumber}) {
- $_ = $_ . '\setcounter{page}{'.
- $latex2e->{pagenumber} . "}\n";
- } else {
- $_ = $_ . "\\pagestyle{empty}\n";
- }
- $_ = $_ . $global->{pass} . "\n" if ($global->{pass});
- }
+ # Now include the explicitly added stuff
+ $_ = $_ . $global->{pass} . "\n" if ($global->{pass});
- if (/\\nameurl/ && $latex2e->{output} ne "pdf") {
- $_ = shift @urlnames;
- }
- print $OUTFILE $_;
+ print $OUTFILE $_;
- if (/%end-preamble/) {
- if ($urlnum && $latex2e->{output} ne "pdf") {
- while (defined($urldefines[0])) {
- $_ = shift @urldefines;
- print $OUTFILE $_;
+ # Add to preamble url definitions for \urldef
+ if ($urlnum && $latex2e->{output} ne "pdf") {
+ foreach my $thisurl ( @urldefines ) {
+ print $OUTFILE $thisurl;
+ }
}
+ } else { # -- Not in last line of linuxdoc-tools added preamble
+ # Set correct class name and options in the header
+ if (/^\\documentclass\[\@CLASSOPTIONS\@\]/) {
+ s/\@(ARTICLE|REPORT|BOOK)\@/$classprefix . lc($1)/e;
+ s/\@CLASSOPTIONS\@/$classoptions/;
+ $_ = $_ . "\\makeindex\n" if ($latex2e->{makeindex});
+ }
+ # Set correct babel options
+ elsif (/^\\usepackage\[\@BABELOPTIONS\@\]{babel}/) {
+ if ( $babeloptions ) {
+ s/\@BABELOPTIONS\@/$babeloptions/;
+ } else {
+ s/^/%%/;
+ }
+ }
+ elsif (/^\\usepackage.epsfig/ && ($global->{charset} eq "euc-kr")) {
+ $hlatexopt = "[noautojosa]" if ($latex2e->{latex} eq "hlatexp");
+ $_ = $_ . "\\usepackage" . "$hlatexopt" . "{hangul}\n";
+ }
+ # Deal with input encoding
+ elsif ( /\\usepackage\[\@CHARSET\@\]\{inputenc\}/ ) {
+ if ( $global->{charset} eq "latin" ) {
+ s/\@CHARSET\@/latin1/;
+ } else {
+ s/^/%%/;
+ }
+ }
+ # nippon or euc-kr do not use T1 encoding
+ elsif ( (/\\usepackage\[T1\]\{fontenc\}/) &&
+ ( ($global->{charset} eq "nippon") ||
+ ($global->{charset} eq "euc-kr"))) {
+ s/^/%%/;
+ }
+ print $OUTFILE $_;
+ }
+ } else { # -- Not in linuxdocsgml added preamble
+ #
+ if (/\\nameurl/ && $latex2e->{output} ne "pdf") {
+ $_ = shift @urlnames;
}
+ print $OUTFILE $_;
}
}
}
--
linuxdoc-tools package for Debian.
More information about the debian-xml-sgml-commit
mailing list