diff options
author | Karl Berry <karl@freefriends.org> | 2020-03-08 23:14:29 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2020-03-08 23:14:29 +0000 |
commit | af31270c6a68a0ae081b65e64de04a17102c22d1 (patch) | |
tree | 8f8d32b78ca3b50d5c9b21fb2e68b30c9a4b67e1 /Master/tlpkg/TeXLive | |
parent | e37a10a245d451656a9bd183aded368a8f41e547 (diff) |
TLPSRC.pm (from_file),
TeXCatalogue.pm (beautify): kludge around long url being forcibly broken
by our multilineformat.
tl-update-tlpdb: new option --catalogue-dump to dump/restore catalogue
data for development.
git-svn-id: svn://tug.org/texlive/trunk@54190 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg/TeXLive')
-rw-r--r-- | Master/tlpkg/TeXLive/TLPSRC.pm | 2 | ||||
-rw-r--r-- | Master/tlpkg/TeXLive/TeXCatalogue.pm | 22 |
2 files changed, 20 insertions, 4 deletions
diff --git a/Master/tlpkg/TeXLive/TLPSRC.pm b/Master/tlpkg/TeXLive/TLPSRC.pm index 66c3aed24fc..730ffc5a21f 100644 --- a/Master/tlpkg/TeXLive/TLPSRC.pm +++ b/Master/tlpkg/TeXLive/TLPSRC.pm @@ -240,6 +240,8 @@ sub from_file { $shortdesc =~ s/\s+$//g; # rm trailing whitespace (shortdesc) $longdesc =~ s/\s+$//g; # rm trailing whitespace (longdesc) $longdesc =~ s/\s\s+/ /g; # collapse multiple whitespace characters to one + # see comments in beautify. + $longdesc =~ s,http://grants.nih.gov/,grants.nih.gov/,g; # $self->name($name); $self->category($category); diff --git a/Master/tlpkg/TeXLive/TeXCatalogue.pm b/Master/tlpkg/TeXLive/TeXCatalogue.pm index 9f422ceaaed..2666c17629e 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-2019 Norbert Preining +# Copyright 2007-2020 Norbert Preining # This file is licensed under the GNU General Public License version 2 # or any later version. # @@ -137,14 +137,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; # collapse multiple whitespace characters to one $txt =~ s/\t/ /g; # tabs to spaces - # 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); + + # 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 { |