summaryrefslogtreecommitdiff
path: root/systems/texlive/tlnet/tlpkg/TeXLive/TeXCatalogue.pm
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2020-04-11 03:09:12 +0000
committerNorbert Preining <norbert@preining.info>2020-04-11 03:09:12 +0000
commitc2697fc286a1e2c94fd9968b76be6f4a6d2114cd (patch)
tree1dc2cfb07cb032740483dd8be7c74aff66b70352 /systems/texlive/tlnet/tlpkg/TeXLive/TeXCatalogue.pm
parent25111608e6aa05042b0c6f83009262e1973d7a45 (diff)
CTAN sync 202004110309
Diffstat (limited to 'systems/texlive/tlnet/tlpkg/TeXLive/TeXCatalogue.pm')
-rw-r--r--systems/texlive/tlnet/tlpkg/TeXLive/TeXCatalogue.pm41
1 files changed, 33 insertions, 8 deletions
diff --git a/systems/texlive/tlnet/tlpkg/TeXLive/TeXCatalogue.pm b/systems/texlive/tlnet/tlpkg/TeXLive/TeXCatalogue.pm
index ad54929075..8d9b31729d 100644
--- a/systems/texlive/tlnet/tlpkg/TeXLive/TeXCatalogue.pm
+++ b/systems/texlive/tlnet/tlpkg/TeXLive/TeXCatalogue.pm
@@ -1,6 +1,6 @@
-# $Id: TeXCatalogue.pm 53204 2019-12-21 23:18:19Z karl $
+# $Id: TeXCatalogue.pm 54367 2020-03-16 22:59:15Z preining $
# TeXLive::TeXCatalogue - module for accessing the TeX Catalogue
-# Copyright 2007-2019 Norbert Preining
+# Copyright 2007-2020 Norbert Preining
# This file is licensed under the GNU General Public License version 2
# or any later version.
#
@@ -13,7 +13,7 @@ use Text::Unidecode;
package TeXLive::TeXCatalogue::Entry;
-my $svnrev = '$Revision: 53204 $';
+my $svnrev = '$Revision: 54367 $';
my $_modulerevision = ($svnrev =~ m/: ([0-9]+) /) ? $1 : "unknown";
sub module_revision { return $_modulerevision; }
@@ -81,7 +81,17 @@ sub initialize {
$self->{'name'} = $parser->findvalue("/entry/name")->value();
$self->{'caption'} = beautify($parser->findvalue("/entry/caption")->value());
$self->{'description'} = beautify($parser->findvalue("/entry/description")->value());
- $self->{'license'} = $parser->findvalue('/entry/license/@type')->value();
+ # there can be multiple entries of licenses, collected them all
+ # into one string
+ my $licset = $parser->find('/entry/license');
+ my @liclist;
+ foreach my $node ($licset->get_nodelist) {
+ my $lictype = $parser->find('./@type',$node);
+ push @liclist, "$lictype";
+ }
+ $self->{'license'} = join(' ', @liclist);
+ # was before
+ # $self->{'license'} = $parser->findvalue('/entry/license/@type')->value();
$self->{'version'} = Text::Unidecode::unidecode(
$parser->findvalue('/entry/version/@number')->value());
$self->{'ctan'} = $parser->findvalue('/entry/ctan/@path')->value();
@@ -137,13 +147,28 @@ sub initialize {
sub beautify {
my ($txt) = @_;
+ # transliterate to ascii: it allows the final tlpdb to be pure ascii,
+ # avoiding problems since we don't control the user's terminal encoding
+ # Do first in case spaces are output by the transliteration.
+ $txt = Text::Unidecode::unidecode($txt);
+ #
$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);
+ $txt =~ s/\s\s+/ /g; # collapse multiple whitespace characters to one
+ $txt =~ s/\t/ /g; # tabs to spaces
+
+ # one last bit of horribleness: there is one url in the descriptions
+ # which is longer than our multilineformat format (in TLPOBJ). The
+ # result is that it is forcibly broken. Apparently there is no way in
+ # Perl to override that. This makes it impossible to get identical
+ # longdesc results. Turns out that removing the "http://" prefix
+ # shortens it enough to fit, so do that. The better solution would be
+ # to use Text::Wrap or some other text-filling code, but going for
+ # quick and dirty here.
+ $txt =~ s,http://grants.nih.gov/,grants.nih.gov/,g;
+
+ return $txt;
}
sub name {