Mercurial > hg > octave-nkf
annotate scripts/mkdoc @ 8444:c3ac9f2772cd
do not eat white space within @example environments of docstrings
author | Thorsten Meyer <thorsten.meyier@gmx.de> |
---|---|
date | Mon, 05 Jan 2009 10:54:22 +0100 |
parents | 4270ded9ddc6 |
children | dd52e541418b |
rev | line source |
---|---|
3295 | 1 #! /bin/sh |
7019 | 2 # |
3 # Copyright (C) 1999, 2002, 2005, 2007 John W. Eaton | |
4 # | |
5 # This file is part of Octave. | |
6 # | |
7 # Octave is free software; you can redistribute it and/or modify it | |
8 # under the terms of the GNU General Public License as published by the | |
9 # Free Software Foundation; either version 3 of the License, or (at | |
10 # your option) any later version. | |
11 # | |
12 # Octave is distributed in the hope that it will be useful, but WITHOUT | |
13 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
14 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
15 # for more details. | |
16 # | |
17 # You should have received a copy of the GNU General Public License | |
18 # along with Octave; see the file COPYING. If not, see | |
19 # <http://www.gnu.org/licenses/>. | |
3295 | 20 |
4098 | 21 set -e |
22 | |
3295 | 23 if test $# != 1; then |
24 d=. | |
25 else | |
26 d=$1 | |
27 fi | |
28 | |
4098 | 29 if test -f gethelp; then |
5333 | 30 cat << EOF |
31 ### DO NOT EDIT! | |
32 ### | |
33 ### This file is generated automatically from the Octave sources. | |
34 ### Edit those files instead and run make to update this file. | |
35 | |
36 EOF | |
8444
c3ac9f2772cd
do not eat white space within @example environments of docstrings
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
7019
diff
changeset
|
37 $FIND $d -name '*.m' | \ |
c3ac9f2772cd
do not eat white space within @example environments of docstrings
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
7019
diff
changeset
|
38 $PERL -ne 'm{(.*)/(.*)\.m}; |
c3ac9f2772cd
do not eat white space within @example environments of docstrings
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
7019
diff
changeset
|
39 for (qx{./gethelp $2 < $_}) { |
c3ac9f2772cd
do not eat white space within @example environments of docstrings
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
7019
diff
changeset
|
40 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
|
41 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
|
42 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
|
43 $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
|
44 $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
|
45 print; |
c3ac9f2772cd
do not eat white space within @example environments of docstrings
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
7019
diff
changeset
|
46 }' |
4098 | 47 else |
48 echo "gethelp program seems to be missing!" 1>&2 | |
49 exit 1 | |
50 fi |