summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2016-08-16 21:47:57 +0000
committerKarl Berry <karl@freefriends.org>2016-08-16 21:47:57 +0000
commit43e6ff9a9d16337d8fbd9be2d4b4de9868c5ec13 (patch)
treeec1aa2366db4471a4c56e01a74a3cbe46b7a00e9
parent54563336da5800024cf4ec710295814020413f5b (diff)
latexpand (16aug16)
git-svn-id: svn://tug.org/texlive/trunk@41873 c570f23f-e606-0410-a88d-b1316a301751
-rwxr-xr-xBuild/source/texk/texlive/linked_scripts/latexpand/latexpand64
-rwxr-xr-xBuild/source/texk/texlive/linked_scripts/texlive/tlmgr.pl8
-rw-r--r--Master/texmf-dist/doc/support/latexpand/LICENCE30
-rw-r--r--Master/texmf-dist/doc/support/latexpand/README14
-rw-r--r--Master/texmf-dist/doc/support/latexpand/version.txt4
-rwxr-xr-xMaster/texmf-dist/scripts/latexpand/latexpand64
6 files changed, 129 insertions, 55 deletions
diff --git a/Build/source/texk/texlive/linked_scripts/latexpand/latexpand b/Build/source/texk/texlive/linked_scripts/latexpand/latexpand
index e8694e7fe25..f98c0ee9598 100755
--- a/Build/source/texk/texlive/linked_scripts/latexpand/latexpand
+++ b/Build/source/texk/texlive/linked_scripts/latexpand/latexpand
@@ -1,6 +1,6 @@
#!/usr/bin/perl
# Inspired by latexpand by D. Musliner, University of Michigan
-# 2012, 2013, 2014, 2015: Matthieu Moy <Matthieu.Moy@imag.fr>
+# 2012, 2013, 2014, 2015, 2016: Matthieu Moy <Matthieu.Moy@imag.fr>
# BSD License
use strict;
@@ -53,7 +53,7 @@ sub get_version
{
# $VERSION's value will be substituted by 'make dist', but the
# next line won't (the string has to be broken to avoid it).
- my $VERSION = 'v1.2-1-g47e2cee';
+ my $VERSION = 'v1.3';
if ($VERSION eq '@LATEXPAND' . '_VERSION@') {
my($vol,$dir,$file) = File::Spec->splitpath($0);
chdir($dir);
@@ -78,8 +78,8 @@ if ($empty_comments) {
}
if ($output && $output ne "-") {
- open OUTPUT, '>', "$output" or die $!;
- STDOUT->fdopen(\*OUTPUT, 'w') or die $!;
+ open (my $OUTPUT, '>', "$output") or die $!;
+ STDOUT->fdopen(\*$OUTPUT, 'w') or die $!;
}
sub say
@@ -105,9 +105,8 @@ sub process_file
my $file = shift;
my $prefix = (shift || "");
my $in_comment = 0;
- local(*FILE);
- open(FILE, $file) or die "could not open input file '$file'\n";
- while (my $line = <FILE>) {
+ open(my $FILE, "<", $file) or die "could not open input file '$file'\n";
+ while (my $line = <$FILE>) {
if ($line =~ /^[ \t]*\\endinput/) {
$line =~ s/(\\endinput.*)\n/% $1/;
$in_comment = 1;
@@ -123,17 +122,18 @@ sub process_file
# ignored by LaTeX, but we don't allow anything before
# to avoid e.g. \verb|\end{document}| from terminating
# the file.
- if (!$keep_comments && $line =~ /^[ \t]*\\end{document}/) {
+ if (!$keep_comments && $line =~ /^[ \t]*\\end\{document\}/) {
last;
}
}
- close(FILE);
+ close($FILE);
return $in_comment;
}
sub process_line
{
- my ($_, $prefix, $file) = @_;
+ my ($line, $prefix, $file) = @_;
+ $_ = $line;
# Consider \makeatletter only in preamble, because we do want
# to warn on \someCommand{\makeatletter\command@with@arobase}.
if ($in_preamble && /^[^%]*\\makeatletter/) {
@@ -149,13 +149,23 @@ sub process_line
print STDERR "Warning: consider using --makeatletter if the result is not compilable.\n";
}
unless ($keep_comments) {
- if ($empty_comments) {
- s/^%.*$/%/;
- s/([^\\])%.*$/$1%/;
- } else {
- s/^%.*\n//;
- s/([^\\])%.*\n/$1/;
+ if (!$empty_comments) {
+ # Include \n in pattern to avoid matching
+ # comments at end of files
+
+ # remove comments + whitespace-only lines completely
+ s/^\s*%.*\n//;
+
+ # remove only the comment if the line has actual content
+ s/([^\\])%.*\n/$1\n/;
}
+ # Apply the "empty comments" treatment unconditionally
+ # for end-of-files comments not matched above (it
+ # doesn't harm to keep an empty comment sometimes, but
+ # it may harm to leave a real comment if the goal was
+ # to strip them).
+ s/^%.*$/%/;
+ s/([^\\])%.*$/$1%/;
}
unless ($keep_includes) {
@@ -203,7 +213,7 @@ sub process_line
if ($expand_usepackage) {
# Don't bother with before and after text, we just require the
# usepackage to be alone on its line.
- if (my ($package_name) = /^\s*\\usepackage{([^}]*)}\s*(%.*)?$/) {
+ if (my ($package_name) = /^\s*\\usepackage\{([^\}]*)\}\s*(%.*)?$/) {
my $full = find_file($package_name . ".sty", $TEXINPUTS);
if ($full) {
say $prefix . "Found package file: $full\n";
@@ -216,7 +226,7 @@ sub process_line
}
if ($expand_bbl) {
if (my ($before, $bib_name, $after)
- = /^(.*)\\bibliography{([^}]*)}(.*)$/) {
+ = /^(.*)\\bibliography\{([^\}]*)\}(.*)$/) {
# The BBL file is not necessarily $bib_name.
# Take it from the command-line.
print $before . $nl;
@@ -233,7 +243,7 @@ sub process_line
print STDERR "$full\n";
}
}
- if (/^[ \t]*\\begin{document}/) {
+ if (/^[ \t]*\\begin\{document\}/) {
$in_preamble = 0;
if ($makeatletter) {
print '\makeatletter' . $nl;
@@ -257,7 +267,7 @@ sub find_tex_file
die "ERROR: Could not find file [$file]\n";
} else {
print STDERR "Warning: Could not find file [$file]\n";
- return undef;
+ return;
}
}
@@ -334,7 +344,7 @@ problems by outputing a single LaTeX file that contain no comment.
The latest version of latexpand is available here:
- https://gitorious.org/latexpand
+ https://gitlab.com/latexpand/latexpand
Versions are uploaded to ctan.org from time to time:
@@ -342,7 +352,12 @@ Versions are uploaded to ctan.org from time to time:
=head1 BUGS
-Please, report bugs to Matthieu Moy <Matthieu.Moy@imag.fr>.
+Please, report bugs on the issue tracker on the project site:
+
+ https://gitlab.com/latexpand/latexpand/issues
+
+Alternatively, you may email directly the author: Matthieu Moy
+<Matthieu.Moy@imag.fr>.
=head2 Known bugs
@@ -352,6 +367,9 @@ latexpand currently ignores \begin{verbatim} ... \end{verbatim}, and
will therefore process any \include, \input, ... directives that
appear within verbatim environments (while it shouldn't).
+LaTeX comments inside verbatim environments are also incorrectly
+stripped. You can use --keep-comments as a workaround to avoid this.
+
=head3 Comment environment
It would be nice to remove code between \begin{comment} and
@@ -401,4 +419,4 @@ https://lacl.fr/~caubert/notes/portabilite-du-tex.html#dependances
=head1 VERSION
-This is latexpand version v1.2-1-g47e2cee.
+This is latexpand version v1.3.
diff --git a/Build/source/texk/texlive/linked_scripts/texlive/tlmgr.pl b/Build/source/texk/texlive/linked_scripts/texlive/tlmgr.pl
index ddefd2433d4..623749755b0 100755
--- a/Build/source/texk/texlive/linked_scripts/texlive/tlmgr.pl
+++ b/Build/source/texk/texlive/linked_scripts/texlive/tlmgr.pl
@@ -1,13 +1,13 @@
#!/usr/bin/env perl
-# $Id: tlmgr.pl 41476 2016-06-18 00:45:25Z preining $
+# $Id: tlmgr.pl 41794 2016-08-03 23:11:36Z karl $
#
# Copyright 2008-2016 Norbert Preining
# This file is licensed under the GNU General Public License version 2
# or any later version.
#
-my $svnrev = '$Revision: 41476 $';
-my $datrev = '$Date: 2016-06-18 02:45:25 +0200 (Sat, 18 Jun 2016) $';
+my $svnrev = '$Revision: 41794 $';
+my $datrev = '$Date: 2016-08-04 01:11:36 +0200 (Thu, 04 Aug 2016) $';
my $tlmgrrevision;
my $prg;
if ($svnrev =~ m/: ([0-9]+) /) {
@@ -7843,7 +7843,7 @@ search method). Then, unless cryptographic verification has been
disabled, a signature file (C<texlive.tlpdb.*.asc>) of the checksum file
is downloaded and the signature verified. The signature is created by
the TeX Live Distribution GPG key 0x06BAB6BC, which in turn is signed by
-Karl Berry's key 0x9DEB46C0 and Norbert Preining's key 0x6CACA448. All
+Karl Berry's key 0x30D155AD and Norbert Preining's key 0x6CACA448. All
of these keys are obtainable from the standard key servers.
Additional trusted keys can be added using the C<key> action.
diff --git a/Master/texmf-dist/doc/support/latexpand/LICENCE b/Master/texmf-dist/doc/support/latexpand/LICENCE
new file mode 100644
index 00000000000..611d1b65c4e
--- /dev/null
+++ b/Master/texmf-dist/doc/support/latexpand/LICENCE
@@ -0,0 +1,30 @@
+Copyright (c) 2012, 2013, 2014, 2015, 2016,
+ Matthieu Moy <Matthieu.Moy@grenoble-inp.fr>
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+1. Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+2. Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+3. Neither the name of the copyright holder nor the names of its
+contributors may be used to endorse or promote products derived from
+this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/Master/texmf-dist/doc/support/latexpand/README b/Master/texmf-dist/doc/support/latexpand/README
index 9d96208d8ab..6f483696749 100644
--- a/Master/texmf-dist/doc/support/latexpand/README
+++ b/Master/texmf-dist/doc/support/latexpand/README
@@ -46,14 +46,19 @@ USES
GETTING LATEXPAND
The latest version of latexpand is available here:
- https://gitorious.org/latexpand
+ https://gitlab.com/latexpand/latexpand
Versions are uploaded to ctan.org from time to time:
http://www.ctan.org/pkg/latexpand
BUGS
- Please, report bugs to Matthieu Moy <Matthieu.Moy@imag.fr>.
+ Please, report bugs on the issue tracker on the project site:
+
+ https://gitlab.com/latexpand/latexpand/issues
+
+ Alternatively, you may email directly the author: Matthieu Moy
+ <Matthieu.Moy@imag.fr>.
Known bugs
Verbatim
@@ -61,6 +66,9 @@ BUGS
will therefore process any \include, \input, ... directives that appear
within verbatim environments (while it shouldn't).
+ LaTeX comments inside verbatim environments are also incorrectly
+ stripped. You can use --keep-comments as a workaround to avoid this.
+
Comment environment
It would be nice to remove code between \begin{comment} and
\end{comment} too if \usepackage{comment} is used.
@@ -106,5 +114,5 @@ SEE ALSO
https://lacl.fr/~caubert/notes/portabilite-du-tex.html#dependances
VERSION
- This is latexpand version v1.2-1-g47e2cee.
+ This is latexpand version v1.3.
diff --git a/Master/texmf-dist/doc/support/latexpand/version.txt b/Master/texmf-dist/doc/support/latexpand/version.txt
index c3d559da51a..703856d874d 100644
--- a/Master/texmf-dist/doc/support/latexpand/version.txt
+++ b/Master/texmf-dist/doc/support/latexpand/version.txt
@@ -1,2 +1,2 @@
-latexpand version v1.2-1-g47e2cee (47e2ceee9a43e8f7be9be9fc1c5bd191b96820bf).
-Committed on Sun May 24 15:05:43 2015 +0200.
+latexpand version v1.3 (4a4dec71711857554c0b6f5531a5147a47ff2cae).
+Committed on Sat Aug 13 19:51:30 2016 +0200.
diff --git a/Master/texmf-dist/scripts/latexpand/latexpand b/Master/texmf-dist/scripts/latexpand/latexpand
index e8694e7fe25..f98c0ee9598 100755
--- a/Master/texmf-dist/scripts/latexpand/latexpand
+++ b/Master/texmf-dist/scripts/latexpand/latexpand
@@ -1,6 +1,6 @@
#!/usr/bin/perl
# Inspired by latexpand by D. Musliner, University of Michigan
-# 2012, 2013, 2014, 2015: Matthieu Moy <Matthieu.Moy@imag.fr>
+# 2012, 2013, 2014, 2015, 2016: Matthieu Moy <Matthieu.Moy@imag.fr>
# BSD License
use strict;
@@ -53,7 +53,7 @@ sub get_version
{
# $VERSION's value will be substituted by 'make dist', but the
# next line won't (the string has to be broken to avoid it).
- my $VERSION = 'v1.2-1-g47e2cee';
+ my $VERSION = 'v1.3';
if ($VERSION eq '@LATEXPAND' . '_VERSION@') {
my($vol,$dir,$file) = File::Spec->splitpath($0);
chdir($dir);
@@ -78,8 +78,8 @@ if ($empty_comments) {
}
if ($output && $output ne "-") {
- open OUTPUT, '>', "$output" or die $!;
- STDOUT->fdopen(\*OUTPUT, 'w') or die $!;
+ open (my $OUTPUT, '>', "$output") or die $!;
+ STDOUT->fdopen(\*$OUTPUT, 'w') or die $!;
}
sub say
@@ -105,9 +105,8 @@ sub process_file
my $file = shift;
my $prefix = (shift || "");
my $in_comment = 0;
- local(*FILE);
- open(FILE, $file) or die "could not open input file '$file'\n";
- while (my $line = <FILE>) {
+ open(my $FILE, "<", $file) or die "could not open input file '$file'\n";
+ while (my $line = <$FILE>) {
if ($line =~ /^[ \t]*\\endinput/) {
$line =~ s/(\\endinput.*)\n/% $1/;
$in_comment = 1;
@@ -123,17 +122,18 @@ sub process_file
# ignored by LaTeX, but we don't allow anything before
# to avoid e.g. \verb|\end{document}| from terminating
# the file.
- if (!$keep_comments && $line =~ /^[ \t]*\\end{document}/) {
+ if (!$keep_comments && $line =~ /^[ \t]*\\end\{document\}/) {
last;
}
}
- close(FILE);
+ close($FILE);
return $in_comment;
}
sub process_line
{
- my ($_, $prefix, $file) = @_;
+ my ($line, $prefix, $file) = @_;
+ $_ = $line;
# Consider \makeatletter only in preamble, because we do want
# to warn on \someCommand{\makeatletter\command@with@arobase}.
if ($in_preamble && /^[^%]*\\makeatletter/) {
@@ -149,13 +149,23 @@ sub process_line
print STDERR "Warning: consider using --makeatletter if the result is not compilable.\n";
}
unless ($keep_comments) {
- if ($empty_comments) {
- s/^%.*$/%/;
- s/([^\\])%.*$/$1%/;
- } else {
- s/^%.*\n//;
- s/([^\\])%.*\n/$1/;
+ if (!$empty_comments) {
+ # Include \n in pattern to avoid matching
+ # comments at end of files
+
+ # remove comments + whitespace-only lines completely
+ s/^\s*%.*\n//;
+
+ # remove only the comment if the line has actual content
+ s/([^\\])%.*\n/$1\n/;
}
+ # Apply the "empty comments" treatment unconditionally
+ # for end-of-files comments not matched above (it
+ # doesn't harm to keep an empty comment sometimes, but
+ # it may harm to leave a real comment if the goal was
+ # to strip them).
+ s/^%.*$/%/;
+ s/([^\\])%.*$/$1%/;
}
unless ($keep_includes) {
@@ -203,7 +213,7 @@ sub process_line
if ($expand_usepackage) {
# Don't bother with before and after text, we just require the
# usepackage to be alone on its line.
- if (my ($package_name) = /^\s*\\usepackage{([^}]*)}\s*(%.*)?$/) {
+ if (my ($package_name) = /^\s*\\usepackage\{([^\}]*)\}\s*(%.*)?$/) {
my $full = find_file($package_name . ".sty", $TEXINPUTS);
if ($full) {
say $prefix . "Found package file: $full\n";
@@ -216,7 +226,7 @@ sub process_line
}
if ($expand_bbl) {
if (my ($before, $bib_name, $after)
- = /^(.*)\\bibliography{([^}]*)}(.*)$/) {
+ = /^(.*)\\bibliography\{([^\}]*)\}(.*)$/) {
# The BBL file is not necessarily $bib_name.
# Take it from the command-line.
print $before . $nl;
@@ -233,7 +243,7 @@ sub process_line
print STDERR "$full\n";
}
}
- if (/^[ \t]*\\begin{document}/) {
+ if (/^[ \t]*\\begin\{document\}/) {
$in_preamble = 0;
if ($makeatletter) {
print '\makeatletter' . $nl;
@@ -257,7 +267,7 @@ sub find_tex_file
die "ERROR: Could not find file [$file]\n";
} else {
print STDERR "Warning: Could not find file [$file]\n";
- return undef;
+ return;
}
}
@@ -334,7 +344,7 @@ problems by outputing a single LaTeX file that contain no comment.
The latest version of latexpand is available here:
- https://gitorious.org/latexpand
+ https://gitlab.com/latexpand/latexpand
Versions are uploaded to ctan.org from time to time:
@@ -342,7 +352,12 @@ Versions are uploaded to ctan.org from time to time:
=head1 BUGS
-Please, report bugs to Matthieu Moy <Matthieu.Moy@imag.fr>.
+Please, report bugs on the issue tracker on the project site:
+
+ https://gitlab.com/latexpand/latexpand/issues
+
+Alternatively, you may email directly the author: Matthieu Moy
+<Matthieu.Moy@imag.fr>.
=head2 Known bugs
@@ -352,6 +367,9 @@ latexpand currently ignores \begin{verbatim} ... \end{verbatim}, and
will therefore process any \include, \input, ... directives that
appear within verbatim environments (while it shouldn't).
+LaTeX comments inside verbatim environments are also incorrectly
+stripped. You can use --keep-comments as a workaround to avoid this.
+
=head3 Comment environment
It would be nice to remove code between \begin{comment} and
@@ -401,4 +419,4 @@ https://lacl.fr/~caubert/notes/portabilite-du-tex.html#dependances
=head1 VERSION
-This is latexpand version v1.2-1-g47e2cee.
+This is latexpand version v1.3.