summaryrefslogtreecommitdiff
path: root/Master/tlpkg/TeXLive
diff options
context:
space:
mode:
Diffstat (limited to 'Master/tlpkg/TeXLive')
-rw-r--r--Master/tlpkg/TeXLive/TLPOBJ.pm7
-rw-r--r--Master/tlpkg/TeXLive/TeXCatalogue.pm17
2 files changed, 13 insertions, 11 deletions
diff --git a/Master/tlpkg/TeXLive/TLPOBJ.pm b/Master/tlpkg/TeXLive/TLPOBJ.pm
index b73ee0e3cff..9713c87b90a 100644
--- a/Master/tlpkg/TeXLive/TLPOBJ.pm
+++ b/Master/tlpkg/TeXLive/TLPOBJ.pm
@@ -83,7 +83,11 @@ sub from_fh {
my $size;
while (my $line = <$fh>) {
+ # we do not worry about whitespace at the end of a line;
+ # that would be a bug in the db creation, and it takes some
+ # noticeable time to get rid of it. So just chomp.
chomp($line);
+
# we call tllog only when something will be logged, to speed things up.
# this is the inner loop bounding the time to read tlpdb.
dddebug("reading line: >>>$line<<<\n") if ($::opt_verbosity >= 3);
@@ -111,8 +115,7 @@ sub from_fh {
die("Continuation of $lastcmd not allowed, please fix tlpobj: line = $line!\n");
}
}
- # remove white space at the end of a line
- $line =~ s/\s*$//;
+
if ($line =~ /^name\s*([-.\w]+)/o) {
$name = "$1";
$lastcmd = "name";
diff --git a/Master/tlpkg/TeXLive/TeXCatalogue.pm b/Master/tlpkg/TeXLive/TeXCatalogue.pm
index 95ba60442a1..34f7a7f512b 100644
--- a/Master/tlpkg/TeXLive/TeXCatalogue.pm
+++ b/Master/tlpkg/TeXLive/TeXCatalogue.pm
@@ -1,6 +1,6 @@
# $Id$
# TeXLive::TeXCatalogue - module for accessing the TeX Catalogue
-# Copyright 2007, 2008, 2009, 2010 Norbert Preining
+# Copyright 2007, 2008, 2009, 2010, 2011 Norbert Preining
# This file is licensed under the GNU General Public License version 2
# or any later version.
#
@@ -88,15 +88,15 @@ sub initialize {
}
}
-sub beautify
-{
+sub beautify {
my ($txt) = @_;
- $txt =~ s/\n/ /g;
- $txt =~ s/^[[:space:]]*//g;
- $txt =~ s/[[:space:]][[:space:]]*/ /g;
+ $txt =~ s/\n/ /g; # make one line
+ $txt =~ s/^\s+//g; # rm leading whitespace
+ $txt =~ s/\s+$//g; # rm trailing whitespace
+ $txt =~ s/\s\s+/ /g; # multiple spaces to one
# transliterate to ascii: it allows the final tlpdb to be pure ascii,
# avoiding problems since we don't control the user's terminal encoding
- return(Text::Unidecode::unidecode($txt));
+ return Text::Unidecode::unidecode($txt);
}
sub name {
@@ -197,8 +197,7 @@ sub initialize {
# Copy every catalogue $entry under the name $entry->{'texlive'}
# if it makes sense.
#
-sub quest4texlive
-{
+sub quest4texlive {
my $self = shift;
# The catalogue has a partial mapping from catalogue entries to