changeset 2666:6548c639892b octave-forge

Create a seperate page list only the contents of a package alphabetically
author adb014
date Thu, 12 Oct 2006 20:24:48 +0000
parents e25f9a6bec9e
children 20013d95d948
files admin/make_index
diffstat 1 files changed, 64 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/admin/make_index	Thu Oct 12 20:23:49 2006 +0000
+++ b/admin/make_index	Thu Oct 12 20:24:48 2006 +0000
@@ -63,6 +63,7 @@
 #                         [toolbox_2,category_2],..]
 my %TB_description    = ();
 my %index_notes = (); # index_notes{function} = comment
+my %index_by_package = (); # i_package{package} = list of functions
 
 # find and load all indices
 my @index_files = ();
@@ -512,8 +513,15 @@
     } else {
         ++$n_functions;
     }
-
-    $octave_forge_function{$function} = 1 unless $file =~ /^$OCTAVE/;
+    if (! ($file =~ /^$OCTAVE/)) {
+	$octave_forge_function{$function} = 1;
+	my $package = $file;
+	$package =~ s|^\s*([^/]+/[^/]+/).*$|$1|;
+	if ($package =~ /^\s*$/) {
+	    printf("%-12s %-20s %s\n", $function, $file, $package);
+	}
+	push @{$index_by_package{$package}}, $function;
+    }
     if (!defined $index_by_function{$function}) {
 	my $entry = $file;
 	$entry = "$file: $function" if $file !~ /[.]m$/;
@@ -652,6 +660,9 @@
 	#write_TBnavbar($_);
 	write_TBdetails($_);
     }
+    foreach ( package_list() ) {
+	write_package_details($_);
+    }
 
     # Write one file for each letter.
     #
@@ -846,6 +857,48 @@
     print OUT "__TRAILER__\n";
     close(OUT);
 } # 1}}}
+sub write_package_details { # 1{{{
+    my $packdir = shift;
+    my $package;
+    my $title;
+    my $desc = sprintf("%s/DESCRIPTION", $packdir);
+    open(IN, $desc) or die "Cannot read $desc:  $!\n";
+    while(<IN>) {
+	if (/^[Nn]ame:/) {
+	    chomp;
+	    s/^[Nn]ame:\s*//;
+	    s/\s*$//;
+	    $package = lc($_);
+	} elsif (/^[Tt]itle:/) {
+	    chomp;
+	    s/^[Tt]itle:\s*//;
+	    s/\s*$//;
+	    $title = $_;
+	}
+    }
+    close(IN);
+    my $file   = "$catdir/funref_$package.in";
+    
+    open(OUT, ">$file") or die "Cannot write $file:  $!\n";
+    print OUT <<EOF;
+__HEADER__([[[$title]]])
+EOF
+    print OUT "<dl>\n";
+    foreach my $func ( pack_list($packdir) ) {
+	
+	# column 1:  the function (x-ref to full description in
+	#                          cvs-tree's html file)
+	print OUT "<dt><table width=100%><tr><td align=left><b>",func_ref($func,$func),"</b>\n";
+	print OUT "    <td align=right>", download_ref($func), "</table>\n";
+	
+	# column 2: the description, if it exists
+	#
+	print OUT "<dd>",html_desc($func),"\n";
+    }
+    print OUT "</dl>\n";
+    print OUT "__TRAILER__\n";
+    close(OUT);
+} # 1}}}
 sub write_alphabetic_navbar { # 1{{{
     open(OUT,">$catdir/alphabetic.include") or die "Could not open $catdir/alphabetic.include";
 
@@ -1086,11 +1139,20 @@
 # toolbox_list() returns an ordered list of toolboxes.
     return sort { uc($a) cmp uc($b) } keys %index_by_TB_cat;
 } # 1}}}
+sub package_list { # 1{{{
+# package_list() returns an ordered list of package directories.
+    return sort { uc($a) cmp uc($b) } keys %index_by_package;
+} # 1}}}
 sub cat_list { # 1{{{
 # cat_list($TB) returns an ordered list of categories in a toolbox $TB.
     my ($TB) = @_;
     return sort keys %{$index_by_TB_cat{$TB}};
 } # 1}}}
+sub pack_list { # 1{{{
+# pack_list($package) returns an ordered list of functions in a package directory.
+    my ($package) = @_;
+    return sort @{$index_by_package{$package}};
+} # 1}}}
 sub cat_funcs { # 1{{{
 # cat_funcs($TB,$cat) returns an ordered list of functions in $TB,$cat
     my ($TB,$cat) = @_;