#!/usr/bin/perl # use strict; unless (-d $ENV{'LJHOME'}) { die "\$LJHOME not set.\n"; } chdir $ENV{'LJHOME'} or die "Can't cd to $ENV{'LJOME'}\n"; ### apidoc.pl does all the hard work. my $VAR1; eval `bin/apidoc.pl`; my $api = $VAR1; print "\n"; print "LiveJournal API Documentation\n"; print "\n"; print "

LiveJournal API Documentation

\n"; ## print list print "

Alphabetic List of Functions

\n"; print "\n"; ## print each function print "

Function Descriptions

\n"; foreach my $func (sort keys %$api) { my $f = $api->{$func}; my $argstring; xlinkify(\$f->{'des'}); my $optcount; foreach my $arg (@{$f->{'args'}}) { my $comma = $argstring ? ", " : ""; my $lbrack = ""; if ($arg->{'optional'}) { $optcount++; $lbrack = "[" } $argstring .= "$lbrack$comma$arg->{'name'}"; if ($arg->{'list'}) { $argstring .= "*"; } } $argstring .= "]"x$optcount; print "\n"; print "

$func

\n"; print "
\n"; print "\n"; print "\n"; print "\n"; print "\n"; if (@{$f->{'args'}}) { print "\n"; print "\n"; print "\n"; print "\n"; } if ($f->{'returns'}) { xlinkify(\$f->{'returns'}); print "\n"; print "\n"; } print "
Description:$f->{'des'}
Source:$f->{'source'}
Arguments:$argstring
 \n"; foreach my $arg (@{$f->{'args'}}) { print ""; my $des = $arg->{'des'}; xlinkify(\$des); print "\n"; } print "
$arg->{'name'}$des
Returns:$f->{'returns'}
\n"; print "

\n"; } print "\n"; print "\n"; sub xlinkify { my $a = shift; $$a =~ s/\[func\[([^\]]*)]\]/$1<\/a><\/tt>/g; }