summaryrefslogtreecommitdiff
path: root/Master/tlpkg/bin
diff options
context:
space:
mode:
authorManuel Pégourié-Gonnard <mpg@elzevir.fr>2009-10-09 01:22:26 +0000
committerManuel Pégourié-Gonnard <mpg@elzevir.fr>2009-10-09 01:22:26 +0000
commitc0254b173189cdc9fafddf12b719a9ed84edb88a (patch)
treeaa0eaca479b53d1e76cd2e87e925964ce6cba207 /Master/tlpkg/bin
parent93a144dad95d54662ef0c43a2f2fc00c7893898e (diff)
Adopt the new version of tl-update-docindex.
git-svn-id: svn://tug.org/texlive/trunk@15712 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg/bin')
-rwxr-xr-xMaster/tlpkg/bin/tl-update-docindex204
-rwxr-xr-xMaster/tlpkg/bin/tl-update-docindex282
-rwxr-xr-xMaster/tlpkg/bin/tl-update-docindex393
3 files changed, 102 insertions, 277 deletions
diff --git a/Master/tlpkg/bin/tl-update-docindex b/Master/tlpkg/bin/tl-update-docindex
index 03bcffcf03c..8b943095c6e 100755
--- a/Master/tlpkg/bin/tl-update-docindex
+++ b/Master/tlpkg/bin/tl-update-docindex
@@ -1,124 +1,124 @@
#!/usr/bin/env perl
# $Id$
# Make index file of all HTML and PDF documentation (printed on stdout).
-# Originally written 2004, Karl Berry. Public domain.
-
-exit (&main ());
-
-sub main
-{
- (my $progname = $0) =~ s,^.*/,,;
- umask (0);
- $ENV{'LC_ALL'} = 'C'; # for the date command used below
-
- chomp (my $mydir = `dirname $0`);
- chdir ("$mydir/../..") || exit 1; # Master
-
- # shell fragment we use to find doc files in a directory.
- $ENV{"_POSIX2_VERSION"} = 0; # POSIX likes to be backward-incompatible
- $FIND_POST = " \\( -name \\*.html -o -name \\*.pdf \\) "
- . " | tee /tmp/doclist"
- . " | sort -f -t/ +2 |";
-
- print <<END_HEADER;
-<html>
+# Originally written 2009, Manuel Pégourié-Gonnard. WTFPL v2.
+
+BEGIN {
+ $0 =~ m#(.*)/(.*)#; ($progdir, $progname) = ($1, $2);
+ unshift @INC, "$progdir/..";
+}
+
+use warnings FATAL => 'all';
+use Fatal qw(:void open close opendir closedir chdir mkdir);
+
+use TeXLive::TLPDB;
+use File::Basename;
+
+exit(main());
+
+sub main {
+ my $tlpdb = TeXLive::TLPDB->new('root' => "$progdir/../..");
+ die "$progname: unable to load TLPDB\n" unless defined $tlpdb;
+
+ print <<END_HEADER;
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>TeX Live documentation</title>
+ <style type="text/css"> ol { padding-left: 4em } </style>
+</head>
<body>
<h1>TeX Live documentation</h1>
<p>This document lists links to all HTML and PDF files for packages and guides
-contained in TeX Live (in the <a href="texmf/">texmf</a> and <a
-href="texmf-dist/">texmf-dist</a> directories), sorted by package name.</p>
+contained in TeX Live, sorted by package name.</p>
END_HEADER
- &do_package_list ();
-
- chomp (my $date = `date`);
- print <<END_TRAILER;
-<hr>
+ print_all_pkg($tlpdb);
+
+ # print footer
+ chomp (my $date = `LC_ALL=C date`);
+ print <<END_TRAILER;
+<hr />
<small>Generated $date by $progname.</small>
</body></html>
END_TRAILER
-
- return 0;
-}
-
-
-# Package doc (texmf and texmf-dist), by package.
-#
-sub do_package_list
-{
- &do_filelist ("find texmf/doc texmf-dist/doc $FIND_POST");
+ return 0;
}
+# print the links for letters, then packages
+sub print_all_pkg {
+ my ($tlpdb) = @_;
-
-# Process all files resulting from OPENCMD.
-#
-sub do_filelist
-{
- my ($opencmd) = @_;
-
- print "\n<ol>\n";
- my $prevdir = "";
- my @entries = ();
-
- $FILELIST = $opencmd;
- open (FILELIST) || die "open($FILELIST) failed: $!";
- while (<FILELIST>) {
- chomp;
- # collect all files for a given directory
- (my $thisdir = $_) =~ s,/[^/]*$,,;
-
- if ($thisdir eq $prevdir) {
- push (@entries, $_);
- } else {
- &do_directory ($prevdir, @entries) if $prevdir; # avoid first empty
- $prevdir = $thisdir;
- @entries = ($_);
+ # @lines is the big list, @letters the list of initials of package names
+ local (@lines, @letters, $current_letter, $n);
+ $current_letter = "\0";
+
+ # first build the output and the list of initials
+ for my $tlpn (sort {lc $a cmp lc $b} $tlpdb->list_packages) {
+ my $tlpkg = $tlpdb->get_package($tlpn);
+ push_pkg_list($tlpkg);
}
- }
- close (FILELIST) || warn "close($FILELIST) failed: $!";
-
- &do_directory ($prevdir, @entries); # include last
+ push @lines, "\n</ol>\n\n";
- print "\n</ol>\n";
+ # then actually print them
+ my $access = "\n<p>" . join(" - ", @letters) . "</p>\n";
+ print $access;
+ print @lines;
+ print $access;
}
+# push the content for a package to the list of lines
+sub push_pkg_list {
+ my ($tlpkg) = @_;
+ my $name = $tlpkg->name;
+ my @docfiles = $tlpkg->docfiles;
+
+ # if no adequate documentation is found, print nothing
+ @docfiles = grep { m/\.(html|pdf)/ } @docfiles;
+ return if @docfiles == 0;
+ $n++; # list counter
+
+ # check initial
+ my $init = uc substr $name, 0, 1;
+ unless ($init eq $current_letter) {
+ $current_letter = $init;
+ # put header in the big list...
+ push @lines, "\n</ol>\n" unless $n == 1;
+ push @lines, qq#\n<h2 id="letter-$init">$init</h2>\n#;
+ push @lines, qq#\n<ol start="$n">\n#;
+ # ... and a reference in quick access list
+ push @letters, qq!<a href="#letter-$init">$init</a>!;
+ }
+
+ # if there is an index.html file, drop the rest
+ # currently (2009-10-07) catches: FAQ-en bosisio epspdf fontname jadetex
+ # metapost ppower4 sttools tds tex4ht
+ my @index = grep /\/index\.html/, @docfiles;
+ if (@index == 1) {
+ #warn "Using index.html for $name\n";
+ @docfiles = @index;
+ }
-
-# Print doc ENTRIES in DIR.
-#
-sub do_directory
-{
- my ($dir,@entries) = @_;
-
- # $dir includes the texmf tree, e.g.,
- # texmf-dist/doc/allrunes
- # This is too ugly. We just want to show allrunes, especially since
- # that's what we sorted by.
- my (undef,undef,$nicename) = split (/\//, $dir, 3);
-
- print qq!<li><b><a href="$dir">$nicename</a>!;
-
- # if we have an index.html or a live.html, make things nicer.
- if (grep { m,/(index|live)\.html$, } @entries) {
- # first remove all .html's.
- @entries = grep { $_ !~ /\.html$/
- || $_ =~ m,/(index|live)\.html, } @entries;
-
- # if only one entry left, remove it, the directory link suffices.
- @entries = () if $entries[0] =~ m,/index\.html$, && @entries == 1;
- }
-
- # if we're going to print anything, insert punctuation.
- print ":" if @entries;
- print "</b><small>\n";
-
- for my $e (@entries) {
- (my $basename = $e) =~ s,.*/,,;
- print qq! <a href="$e">$basename</a>\n!;
- }
-
- print " </small>\n\n";
+ # print package name with shortdesc
+ my $dir = dirname($docfiles[0]);
+ push @lines, qq#\n<li><b><a href="$dir">$name</a></b>:<small>\n#;
+ my $shortdesc = $tlpkg->shortdesc;
+ push @lines, "$shortdesc\n" if defined $shortdesc;
+ #warn "$name\n" if not defined $shortdesc;
+
+ # now the list of docfiles
+ my $list;
+ for my $file (@docfiles) {
+ my $name = basename($file);
+ $list .= qq#<a href="$file">$name</a>#;
+ my $dflanguage = $tlpkg->{'docfiledata'}{$file}{'language'};
+ $list .= " ($dflanguage)" if defined $dflanguage;
+ $list .= ",\n";
+ }
+ $list =~ s/,\n$/./;
+ push @lines, "$list\n</small></li>\n";
}
+
diff --git a/Master/tlpkg/bin/tl-update-docindex2 b/Master/tlpkg/bin/tl-update-docindex2
deleted file mode 100755
index 724e47e2cf0..00000000000
--- a/Master/tlpkg/bin/tl-update-docindex2
+++ /dev/null
@@ -1,82 +0,0 @@
-#!/usr/bin/env perl
-# $Id$
-# Make index file of all HTML and PDF documentation (printed on stdout).
-# Originally written 2009, Manuel Pégourié-Gonnard. WTFPL v2.
-
-BEGIN {
- $0 =~ m#(.*)/(.*)#; ($progdir, $progname) = ($1, $2);
- unshift @INC, "$progdir/..";
-}
-
-use warnings FATAL => 'all';
-use Fatal qw(:void open close opendir closedir chdir mkdir);
-
-use TeXLive::TLPDB;
-use File::Basename;
-
-exit(main());
-
-sub main {
-
- my $tlpdb = TeXLive::TLPDB->new('root' => "$progdir/../..");
- die "$progname: unable to load TLPDB\n" unless defined $tlpdb;
-
- print <<END_HEADER;
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
- <title>TeX Live documentation</title>
- <style type="text/css"> ol { padding-left: 4em } </style>
-</head>
-<body>
-<h1>TeX Live documentation</h1>
-
-<p>This document lists links to all HTML and PDF files for packages and guides
-contained in TeX Live, sorted by TeX Live package name.</p>
-END_HEADER
-
- # actually print the list
- print "\n<ol>\n";
- for my $tlpn ($tlpdb->list_packages) {
- my $tlpkg = $tlpdb->get_package($tlpn);
- print_pkg_list($tlpkg->name, $tlpkg->docfiles);
- }
- print "\n</ol>\n\n";
-
- # print footer
- chomp (my $date = `LC_ALL=C date`);
- print <<END_TRAILER;
-<hr />
-<small>Generated $date by $progname.</small>
-</body></html>
-END_TRAILER
-
- return 0;
-}
-
-sub print_pkg_list {
- my ($name, @docfiles) = @_;
-
- # if no adequate documentation is found, print nothing
- @docfiles = grep { m/\.(html|pdf)/ } @docfiles;
- return if @docfiles == 0;
-
- # if there is an index.html file, drop the rest
- # currently (2009-10-07) catches: FAQ-en bosisio epspdf fontname jadetex
- # metapost ppower4 sttools tds tex4ht
- my @index = grep /\/index\.html/, @docfiles;
- if (@index == 1) {
- #warn "Using index.html for $name\n";
- @docfiles = @index;
- }
-
- # now print the list
- print "\n<li><b>$name</b>:<small>\n";
- for my $file (@docfiles) {
- my $name = basename($file);
- print qq! <a href="$file">$name</a>\n!;
- }
- print "</small></li>\n";
-}
-
diff --git a/Master/tlpkg/bin/tl-update-docindex3 b/Master/tlpkg/bin/tl-update-docindex3
deleted file mode 100755
index b00f708174a..00000000000
--- a/Master/tlpkg/bin/tl-update-docindex3
+++ /dev/null
@@ -1,93 +0,0 @@
-#!/usr/bin/env perl
-# $Id: tl-update-docindex2 15670 2009-10-07 15:28:42Z mpg $
-# Make index file of all HTML and PDF documentation (printed on stdout).
-# Originally written 2009, Manuel Pégourié-Gonnard. WTFPL v2.
-
-BEGIN {
- $0 =~ m#(.*)/(.*)#; ($progdir, $progname) = ($1, $2);
- unshift @INC, "$progdir/..";
-}
-
-use warnings FATAL => 'all';
-use Fatal qw(:void open close opendir closedir chdir mkdir);
-
-use TeXLive::TLPDB;
-use File::Basename;
-
-exit(main());
-
-sub main {
-
- my $tlpdb = TeXLive::TLPDB->new('root' => "$progdir/../..");
- die "$progname: unable to load TLPDB\n" unless defined $tlpdb;
-
- print <<END_HEADER;
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
- <title>TeX Live documentation</title>
- <style type="text/css"> ol { padding-left: 4em } </style>
-</head>
-<body>
-<h1>TeX Live documentation</h1>
-
-<p>This document lists links to all HTML and PDF files for packages and guides
-contained in TeX Live, sorted by TeX Live package name.</p>
-END_HEADER
-
- # actually print the list
- print "\n<ol>\n";
- for my $tlpn ($tlpdb->list_packages) {
- my $tlpkg = $tlpdb->get_package($tlpn);
- print_pkg_list($tlpkg);
- }
- print "\n</ol>\n\n";
-
- # print footer
- chomp (my $date = `LC_ALL=C date`);
- print <<END_TRAILER;
-<hr />
-<small>Generated $date by $progname.</small>
-</body></html>
-END_TRAILER
-
- return 0;
-}
-
-sub print_pkg_list {
- my ($tlpkg) = @_;
- my $name = $tlpkg->name;
- my @docfiles = $tlpkg->docfiles;
-
- # if no adequate documentation is found, print nothing
- @docfiles = grep { m/\.(html|pdf)/ } @docfiles;
- return if @docfiles == 0;
-
- # if there is an index.html file, drop the rest
- # currently (2009-10-07) catches: FAQ-en bosisio epspdf fontname jadetex
- # metapost ppower4 sttools tds tex4ht
- my @index = grep /\/index\.html/, @docfiles;
- if (@index == 1) {
- #warn "Using index.html for $name\n";
- @docfiles = @index;
- }
-
- # now print the list
- print "\n<li><b>$name</b>:<small>\n";
- for my $file (@docfiles) {
- my $name = basename($file);
- my $dfdetails = $tlpkg->{'docfiledata'}{$file}{'details'};
- my $dflanguage = $tlpkg->{'docfiledata'}{$file}{'language'};
- my @foo;
- push @foo, $dflanguage if defined($dflanguage);
- push @foo, $dfdetails if defined($dfdetails);
- print qq! <a href="$file">$name</a>!;
- if (@foo) {
- print "(", join(",", @foo), ")";
- }
- print "\n";
- }
- print "</small></li>\n";
-}
-