changeset 411:e7ba81c8dc5a feature_113

Add the MATLAB doc extractor to the general doc extraction script
author Chris Cannam <chris.cannam@soundsoftware.ac.uk>
date Thu, 28 Apr 2011 13:29:15 +0100
parents 675de8e6becf
children 0964cbb51753 c6f2ad88bc9c 470587927974
files extra/soundsoftware/extract-docs.sh extra/soundsoftware/extract-matlabdocs.sh extra/soundsoftware/matlab-docs.conf extra/soundsoftware/matlab-docs.pl
diffstat 4 files changed, 50 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/extra/soundsoftware/extract-docs.sh	Wed Apr 27 16:55:21 2011 +0100
+++ b/extra/soundsoftware/extract-docs.sh	Thu Apr 28 13:29:15 2011 +0100
@@ -22,7 +22,7 @@
     *) progdir="$(pwd)/$progdir" ;;
 esac
 
-types="doxygen javadoc" # Do Doxygen first (it can be used for Java too)
+types="doxygen javadoc matlabdocs" # Do Doxygen first (it can be used for Java too)
 
 for x in $types; do
     if [ ! -x "$progdir/extract-$x.sh" ]; then
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/extra/soundsoftware/extract-matlabdocs.sh	Thu Apr 28 13:29:15 2011 +0100
@@ -0,0 +1,47 @@
+#!/bin/bash
+
+docdir="/var/doc"
+
+progdir=$(dirname $0)
+case "$progdir" in
+    /*) ;;
+    *) progdir="$(pwd)/$progdir" ;;
+esac
+
+project="$1"
+projectdir="$2"
+targetdir="$3"
+
+if [ -z "$project" ] || [ -z "$targetdir" ] || [ -z "$projectdir" ]; then
+    echo "Usage: $0 <project> <projectdir> <targetdir>"
+    exit 2
+fi
+
+if [ ! -d "$projectdir" ]; then
+    echo "Project directory $projectdir not found"
+    exit 1
+fi
+
+if [ ! -d "$targetdir" ]; then
+    echo "Target dir $targetdir not found"
+    exit 1
+fi
+
+if [ -f "$targetdir/index.html" ]; then
+    echo "Target dir $targetdir already contains index.html"
+    exit 1
+fi
+
+mfile=$(find "$projectdir" -type f -name \*.m -print0 | xargs -0 grep -l '^% ' | head -1)
+
+if [ -z "$mfile" ]; then
+    echo "No MATLAB files with comments found for project $project"
+    exit 1
+fi
+
+echo "Project $project contains at least one MATLAB file with comments"
+
+cd "$projectdir" || exit 1
+
+perl "$progdir/matlab-docs.pl" -c "$progdir/matlab-docs.conf" -d "$targetdir"
+
--- a/extra/soundsoftware/matlab-docs.conf	Wed Apr 27 16:55:21 2011 +0100
+++ b/extra/soundsoftware/matlab-docs.conf	Thu Apr 28 13:29:15 2011 +0100
@@ -154,7 +154,7 @@
 #------------------------------------------------------------------------
 # codehr: HTML-code used to define a <HR>, do what you want
 #------------------------------------------------------------------------
-set codehr = <hr size="3" noshade="noshade" />
+set codehr = <hr>
 
 #------------------------------------------------------------------------
 # codeheader: HTML-code added to <H*> tags, use for centering header text
--- a/extra/soundsoftware/matlab-docs.pl	Wed Apr 27 16:55:21 2011 +0100
+++ b/extra/soundsoftware/matlab-docs.pl	Thu Apr 28 13:29:15 2011 +0100
@@ -75,7 +75,7 @@
 
 $VERSION  = '1.23';
 ($PROGRAM = $0) =~ s@.*/@@; $PROGRAM = "\U$PROGRAM\E";
-$debug = 4;
+$debug = 1;
 
 #------------------------------------------------------------------------
 # Define platform specific things