7 use Pod::Simple::Search;
8 @ISA = qw(Pod::Simple::HTML);
11 my ($self, $token) = @_;
12 my $page = $token->attr ('to');
13 my ($name, $section) = ($page =~ /^([^\(]+)\((\d+)\)$/);
15 my @url = ('..', $section, $name);
16 return join ('/', map { $self->pagepath_url_escape ($_) } @url)
17 . $Pod::Simple::HTML::HTML_EXTENSION;
20 # Underscore isn't allowed in man page names in Pod::Simple 3.04, so links
21 # like L<fs_setacl(8)> show up as POD links. Discover that case and dispatch
22 # everything else to the standard do_pod_link implementation.
24 my ($self, $token) = @_;
25 my $target = $token->attr ('to');
26 if ($target && $target =~ /^([^\s\(]+)\((\d+)\)$/) {
27 return $self->do_man_link ($token);
29 return $self->SUPER::do_pod_link ($token);
33 sub VERSION () { '1.1' }
35 $Pod::Simple::HTML::Tagmap{'item-bullet'} = '<li><p>';
36 $Pod::Simple::HTML::Tagmap{'/item-bullet'} = '</p></li>';
37 $Pod::Simple::HTML::Tagmap{'item-number'} = '<li><p>';
38 $Pod::Simple::HTML::Tagmap{'/item-number'} = '</p></li>';
45 use Pod::Simple::HTMLBatch;
47 our $HEADER = <<'EOH';
50 <title>OpenAFS Reference Manual</title>
51 <link rel="stylesheet" title="style" type="text/css" href="style.css" media="all">
53 <body class='contentspage'>
54 <h1>OpenAFS Reference Manual</h1>
57 our %HEADINGS = (1 => 'User Commands',
58 5 => 'Configuration and Data Files',
59 8 => 'Administrator Commands');
61 # Scan all of the POD files and build a list of section, name, and short
62 # description, returning that as an array.
65 for my $dir (qw(pod1 pod5 pod8)) {
68 opendir (D, $dir) or die "Cannot open $dir: $!\n";
69 for my $file (sort grep { !/^\./ && !/CVS/ } readdir D) {
70 open (F, "$dir/$file") or die "Cannot open $dir/$file: $!\n";
74 last if /^=head1/ && !/^=head1\s+NAME\b/;
75 next unless /\s+-\s+/;
76 ($name, $desc) = split (/\s+-\s+/, $_, 2);
79 warn "$dir/$file: cannot find NAME section, skipping\n";
83 push (@index, [ $section, $name, $page, $desc ]);
91 mkdir ('html', 0755) or die "Cannot create html directory: $!\n";
93 for my $dir (qw(pod1 pod5 pod8)) {
96 mkdir ("html/$section", 0755) unless -d "html/$section";
98 my $conv = Pod::Simple::HTMLBatch->new;
100 $conv->index (undef);
101 $conv->contents_file (undef);
102 $conv->add_css ('../style.css', 1);
103 $conv->css_flurry (0);
104 $conv->javascript_flurry (0);
105 $conv->html_render_class ('OpenAFS::HTML');
106 $conv->batch_convert ($dir, "html/$section");
108 copy ('style.css', 'html/style.css') or die "Cannot copy style.css: $!\n";
110 open (INDEX, '> html/index.html')
111 or die "Cannot create html/index.html: $!\n";
113 print INDEX "<table>\n";
114 my @index = scan_names;
116 for my $entry (@index) {
117 my ($section, $name, $page, $desc) = @$entry;
123 if (!$current || $section != $current) {
124 print INDEX qq(<tr><td> </td></tr>\n);
125 print INDEX qq(<tr class="heading"><th colspan="2">);
126 print INDEX qq($HEADINGS{$section}</th></tr>\n);
129 print INDEX qq(<tr><td><a href="$section/$page.html">$name</a></td>);
130 print INDEX qq(<td>$desc</td></tr>\n);
132 print INDEX "</table>\n</body>\n</html>\n";