#!/usr/bin/perl # use strict; use Getopt::Long; my ($opt_include, $opt_exclude, $opt_book); die unless GetOptions( 'include=s' => \$opt_include, 'exclude=s' => \$opt_exclude, 'book=s' => \$opt_book, ); die "Unknown arguments.\n" if @ARGV; die "Can't exclude and include at same time!\n" if $opt_include && $opt_exclude; unless (-d $ENV{'LJHOME'}) { die "\$LJHOME not set.\n"; } require "$ENV{'LJHOME'}/doc/raw/build/docbooklib.pl"; chdir $ENV{'LJHOME'} or die "Can't cd to $ENV{'LJOME'}\n"; unless ($opt_book) { $opt_book = "ljp"; } ### apidoc.pl does all the hard work. my $VAR1; my $param; $param = "--include=$opt_include" if $opt_include; $param = "--exclude=$opt_exclude" if $opt_exclude; eval `$ENV{'LJHOME'}/bin/apidoc.pl --conf=$ENV{'LJHOME'}/doc/raw/build/api/apidoc.conf $param`; my $api = $VAR1; print "\n"; print " API Documentation\n"; foreach my $func (sort keys %$api) { my $f = $api->{$func}; my $argstring; my $canonized = canonize("func" , $func, "", $opt_book); print " \n"; ### name and short description: cleanse(\$f->{'des'}, $opt_book); print " \n"; print " $func\n"; print " $f->{'des'}\n"; print " \n"; ### usage: print " \n"; print " Use\n"; print " \n"; print " \n"; print " $func\n"; if (@{$f->{'args'}}) { foreach my $arg (@{$f->{'args'}}) { print " $arg->{'name'}\n"; } } print " \n"; print " \n"; print " \n"; ### arguments: if (@{$f->{'args'}}) { print " \n"; print " Arguments\n"; print " \n"; foreach my $arg (@{$f->{'args'}}) { print " \n"; print " $arg->{'name'}\n"; my $des = $arg->{'des'}; cleanse(\$des, $opt_book); print " $des\n"; print " \n"; } print " \n"; print " \n"; } ### info: if ($f->{'info'}) { cleanse(\$f->{'info'}, $opt_book); print " \n"; print " Info\n"; print " $f->{'info'}\n"; print " \n"; } ### source file: print " \n"; print " Source:\n"; print " $f->{'source'}\n"; print " \n"; ### returning: if ($f->{'returns'}) { cleanse(\$f->{'returns'}, $opt_book); print " \n"; print " Returns:\n"; print " $f->{'returns'}\n"; print " \n"; } print " \n"; } print "\n";