summaryrefslogtreecommitdiff
path: root/Master/tlpkg/bin/tl-update-docindex2
diff options
context:
space:
mode:
Diffstat (limited to 'Master/tlpkg/bin/tl-update-docindex2')
-rwxr-xr-xMaster/tlpkg/bin/tl-update-docindex282
1 files changed, 82 insertions, 0 deletions
diff --git a/Master/tlpkg/bin/tl-update-docindex2 b/Master/tlpkg/bin/tl-update-docindex2
new file mode 100755
index 00000000000..db1eaa1499a
--- /dev/null
+++ b/Master/tlpkg/bin/tl-update-docindex2
@@ -0,0 +1,82 @@
+#!/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";
+}
+