7 use Pod::Simple::Search;
8 @ISA = qw(Pod::Simple::HTML);
10 # Add a link back to the index page to the top and bottom of each generated
13 # The hideous approach we have to use is because, unless we create a
14 # Pod::Simple::HTML object and then rebless it, the html_header_after_title
15 # and html_footer subs are placed in the OpenAFS::HTML package. That means we
16 # can't override them in a subclass and still call the SUPER version since
17 # we'll be overwriting the SUPER version, and there aren't other good
18 # opportunities to change the default values that I can see.
21 my $self = Pod::Simple::HTML->new (@_);
22 bless ($self, 'OpenAFS::HTML');
23 my $link = '<p class="indexlink"><a href="../index.html">'
24 . 'Back to Index</a></p>' . "\n";
25 my $after = $self->html_header_after_title;
26 $self->html_header_after_title ($after . $link);
27 my $end = $self->html_footer;
28 $self->html_footer ($link . $end);
33 my ($self, $token) = @_;
34 my $page = $token->attr ('to');
35 my ($name, $section) = ($page =~ /^([^\(]+)\((\d+)\)$/);
37 my @url = ('..', $section, $name);
38 return join ('/', map { $self->pagepath_url_escape ($_) } @url)
39 . $Pod::Simple::HTML::HTML_EXTENSION;
42 # Underscore isn't allowed in man page names in Pod::Simple 3.04, so links
43 # like L<fs_setacl(8)> show up as POD links. Discover that case and dispatch
44 # everything else to the standard do_pod_link implementation.
46 my ($self, $token) = @_;
47 my $target = $token->attr ('to');
48 if ($target && $target =~ /^([^\s\(]+)\((\d+)\)$/) {
49 return $self->do_man_link ($token);
51 return $self->SUPER::do_pod_link ($token);
55 sub VERSION () { '1.1' }
57 $Pod::Simple::HTML::Tagmap{'item-bullet'} = '<li><p>';
58 $Pod::Simple::HTML::Tagmap{'/item-bullet'} = '</p></li>';
59 $Pod::Simple::HTML::Tagmap{'item-number'} = '<li><p>';
60 $Pod::Simple::HTML::Tagmap{'/item-number'} = '</p></li>';
67 use Pod::Simple::HTMLBatch;
69 our $HEADER = <<'EOH';
72 <title>OpenAFS Reference Manual</title>
73 <link rel="stylesheet" title="style" type="text/css" href="style.css" media="all">
75 <body class='contentspage'>
76 <h1>OpenAFS Reference Manual</h1>
79 our %HEADINGS = (1 => 'User Commands',
80 5 => 'Configuration and Data Files',
81 8 => 'Administrator Commands');
83 # Scan all of the POD files and build a list of section, name, and short
84 # description, returning that as an array.
87 for my $dir (qw(pod1 pod5 pod8)) {
90 opendir (D, $dir) or die "Cannot open $dir: $!\n";
91 for my $file (sort grep { !/^\./ && !/CVS/ } readdir D) {
92 open (F, "$dir/$file") or die "Cannot open $dir/$file: $!\n";
96 last if /^=head1/ && !/^=head1\s+NAME\b/;
97 next unless /\s+-\s+/;
98 ($name, $desc) = split (/\s+-\s+/, $_, 2);
101 warn "$dir/$file: cannot find NAME section, skipping\n";
105 push (@index, [ $section, $name, $page, $desc ]);
113 mkdir ('html', 0755) or die "Cannot create html directory: $!\n";
115 for my $dir (qw(pod1 pod5 pod8)) {
117 $section =~ s/^pod//;
118 mkdir ("html/$section", 0755) unless -d "html/$section";
120 my $conv = Pod::Simple::HTMLBatch->new;
122 $conv->index (undef);
123 $conv->contents_file (undef);
124 $conv->add_css ('../style.css', 1);
125 $conv->css_flurry (0);
126 $conv->javascript_flurry (0);
127 $conv->html_render_class ('OpenAFS::HTML');
128 $conv->batch_convert ($dir, "html/$section");
130 copy ('style.css', 'html/style.css') or die "Cannot copy style.css: $!\n";
132 open (INDEX, '> html/index.html')
133 or die "Cannot create html/index.html: $!\n";
135 print INDEX "<table>\n";
136 my @index = scan_names;
138 for my $entry (@index) {
139 my ($section, $name, $page, $desc) = @$entry;
145 if (!$current || $section != $current) {
146 print INDEX qq(<tr><td> </td></tr>\n);
147 print INDEX qq(<tr class="heading"><th colspan="2">);
148 print INDEX qq($HEADINGS{$section}</th></tr>\n);
151 print INDEX qq(<tr><td><a href="$section/$page.html">$name</a></td>);
152 print INDEX qq(<td>$desc</td></tr>\n);
154 print INDEX "</table>\n</body>\n</html>\n";