From: Mike Taylor Date: Thu, 28 Sep 2006 16:48:00 +0000 (+0000) Subject: New X-Git-Tag: CPAN-v1.02~54^2~958 X-Git-Url: http://git.indexdata.com/?p=irspy-moved-to-github.git;a=commitdiff_plain;h=c32248b34e3b893f285b6e3de9f13d14c436080a New --- diff --git a/web/htdocs/details/doc.mc b/web/htdocs/details/doc.mc new file mode 100644 index 0000000..8d71d8a --- /dev/null +++ b/web/htdocs/details/doc.mc @@ -0,0 +1,58 @@ +%# $Id: doc.mc,v 1.1 2006-09-28 16:48:20 mike Exp $ +<%once> +use Pod::Html; +use IO::Dir; + +<%perl> +my $module = $r->param("module"); +if (!defined $module) { + print " \n"; +} else { + print "Documentation for '$module'\n"; + { my $dir = "/tmp/pod2html"; mkdir $dir; chdir $dir || die $!; } + # For some reason, output to standard output doesn't appear + my $name = "ZOOM.html"; + pod2html("$LIBDIR/$module", "--outfile=$name"); + open F, "<$name" or die "can't open '$name': $!"; + my $text = join("", ); + close F; + $text =~ s/.*?//gs; + $text =~ s/<\/body.*//gs; + print $text; +} + +sub render_doc_links { + my($base, $dir, $level) = @_; + + my $dh = new IO::Dir("$base/$dir") + or die "can't open directory handle for '$base/$dir'"; + + print " " x $level, "
  • $dir
  • \n"; + print " " x $level, "
      \n"; + + my(@files, @dirs); + while (my $file = $dh->read()) { + if ($file eq "." || $file eq ".." || $file eq "CVS") { + next; + } elsif (-d "$base/$dir/$file") { + push @dirs, $file; + } else { + push @files, $file; + } + } + + foreach my $file (sort @files) { + print(" " x $level, + qq[
    • $file
    • \n]); + } + + foreach my $file (sort @dirs) { + render_doc_links($base, "$dir/$file", $level+1); + } + + print " " x $level, "
    \n"; + undef $dh; +} + diff --git a/web/htdocs/doc.html b/web/htdocs/doc.html new file mode 100644 index 0000000..424d5db --- /dev/null +++ b/web/htdocs/doc.html @@ -0,0 +1,3 @@ +%# $Id: doc.html,v 1.1 2006-09-28 16:48:00 mike Exp $ +<& /chrome/layout.mc, %ARGS, component => "/details/doc.mc", + title => defined $ARGS{module} ? $ARGS{module} : "Documentation" &>