<<
# Scandoc template file.
#
# This is an example set of templates that is designed to create several
# different kinds of index files. It generates a "master index" which intended
# for use with a frames browser; A "package index" which is the root page of
# the index, and then "package files" containing documentation for all of the
# classes within a single package.
######################################################################
## For quick and superficial customization,
## simply change these variables
$project_name = '[Apache]';
$copyright = '© 2000 [Apache Software Foundation]';
$image_directory = "../images/";
$bgcolor1 = "#FFFFFF";
$bgcolor2 = "#FFFFFF";
######################################################################
## Begin generating frame index file.
file "index.html";
>><html>
<head>
</head>
<noframes>
<p>Some Documentation</p>
</body>
</noframes>
</frameset>
</html>
<<
######################################################################
## Begin generating master index file (left-hand frame).
file "master.html";
>><html>
<head>
</head>
<p>
</p>
<p>
<nobr>
<<
## For each package, generate an index entry.
foreach $p (packages()) {
$_ = $p->url;
s/\s/%20/g;
<dir>
<<
foreach $e ($p->classes()) {
$_ = $e->url;
s/\s/%20/g;
<<
}
foreach $e ($p->globals()) {
$_ = $e->url;
s/\s/%20/g;
<<
}
>></dir><<
}
>>
</nobr>
</font>
</p>
</body>
</html>
<<
######################################################################
## Begin generating package index file
>><html>
<head>
</head>
</center>
<<
## For each package, generate an index entry.
foreach $p (packages()) {
$_ = $p->url;
s/\s/%20/g;
<<
}
>>
<p>
</body>
</html>
<<
######################################################################
## Generate "To-do list"
file "to-do.html";
>><html>
<head>
</head>
<<
if (&todolistFiles()) {
<<
foreach $f (&todolistFiles()) {
my @m = &todolistEntries( $f );
if ($f =~ /([^\/]+)$/) { $f = $1; }
>><b>$f:</b><ul>
<<
foreach $text (@m) {
if ($text) {
}
}
>></ul>
<<
}
}
>>
</body>
</html>
<<
######################################################################
## Generate individual files for each package.
my $p;
foreach $p (packages()) {
>><html>
<head>
</head>
<center>
</center>
<b>
<<
## Generate class and member index at the top of the file.
foreach $c ($p->classes()) {
<ul>
<<
foreach $m ($c->members()) {
<<
}
>></ul>
<<
}
>>
</b>
<<
## Generate detailed class documentation
foreach $c ($p->classes()) {
## Output searchable keyword list
if ($c->keywords()) {
}
<a name="$(c.anchor)"></a>
<tr>
</th>
</tr>
<<
# Output author tag
if ($c->author()) {
}
# Output package version
if ($c->version()) {
}
# Output Source file
if ($c->sourcefile()) {
}
# Output base class list
if ($c->baseclasses()) {
<td><<
my @t = ();
foreach $b ($c->baseclasses()) {
push @t, "<a href=\"$url\">$name</a>";
}
else { push @t, $name; }
}
print join( ', ', @t );
>></td></tr>
<<
}
# Output subclasses list
if ($c->subclasses()) {
<td><<
my @t = ();
foreach $s ($c->subclasses()) {
push @t, "<a href=\"$url\">$name</a>";
}
else { push @t, $name; }
}
print join( ', ', @t );
>></td></tr><<
}
# Output main class description
>></tr>
</table>
<p>
<<
print &processDescription( $c->description() );
# Output "see also" information
if ($c->seealso()) {
<<
my @r = ();
foreach $a ($c->seealso()) {
push @r, "<a href=\"$url\">$name</a>";
}
else { push @r, $name; }
}
print join( ',', @r );
>><p>
<<
}
# Output class member index
if ($c->members()) {
print "<h2>Member Index</h2>\n";
print "<ul>";
foreach $m ($c->members()) {
<<
}
>></ul><<
}
# Output class member variable documentation
if ($c->membervars()) {
print "<h2>Class Variables</h2>\n";
print "<blockquote>\n";
foreach $m ($c->membervars()) { &variable( $m ); }
print "</blockquote>\n";
}
# Output class member function documentation
if ($c->memberfuncs()) {
print "<h2>Class Methods</h2>\n";
print "<blockquote>\n";
foreach $m ($c->memberfuncs()) { &function( $m ); }
print "</blockquote>\n";
}
}
# Output global variables
if ($p->globalvars()) {
<<
foreach $m ($p->globalvars()) { &variable( $m ); }
print "</blockquote>\n";
}
# Output global functions
if ($p->globalfuncs()) {
<<
foreach $m ($p->globalfuncs()) { &function( $m ); }
print "</blockquote>\n";
}
>>
</body>
</html>
<<
} # end of foreach (packages) loop
######################################################################
## Subroutine to generate documentation for a member function or global function
sub function {
local ($f) = @_;
if ($f->keywords()) {
>><!-- $(f.keywords) -->
<<
}
>>
<a name="$(f.anchor)"></a>
<dl>
<dt>
<dd>
<<
print &processDescription( $f->description() );
>>
<p><dl>
<<
if ($f->params()) {
>>
<<
foreach $a ($f->params()) {
print &processDescription( $a->description() );
>></td></tr>
<<
}
>></table>
<<
}
if ($f->returnValue()) {
<dd><<
print &processDescription( $f->returnValue() );
>><p><<
}
if ($f->exceptions()) {
<<
foreach $a ($f->exceptions()) {
print &processDescription( $a->description() );
>></td></tr>
<<
}
<<
}
if ($f->seealso()) {
<<
my @r = ();
foreach $a ($f->seealso()) {
push @r, "<a href=\"$url\">$name</a>";
}
else { push @r, $name; }
}
print join( ',', @r );
>><p><<
}
<<
}
######################################################################
## Subroutine to generate documentation for a member variable or global variable.
sub variable {
local ($v) = @_;
if ($v->keywords()) {
print "<!-- $(v.keywords) -->";
}
>>
<a name="$(v.name)"></a>
<dd>
<<print &processDescription( $v->description() );>>
<p><dl>
<<
if ($v->seealso()) {
<<
$comma = 0;
foreach $a ($v->seealso()) {
if ($comma) { print ","; }
$comma = 1;
<<
}
>><p>
<<
}
<<
}
######################################################################
sub processDescription {
local ($_) = @_;
s/^\s+//; # Remove whitespace from beginning
s/\s+$/\n/; # Remove whitespace from end
s/\n\n/<p>\n/g; # Replace multiple CR's with paragraph markers
# Handle embedded image tags
return $_;
}