# HG changeset patch
# User Chris Cannam
# Date 1301910488 -3600
# Node ID baff1c482d9884ea11213fa1b22d8149fea754a2
# Parent 2dc8163e91506975bff83c9071efd15e256ad133
First cut at making frames optional in mtree output
diff -r 2dc8163e9150 -r baff1c482d98 extra/soundsoftware/matlab-docs.pl
--- a/extra/soundsoftware/matlab-docs.pl Mon Apr 04 10:47:38 2011 +0100
+++ b/extra/soundsoftware/matlab-docs.pl Mon Apr 04 10:48:08 2011 +0100
@@ -5,7 +5,7 @@
goto endofperl
@rem ';
# perl -w -S %0.bat "$@"
-#!/usr/pdsoft/bin/perl5
+#!/usr/bin/perl
#
# mtree2html_2000 - produce html files from Matlab m-files.
# use configuration file for flexibility
@@ -71,8 +71,7 @@
# HTML4 compliance done (should be strict HTML4.0, quite near XHTML)
# version 1.23
#
-# Latest version is available as:
-#
+# 29.03.2011 (Chris Cannam) add frames option
#
$VERSION = '1.23';
@@ -93,7 +92,7 @@
$diract = ".";
#------------------------------------------------------------------------
-# Define all variables and there standard settings
+# Define all variables and their standard settings
# documentation of variables is contained in accompanying rc file
#------------------------------------------------------------------------
%var =
@@ -109,6 +108,7 @@
'dirmfiles', $diract,
'dirhtml', $diract,
'exthtml', '.html',
+ 'frames', 'yes',
'filenametopframe', 'index',
'filenameindexlongglobal', 'indexlg',
'filenameindexlonglocal', 'indexll',
@@ -211,6 +211,7 @@
$var{'producetree'} = $opt_producetree if $opt_producetree;
if ($var{'producetree'} ne 'no') { $var{'producetree'} = 'yes'; }
if ($var{'processtree'} eq 'no') { $var{'producetree'} = 'no'; }
+if ($var{'frames'} ne 'no') { $var{'frames'} = 'yes'; }
# if (($var{'processtree'} eq 'yes') && ($var{'producetree'} eq 'no')) { $var{'usecontentsm'} = 'no'; }
$var{'writecontentsm'} = $opt_writecontentsm if $opt_writecontentsm;
@@ -642,25 +643,29 @@
# Build the frame layout file name (highest one)
$indexfile = $var{'dirhtml'}.$var{'filenametopframe'}.$var{'exthtml'};
- open(IFILE,">$indexfile") || die("Cannot open frame layout file $indexfile\n");
- # Write the header of frame file
- print IFILE "$TextDocTypeFrame\n\n
\n$var{'codeheadmeta'}\n$TextMetaCharset\n";
- print IFILE " $var{'texttitleframelayout'}\n";
- print IFILE "\n";
+ if ($var{'frames'} eq 'yes') {
- # definition of 2 frames, left the tree of directories,
- # right the index of that directory or the docu of a file
- print IFILE "\n";
+ open(IFILE,">$indexfile") || die("Cannot open frame layout file $indexfile\n");
- print IFILE "\n";
+ # Write the header of frame file
+ print IFILE "$TextDocTypeFrame\n\n\n$var{'codeheadmeta'}\n$TextMetaCharset\n";
+ print IFILE " $var{'texttitleframelayout'}\n";
+ print IFILE "\n";
- close(IFILE);
+ # definition of 2 frames, left the tree of directories,
+ # right the index of that directory or the docu of a file
+ print IFILE "\n";
- if ($opt_silent) { print "\r"; }
- print " Frame layout file created: $indexfile\t";
- if (!$opt_silent) { print "\n"; }
+ print IFILE "\n";
+
+ close(IFILE);
+
+ if ($opt_silent) { print "\r"; }
+ print " Frame layout file created: $indexfile\t";
+ if (!$opt_silent) { print "\n"; }
+ }
for($irun=0; $irun <= 2; $irun++) {
# Build the top directory index file, these files include the directory tree
@@ -685,8 +690,11 @@
} else {
print IFILE "$var{'texttitleindexalldirs'}\n";
}
- print IFILE "\n";
-
+
+ if ($var{'frames'} eq 'yes') {
+ print IFILE "\n";
+ }
+
print IFILE "\n";
print IFILE "\n";
if ($var{'textheaderindexalldirs'} eq '') {
@@ -695,13 +703,25 @@
print IFILE "$var{'textheaderindexalldirs'}
\n";
}
print IFILE "\n";
- if ($irun == 0) { print IFILE "short\n"; }
- else { print IFILE "short\n"; }
- if ($irun == 1) { print IFILE " | long\n"; }
- else { print IFILE " | long\n"; }
- if ($var{'usecontentsm'} eq 'yes') {
- if ($irun == 2) { print IFILE " | contents\n"; }
- else { print IFILE " | contents\n"; }
+
+ if ($var{'frames'} eq 'yes') {
+ if ($irun == 0) { print IFILE "short\n"; }
+ else { print IFILE "short\n"; }
+ if ($irun == 1) { print IFILE " | long\n"; }
+ else { print IFILE " | long\n"; }
+ if ($var{'usecontentsm'} eq 'yes') {
+ if ($irun == 2) { print IFILE " | contents\n"; }
+ else { print IFILE " | contents\n"; }
+ }
+ } else {
+ if ($irun == 0) { print IFILE "short\n"; }
+ else { print IFILE "short\n"; }
+ if ($irun == 1) { print IFILE " | long\n"; }
+ else { print IFILE " | long\n"; }
+ if ($var{'usecontentsm'} eq 'yes') {
+ if ($irun == 2) { print IFILE " | contents\n"; }
+ else { print IFILE " | contents\n"; }
+ }
}
print IFILE "
\n\n";
@@ -781,6 +801,12 @@
if ($LocalGlobalLocal eq 'global') { $extradirfilename = ''; }
else { $extradirfilename = $dirnamesingle{$LocalActDir}; }
$indexfile = $var{'dirhtml'}.$dirnamerelpath{$LocalActDir}.$indexfilename.$var{'filenameextensionindex'}.$extradirfilename.$var{'exthtml'};
+
+ if ($LocalShortLong eq 'short' and $var{'frames'} ne 'yes') {
+ # With no frames, this must go in the top-level index file instead
+ $indexfile = $var{'dirhtml'}.$var{'filenametopframe'}.$var{'exthtml'};
+ }
+
if ($debug > 2) { print " indexfilename (a-z small): $indexfile\n"; }
open(IFILE,">$indexfile") || die("Cannot open index file $indexfile: $!\n");
@@ -794,8 +820,12 @@
if ($LocalGlobalLocal eq 'global') { print IFILE "$var{'texttitleindex'}\n"; }
else { print IFILE "$var{'texttitleindex'} in Directory $LocalActDir\n"; }
}
- print IFILE "\n";
+
+ if ($var{'frames'} eq 'yes') {
+ print IFILE "\n";
+ }
print IFILE "\n";
+
print IFILE "\n";
if ($var{'textheaderindex'} eq '') {
print IFILE "Index of Matlab Files in Directory $LocalActDir
\n";
@@ -887,42 +917,49 @@
# handle the global index file case separately (no extra directory name in file)
if ($LocalGlobalLocal eq 'global') { $extradirfilename = ''; }
else { $extradirfilename = $dirnamesingle{$LocalActDir}; }
- $indexfile = $var{'dirhtml'}.$dirnamerelpath{$LocalActDir}.$indexfilename.$var{'filenameextensionjump'}.$extradirfilename.$var{'exthtml'};
- if ($debug > 2) { print " indexfilename (a-z jump): $indexfile\n"; }
- open(IFILE,">$indexfile") || die("Cannot open jump index file $indexfile: $!\n");
- # Write the header of HTML file
- print IFILE "$TextDocTypeHTML\n\n\n$var{'codeheadmeta'}\n$TextMetaCharset\n$var{'csslink'}\n";
-
- if ($var{'texttitleindex'} eq '') {
- print IFILE "A-Z jump index in directory $LocalActDir\n";
- } else {
- if ($LocalGlobalLocal eq 'global') { print IFILE "$var{'texttitleindex'}\n"; }
- else { print IFILE "$var{'texttitleindex'} in Directory $LocalActDir\n"; }
+ if ($var{'frames'} eq 'yes') {
+
+ $indexfile = $var{'dirhtml'}.$dirnamerelpath{$LocalActDir}.$indexfilename.$var{'filenameextensionjump'}.$extradirfilename.$var{'exthtml'};
+ if ($debug > 2) { print " indexfilename (a-z jump): $indexfile\n"; }
+ open(IFILE,">$indexfile") || die("Cannot open jump index file $indexfile: $!\n");
+
+ # Write the header of HTML file
+ print IFILE "$TextDocTypeHTML\n\n\n$var{'codeheadmeta'}\n$TextMetaCharset\n$var{'csslink'}\n";
+
+ if ($var{'texttitleindex'} eq '') {
+ print IFILE "A-Z jump index in directory $LocalActDir\n";
+ } else {
+ if ($LocalGlobalLocal eq 'global') { print IFILE "$var{'texttitleindex'}\n"; }
+ else { print IFILE "$var{'texttitleindex'} in Directory $LocalActDir\n"; }
+ }
+
+ if ($var{'frames'} eq 'yes') {
+ print IFILE "\n";
+ }
+ print IFILE "\n";
+ print IFILE "\n";
+
+ # Write the A-Z jump line, generate link for letters with files starting with this letter
+ # and only letters for no files starting with this letter
+ # use previously generated arrays with names of files sorted by starting letter
+ for('a'..'z') {
+ $numberofletter = $#{$_}+1;
+ if ($numberofletter > 0) {
+ print IFILE "\U$_\E \n";
+ } else {
+ print IFILE "\U$_\E \n";
+ }
+ }
+
+ print IFILE "\n\n";
+
+ close(IFILE);
+
+ if ($opt_silent) { print "\r"; }
+ print " Indexfile small (A-Z jump) created: $indexfile\t";
+ if (!$opt_silent) { print "\n"; }
}
- print IFILE "\n";
- print IFILE "\n";
- print IFILE "\n";
-
- # Write the A-Z jump line, generate link for letters with files starting with this letter
- # and only letters for no files starting with this letter
- # use previously generated arrays with names of files sorted by starting letter
- for('a'..'z') {
- $numberofletter = $#{$_}+1;
- if ($numberofletter > 0) {
- print IFILE "\U$_\E \n";
- } else {
- print IFILE "\U$_\E \n";
- }
- }
-
- print IFILE "\n\n";
-
- close(IFILE);
-
- if ($opt_silent) { print "\r"; }
- print " Indexfile small (A-Z jump) created: $indexfile\t";
- if (!$opt_silent) { print "\n"; }
# Build the frame layout file, this file includes the layout of the frames
@@ -930,37 +967,41 @@
# handle the global index file case separately (no extra directory name in file)
if ($LocalGlobalLocal eq 'global') { $extradirfilename = ''; }
else { $extradirfilename = $dirnamesingle{$LocalActDir}; }
- $indexfile = $var{'dirhtml'}.$dirnamerelpath{$LocalActDir}.$indexfilename.$var{'filenameextensionframe'}.$extradirfilename.$var{'exthtml'};
- if ($debug > 2) { print " indexfilename (a-z frame): $indexfile\n"; }
- open(IFILE,">$indexfile") || die("Cannot open jump index frame file $indexfile: $!\n");
+ if ($var{'frames'} eq 'yes') {
- # Write the header of Frame file
- print IFILE "$TextDocTypeHTML\n\n\n$var{'codeheadmeta'}\n$TextMetaCharset\n$var{'csslink'}\n";
+ $indexfile = $var{'dirhtml'}.$dirnamerelpath{$LocalActDir}.$indexfilename.$var{'filenameextensionframe'}.$extradirfilename.$var{'exthtml'};
+ if ($debug > 2) { print " indexfilename (a-z frame): $indexfile\n"; }
- if ($var{'texttitleindex'} eq '') {
- print IFILE "Index of Matlab Files in Directory $LocalActDir\n";
- } else {
- if ($LocalGlobalLocal eq 'global') { print IFILE "$var{'texttitleindex'}\n"; }
- else { print IFILE "$var{'texttitleindex'} in Directory $LocalActDir\n"; }
+ open(IFILE,">$indexfile") || die("Cannot open jump index frame file $indexfile: $!\n");
+
+ # Write the header of Frame file
+ print IFILE "$TextDocTypeHTML\n\n\n$var{'codeheadmeta'}\n$TextMetaCharset\n$var{'csslink'}\n";
+
+ if ($var{'texttitleindex'} eq '') {
+ print IFILE "Index of Matlab Files in Directory $LocalActDir\n";
+ } else {
+ if ($LocalGlobalLocal eq 'global') { print IFILE "$var{'texttitleindex'}\n"; }
+ else { print IFILE "$var{'texttitleindex'} in Directory $LocalActDir\n"; }
+ }
+ print IFILE "\n";
+
+ # definition of 2 frames, top the A-Z index, below the jump letter line
+ print IFILE "\n";
+
+ print IFILE "\n";
+
+ close(IFILE);
+
+ if ($opt_silent) { print "\r"; }
+ print " Frame layout file created: $indexfile\t";
+ if (!$opt_silent) { print "\n"; }
}
- print IFILE "\n";
-
- # definition of 2 frames, top the A-Z index, below the jump letter line
- print IFILE "\n";
-
- print IFILE "\n";
-
- close(IFILE);
-
- if ($opt_silent) { print "\r"; }
- print " Frame layout file created: $indexfile\t";
- if (!$opt_silent) { print "\n"; }
}
-
+
#========================================================================
# Construct the links to all indexes
@@ -972,16 +1013,22 @@
# include links to short/long - local/global index and C|contents.m
print WRITEFILE "\n";
print WRITEFILE "$var{'textjumpindexglobal'} (";
- print WRITEFILE "short | ";
- print WRITEFILE "long)\n";
+
+ if ($var{'frames'} eq 'yes') {
+ print WRITEFILE "short | ";
+ } else {
+ print WRITEFILE "short | ";
+ }
+
+ print WRITEFILE "long)\n";
if ($LocalGlobalLocal eq 'local') {
if ($var{'usecontentsm'} eq 'yes') {
print WRITEFILE " | Local contents\n";
}
# if ($var{'producetree'} eq 'yes') {
print WRITEFILE " | $var{'textjumpindexlocal'} (";
- print WRITEFILE "short | ";
- print WRITEFILE "long)\n";
+ print WRITEFILE "short | ";
+ print WRITEFILE "long)\n";
# }
}
print WRITEFILE "
\n\n";