#!/usr/bin/perl -w package OpenAFS::HTML; use strict; use vars qw(@ISA); use Pod::Simple::Search; @ISA = qw(Pod::Simple::HTML); sub do_man_link { my ($self, $token) = @_; my $page = $token->attr('to'); my ($name, $section) = ($page =~ /^([^\(]+)\((\d+)\)$/); return unless $name; my @url = ('..', $section, $name); return join ('/', map { $self->pagepath_url_escape ($_) } @url) . $Pod::Simple::HTML::HTML_EXTENSION; } sub VERSION () { '1.0' } $Pod::Simple::HTML::Tagmap{'item-bullet'} = '
  • '; $Pod::Simple::HTML::Tagmap{'/item-bullet'} = '

  • '; $Pod::Simple::HTML::Tagmap{'item-number'} = '
  • '; $Pod::Simple::HTML::Tagmap{'/item-number'} = '

  • '; package main; use strict; use File::Copy; use Pod::Simple::HTMLBatch; our $HEADER = <<'EOH'; OpenAFS Reference Manual

    OpenAFS Reference Manual

    EOH our %HEADINGS = (1 => 'User Commands', 5 => 'Configuration and Data Files', 8 => 'Administrator Commands'); # Scan all of the POD files and build a list of section, name, and short # description, returning that as an array. sub scan_names { my @index; for my $dir (qw(pod1 pod5 pod8)) { my $section = $dir; $section =~ s/^pod//; opendir (D, $dir) or die "Cannot open $dir: $!\n"; for my $file (sort grep { !/^\./ && !/CVS/ } readdir D) { open (F, "$dir/$file") or die "Cannot open $dir/$file: $!\n"; my ($name, $desc); local $_; while () { last if /^=head1/ && !/^=head1\s+NAME\b/; next unless /\s+-\s+/; ($name, $desc) = split (/\s+-\s+/, $_, 2); } unless ($name) { warn "$dir/$file: cannot find NAME section, skipping\n"; } my $page = $file; $page =~ s/\.pod$//; push (@index, [ $section, $name, $page, $desc ]); } closedir D; } return @index; } unless (-d 'html') { mkdir ('html', 0755) or die "Cannot create html directory: $!\n"; } for my $dir (qw(pod1 pod5 pod8)) { my $section = $dir; $section =~ s/^pod//; mkdir ("html/$section", 0755) unless -d "html/$section"; my $conv = Pod::Simple::HTMLBatch->new; $conv->verbose (0); $conv->index (undef); $conv->contents_file (undef); $conv->add_css ('../style.css', 1); $conv->css_flurry (0); $conv->javascript_flurry (0); $conv->html_render_class ('OpenAFS::HTML'); $conv->batch_convert ($dir, "html/$section"); } copy ('style.css', 'html/style.css') or die "Cannot copy style.css: $!\n"; open (INDEX, '> html/index.html') or die "Cannot create html/index.html: $!\n"; print INDEX $HEADER; print INDEX "\n"; my @index = scan_names; my $current; for my $entry (@index) { my ($section, $name, $page, $desc) = @$entry; for ($name, $desc) { s/&/>/g; s//>/g; } if (!$current || $section != $current) { print INDEX qq(\n); print INDEX qq(\n); $current = $section; } print INDEX qq(); print INDEX qq(\n); } print INDEX "
     
    ); print INDEX qq($HEADINGS{$section}
    $name$desc
    \n\n\n";