X-Git-Url: https://git.openafs.org/?p=openafs.git;a=blobdiff_plain;f=doc%2Fman-pages%2Fgenerate-html;h=d46c80fbb805adbe6a3313cbe7c09e31201a19ed;hp=e4ccd136616f8b9e15c240ae1c683704b93fb906;hb=070e90a92175eb91b3709598859fabb0c843d0a9;hpb=6321cca1a5bdda2c9e8d9688d220eff0edd850f9 diff --git a/doc/man-pages/generate-html b/doc/man-pages/generate-html index e4ccd13..d46c80f 100755 --- a/doc/man-pages/generate-html +++ b/doc/man-pages/generate-html @@ -7,6 +7,28 @@ use vars qw(@ISA); use Pod::Simple::Search; @ISA = qw(Pod::Simple::HTML); +# Add a link back to the index page to the top and bottom of each generated +# page. +# +# The hideous approach we have to use is because, unless we create a +# Pod::Simple::HTML object and then rebless it, the html_header_after_title +# and html_footer subs are placed in the OpenAFS::HTML package. That means we +# can't override them in a subclass and still call the SUPER version since +# we'll be overwriting the SUPER version, and there aren't other good +# opportunities to change the default values that I can see. +sub new { + my $class = shift; + my $self = Pod::Simple::HTML->new (@_); + bless ($self, 'OpenAFS::HTML'); + my $link = '' . "\n"; + my $after = $self->html_header_after_title; + $self->html_header_after_title ($after . $link); + my $end = $self->html_footer; + $self->html_footer ($link . $end); + return $self; +} + sub do_man_link { my ($self, $token) = @_; my $page = $token->attr ('to'); @@ -37,6 +59,24 @@ $Pod::Simple::HTML::Tagmap{'/item-bullet'} = '

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

  • '; +# This horrific hack is required because Pod::Simple::HTMLBatch has no way +# of setting search options and we have to set laborious to true in order +# to pick up man pages like krb.conf(5). +package OpenAFS::Search; + +use strict; +use vars qw(@ISA); + +use Pod::Simple::Search; +@ISA = qw(Pod::Simple::HTML); + +sub new { + my $class = shift; + my $object = Pod::Simple::Search->new; + $object->laborious (1); + return $object; +} + package main; use strict; @@ -44,6 +84,9 @@ use strict; use File::Copy; use Pod::Simple::HTMLBatch; +# Override the search class to set laborious. +$Pod::Simple::HTMLBatch::SEARCH_CLASS = 'OpenAFS::Search'; + our $HEADER = <<'EOH'; @@ -55,6 +98,7 @@ our $HEADER = <<'EOH'; EOH our %HEADINGS = (1 => 'User Commands', + 3 => 'C Library Functions', 5 => 'Configuration and Data Files', 8 => 'Administrator Commands'); @@ -62,11 +106,11 @@ our %HEADINGS = (1 => 'User Commands', # description, returning that as an array. sub scan_names { my @index; - for my $dir (qw(pod1 pod5 pod8)) { + for my $dir (qw(pod1 pod3 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) { + for my $file (sort grep { !/^\./ && /\.pod$/ } readdir D) { open (F, "$dir/$file") or die "Cannot open $dir/$file: $!\n"; my ($name, $desc); local $_; @@ -78,6 +122,13 @@ sub scan_names { unless ($name) { warn "$dir/$file: cannot find NAME section, skipping\n"; } + $name =~ s/^(backup|bos|fs|fstrace|kas|pts|symlink|uss|vos)_/$1 /; + if ($section eq '3') { + $name =~ s/^AFS\./AFS::/; + } + if ($section eq '5') { + $name =~ s/_/ /g; + } my $page = $file; $page =~ s/\.pod$//; push (@index, [ $section, $name, $page, $desc ]); @@ -90,7 +141,7 @@ sub scan_names { unless (-d 'html') { mkdir ('html', 0755) or die "Cannot create html directory: $!\n"; } -for my $dir (qw(pod1 pod5 pod8)) { +for my $dir (qw(pod1 pod3 pod5 pod8)) { my $section = $dir; $section =~ s/^pod//; mkdir ("html/$section", 0755) unless -d "html/$section";