1 %# $Id: doc.mc,v 1.4 2007-05-03 14:13:19 mike Exp $
7 my $libdir = $r->dir_config("IRSpyLibDir");
8 my $module = utf8param($r, "module");
9 if (!defined $module) {
11 render_doc_links($libdir, "ZOOM", 6);
14 print "<b>Documentation for '$module'</b>\n";
15 { my $dir = "/tmp/pod2html"; mkdir $dir; chdir $dir || die $!; }
16 # For some reason, output to standard output doesn't appear
17 my $name = "ZOOM.html";
18 pod2html("$libdir/$module", "--outfile=$name");
19 open F, "<$name" or die "can't open '$name': $!";
20 my $text = join("", <F>);
22 $text =~ s/.*?<body.*?>//gs;
23 $text =~ s/<\/body.*//gs;
27 sub render_doc_links {
28 my($base, $dir, $level) = @_;
30 my $dh = new IO::Dir("$base/$dir")
31 or die "can't open directory handle for '$base/$dir'";
33 print " " x $level, "<li><b>$dir</b></li>\n";
34 print " " x $level, "<li><ul>\n";
37 while (my $file = $dh->read()) {
38 if ($file eq "." || $file eq ".." || $file eq "CVS") {
40 } elsif (-d "$base/$dir/$file") {
47 foreach my $file (sort @files) {
49 qq[ <li><a href="?module=$dir/$file">$file</a></li>\n]);
52 foreach my $file (sort @dirs) {
53 render_doc_links($base, "$dir/$file", $level+1);
56 print " " x $level, "</ul></li>\n";