annotate scripts/mkdoc @ 9673:acf9952463c3

make mkdoc work on list of filenames
author John W. Eaton <jwe@octave.org>
date Wed, 30 Sep 2009 11:10:54 -0400
parents 71fca0fc2436
children 0d4613a736e9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3295
35a6d027772c [project @ 1999-10-19 10:13:02 by jwe]
jwe
parents:
diff changeset
1 #! /bin/sh
7019
4270ded9ddc6 [project @ 2007-10-13 01:42:20 by jwe]
jwe
parents: 5333
diff changeset
2 #
8920
eb63fbe60fab update copyright notices
John W. Eaton <jwe@octave.org>
parents: 8445
diff changeset
3 # Copyright (C) 1999, 2002, 2005, 2007, 2009 John W. Eaton
7019
4270ded9ddc6 [project @ 2007-10-13 01:42:20 by jwe]
jwe
parents: 5333
diff changeset
4 #
4270ded9ddc6 [project @ 2007-10-13 01:42:20 by jwe]
jwe
parents: 5333
diff changeset
5 # This file is part of Octave.
4270ded9ddc6 [project @ 2007-10-13 01:42:20 by jwe]
jwe
parents: 5333
diff changeset
6 #
4270ded9ddc6 [project @ 2007-10-13 01:42:20 by jwe]
jwe
parents: 5333
diff changeset
7 # Octave is free software; you can redistribute it and/or modify it
4270ded9ddc6 [project @ 2007-10-13 01:42:20 by jwe]
jwe
parents: 5333
diff changeset
8 # under the terms of the GNU General Public License as published by the
4270ded9ddc6 [project @ 2007-10-13 01:42:20 by jwe]
jwe
parents: 5333
diff changeset
9 # Free Software Foundation; either version 3 of the License, or (at
4270ded9ddc6 [project @ 2007-10-13 01:42:20 by jwe]
jwe
parents: 5333
diff changeset
10 # your option) any later version.
4270ded9ddc6 [project @ 2007-10-13 01:42:20 by jwe]
jwe
parents: 5333
diff changeset
11 #
4270ded9ddc6 [project @ 2007-10-13 01:42:20 by jwe]
jwe
parents: 5333
diff changeset
12 # Octave is distributed in the hope that it will be useful, but WITHOUT
4270ded9ddc6 [project @ 2007-10-13 01:42:20 by jwe]
jwe
parents: 5333
diff changeset
13 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
4270ded9ddc6 [project @ 2007-10-13 01:42:20 by jwe]
jwe
parents: 5333
diff changeset
14 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
4270ded9ddc6 [project @ 2007-10-13 01:42:20 by jwe]
jwe
parents: 5333
diff changeset
15 # for more details.
4270ded9ddc6 [project @ 2007-10-13 01:42:20 by jwe]
jwe
parents: 5333
diff changeset
16 #
4270ded9ddc6 [project @ 2007-10-13 01:42:20 by jwe]
jwe
parents: 5333
diff changeset
17 # You should have received a copy of the GNU General Public License
4270ded9ddc6 [project @ 2007-10-13 01:42:20 by jwe]
jwe
parents: 5333
diff changeset
18 # along with Octave; see the file COPYING. If not, see
4270ded9ddc6 [project @ 2007-10-13 01:42:20 by jwe]
jwe
parents: 5333
diff changeset
19 # <http://www.gnu.org/licenses/>.
3295
35a6d027772c [project @ 1999-10-19 10:13:02 by jwe]
jwe
parents:
diff changeset
20
4098
8496ae60db8a [project @ 2002-10-10 05:20:20 by jwe]
jwe
parents: 3390
diff changeset
21 set -e
8496ae60db8a [project @ 2002-10-10 05:20:20 by jwe]
jwe
parents: 3390
diff changeset
22
8445
dd52e541418b scripts/mkdoc: set defaults for FIND and PERL; check usage
John W. Eaton <jwe@octave.org>
parents: 8444
diff changeset
23 PERL=${PERL:-'perl'}
dd52e541418b scripts/mkdoc: set defaults for FIND and PERL; check usage
John W. Eaton <jwe@octave.org>
parents: 8444
diff changeset
24
9673
acf9952463c3 make mkdoc work on list of filenames
John W. Eaton <jwe@octave.org>
parents: 9014
diff changeset
25 if test $# -eq 0; then
acf9952463c3 make mkdoc work on list of filenames
John W. Eaton <jwe@octave.org>
parents: 9014
diff changeset
26 echo "usage: mkdoc file ..." 1>&2
8445
dd52e541418b scripts/mkdoc: set defaults for FIND and PERL; check usage
John W. Eaton <jwe@octave.org>
parents: 8444
diff changeset
27 exit 1
3295
35a6d027772c [project @ 1999-10-19 10:13:02 by jwe]
jwe
parents:
diff changeset
28 fi
35a6d027772c [project @ 1999-10-19 10:13:02 by jwe]
jwe
parents:
diff changeset
29
4098
8496ae60db8a [project @ 2002-10-10 05:20:20 by jwe]
jwe
parents: 3390
diff changeset
30 if test -f gethelp; then
5333
ac8d64b9e76a [project @ 2005-05-02 18:15:20 by jwe]
jwe
parents: 4098
diff changeset
31 cat << EOF
ac8d64b9e76a [project @ 2005-05-02 18:15:20 by jwe]
jwe
parents: 4098
diff changeset
32 ### DO NOT EDIT!
ac8d64b9e76a [project @ 2005-05-02 18:15:20 by jwe]
jwe
parents: 4098
diff changeset
33 ###
ac8d64b9e76a [project @ 2005-05-02 18:15:20 by jwe]
jwe
parents: 4098
diff changeset
34 ### This file is generated automatically from the Octave sources.
ac8d64b9e76a [project @ 2005-05-02 18:15:20 by jwe]
jwe
parents: 4098
diff changeset
35 ### Edit those files instead and run make to update this file.
ac8d64b9e76a [project @ 2005-05-02 18:15:20 by jwe]
jwe
parents: 4098
diff changeset
36
ac8d64b9e76a [project @ 2005-05-02 18:15:20 by jwe]
jwe
parents: 4098
diff changeset
37 EOF
9673
acf9952463c3 make mkdoc work on list of filenames
John W. Eaton <jwe@octave.org>
parents: 9014
diff changeset
38 for arg
acf9952463c3 make mkdoc work on list of filenames
John W. Eaton <jwe@octave.org>
parents: 9014
diff changeset
39 do
acf9952463c3 make mkdoc work on list of filenames
John W. Eaton <jwe@octave.org>
parents: 9014
diff changeset
40 echo "$arg" | $PERL -n -e 'chop;
9014
71fca0fc2436 save source file names for functions as comments in .texi files
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
41 $f = "$_";
71fca0fc2436 save source file names for functions as comments in .texi files
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
42 m{(.*)/(.*)\.m};
71fca0fc2436 save source file names for functions as comments in .texi files
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
43 for (qx{./gethelp $2 "$f" < "$f"}) {
8444
c3ac9f2772cd do not eat white space within @example environments of docstrings
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 7019
diff changeset
44 s/^\s+\@/\@/ unless $i_am_in_example;
c3ac9f2772cd do not eat white space within @example environments of docstrings
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 7019
diff changeset
45 s/^\s+\@group/\@group/;
c3ac9f2772cd do not eat white space within @example environments of docstrings
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 7019
diff changeset
46 s/^\s+\@end\s+group/\@end\s+group/;
c3ac9f2772cd do not eat white space within @example environments of docstrings
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 7019
diff changeset
47 $i_am_in_example = 1 if /\s*\@example/;
c3ac9f2772cd do not eat white space within @example environments of docstrings
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 7019
diff changeset
48 $i_am_in_example = 0 if /\s*\@end\s+example/;
c3ac9f2772cd do not eat white space within @example environments of docstrings
Thorsten Meyer <thorsten.meyier@gmx.de>
parents: 7019
diff changeset
49 print;
9014
71fca0fc2436 save source file names for functions as comments in .texi files
John W. Eaton <jwe@octave.org>
parents: 8920
diff changeset
50 }'
9673
acf9952463c3 make mkdoc work on list of filenames
John W. Eaton <jwe@octave.org>
parents: 9014
diff changeset
51 done
4098
8496ae60db8a [project @ 2002-10-10 05:20:20 by jwe]
jwe
parents: 3390
diff changeset
52 else
8496ae60db8a [project @ 2002-10-10 05:20:20 by jwe]
jwe
parents: 3390
diff changeset
53 echo "gethelp program seems to be missing!" 1>&2
8496ae60db8a [project @ 2002-10-10 05:20:20 by jwe]
jwe
parents: 3390
diff changeset
54 exit 1
8496ae60db8a [project @ 2002-10-10 05:20:20 by jwe]
jwe
parents: 3390
diff changeset
55 fi