#! /usr/bin/perl # Java API Documentation to DevHelp Book Converter # Copyright (C) 2002 Ross Burton # Licensed under the GPL, version 2 (or above) # Version 1.1, released 20021107 # Revision History # 1.1: changed to to keep Devhelp 2 happy. # 1.0: initial release # Argument checking -- I expect a single argument, the path to the # .../doc/api directory (e.g "/opt/j2sdk1.4.1/docs/api/") die "The arguments should be the path to the JDK doc/api directory" unless $#ARGV == 0; # The root of the documentation tree $root = shift; # DevHelp header. Still not sure what the base element is actually # used for. print < EOF # Table of Contents # TODO: at some point in the distant future, parse this lot into a # tree and then write it out, so that java, javax, org, etc are the # top-level chapters, and then there are sub-chapters below such as # lang, io, awt. open PACKAGES, "<$root/package-list" or die "Cannot open $root/package-list: $!"; print "\n"; while () { chomp; $tree = join('/', split '\.', $_); print " \n"; open FILE, "<$root/$tree/package-frame.html" or die "Cannot open $root/$path/package-frame.html: $!"; while () { next unless m|(.*)|; ($filename, $class) = ($1, $2); next if $filename =~ m|/package-summary.html|; $class = "$1 (I)" if ($class =~ m|(.+)|) ; print " \n"; } close FILE; print " \n"; print $package; } print "\n\n"; close PACKAGES; # Function and Class index print "\n"; # Run through the Java index files for $i (1..27) { open INDEX, "<$root/index-files/index-$i.html" or die "Cannot open $root/index-files/index-$i.html: $!"; while () { chomp; next unless m|
([^\<]+)|; ($link, $method) = ($1, $2); $link =~ s|^\.\./||; # TODO: work out the class and include that print " \n"; } close INDEX; } print "\n"; # Footer print "\n";