Mercurial > hg > octave-nkf
annotate scripts/help/__makeinfo__.m @ 20793:ba2b07c13913
use new string_value method to handle value extraction errors
* __dispatch__.cc, balance.cc, colloc.cc, conv2.cc, data.cc, debug.cc,
graphics.cc, input.cc, matrix_type.cc, oct-hist.cc, schur.cc,
spparms.cc, symtab.cc, sysdep.cc, toplev.cc, utils.cc:
Use new string_value method.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Fri, 09 Oct 2015 10:06:39 -0400 |
parents | e884d5816471 |
children |
rev | line source |
---|---|
19898
4197fc428c7d
maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents:
18745
diff
changeset
|
1 ## Copyright (C) 2009-2015 Søren Hauberg |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff
changeset
|
2 ## |
11104 | 3 ## This file is part of Octave. |
4 ## | |
5 ## Octave is free software; you can redistribute it and/or modify it | |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff
changeset
|
6 ## under the terms of the GNU General Public License as published by |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff
changeset
|
7 ## the Free Software Foundation; either version 3 of the License, or (at |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff
changeset
|
8 ## your option) any later version. |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff
changeset
|
9 ## |
11104 | 10 ## Octave is distributed in the hope that it will be useful, but |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff
changeset
|
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff
changeset
|
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff
changeset
|
13 ## General Public License for more details. |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff
changeset
|
14 ## |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff
changeset
|
15 ## You should have received a copy of the GNU General Public License |
11104 | 16 ## along with Octave; see the file COPYING. If not, see |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff
changeset
|
17 ## <http://www.gnu.org/licenses/>. |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff
changeset
|
18 |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff
changeset
|
19 ## -*- texinfo -*- |
17424
8c22a8d42833
__makeinfo__.m: Backout changeset 687872d279be which removes 3rd argument to func.
Rik <rik@octave.org>
parents:
17339
diff
changeset
|
20 ## @deftypefn {Function File} {[@var{retval}, @var{status}] =} __makeinfo__ (@var{text}, @var{output_type}) |
8c22a8d42833
__makeinfo__.m: Backout changeset 687872d279be which removes 3rd argument to func.
Rik <rik@octave.org>
parents:
17339
diff
changeset
|
21 ## @deftypefnx {Function File} {[@var{retval}, @var{status}] =} __makeinfo__ (@var{text}, @var{output_type}, @var{see_also}) |
8768
e0fbf17a17bb
__makeinfo__.m: rename from makeinfo.m
John W. Eaton <jwe@octave.org>
parents:
8717
diff
changeset
|
22 ## Undocumented internal function. |
e0fbf17a17bb
__makeinfo__.m: rename from makeinfo.m
John W. Eaton <jwe@octave.org>
parents:
8717
diff
changeset
|
23 ## @end deftypefn |
e0fbf17a17bb
__makeinfo__.m: rename from makeinfo.m
John W. Eaton <jwe@octave.org>
parents:
8717
diff
changeset
|
24 |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff
changeset
|
25 ## Run @code{makeinfo} on a given text. |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff
changeset
|
26 ## |
8768
e0fbf17a17bb
__makeinfo__.m: rename from makeinfo.m
John W. Eaton <jwe@octave.org>
parents:
8717
diff
changeset
|
27 ## The string @var{text} is run through the @code{__makeinfo__} program |
17424
8c22a8d42833
__makeinfo__.m: Backout changeset 687872d279be which removes 3rd argument to func.
Rik <rik@octave.org>
parents:
17339
diff
changeset
|
28 ## to generate output in various formats. This string must contain valid |
8768
e0fbf17a17bb
__makeinfo__.m: rename from makeinfo.m
John W. Eaton <jwe@octave.org>
parents:
8717
diff
changeset
|
29 ## Texinfo formatted text. |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff
changeset
|
30 ## |
17424
8c22a8d42833
__makeinfo__.m: Backout changeset 687872d279be which removes 3rd argument to func.
Rik <rik@octave.org>
parents:
17339
diff
changeset
|
31 ## The @var{output_type} selects the format of the output. This can be either |
8c22a8d42833
__makeinfo__.m: Backout changeset 687872d279be which removes 3rd argument to func.
Rik <rik@octave.org>
parents:
17339
diff
changeset
|
32 ## @t{"html"}, @t{"texinfo"}, or @t{"plain text"}. By default this is |
8c22a8d42833
__makeinfo__.m: Backout changeset 687872d279be which removes 3rd argument to func.
Rik <rik@octave.org>
parents:
17339
diff
changeset
|
33 ## @t{"plain text"}. If @var{output_type} is @t{"texinfo"}, the @t{@@seealso} |
8c22a8d42833
__makeinfo__.m: Backout changeset 687872d279be which removes 3rd argument to func.
Rik <rik@octave.org>
parents:
17339
diff
changeset
|
34 ## macro is expanded, but otherwise the text is unaltered. |
8c22a8d42833
__makeinfo__.m: Backout changeset 687872d279be which removes 3rd argument to func.
Rik <rik@octave.org>
parents:
17339
diff
changeset
|
35 ## |
8c22a8d42833
__makeinfo__.m: Backout changeset 687872d279be which removes 3rd argument to func.
Rik <rik@octave.org>
parents:
17339
diff
changeset
|
36 ## If the optional argument @var{see_also} is present, it is used to expand the |
8c22a8d42833
__makeinfo__.m: Backout changeset 687872d279be which removes 3rd argument to func.
Rik <rik@octave.org>
parents:
17339
diff
changeset
|
37 ## Octave specific @t{@@seealso} macro. This argument must be a function handle, |
8c22a8d42833
__makeinfo__.m: Backout changeset 687872d279be which removes 3rd argument to func.
Rik <rik@octave.org>
parents:
17339
diff
changeset
|
38 ## that accepts a cell array of strings as input argument (each elements of the |
8c22a8d42833
__makeinfo__.m: Backout changeset 687872d279be which removes 3rd argument to func.
Rik <rik@octave.org>
parents:
17339
diff
changeset
|
39 ## array corresponds to the arguments to the @t{@@seealso} macro), and return |
8c22a8d42833
__makeinfo__.m: Backout changeset 687872d279be which removes 3rd argument to func.
Rik <rik@octave.org>
parents:
17339
diff
changeset
|
40 ## the expanded string. If this argument is not given, the @t{@@seealso} macro |
8c22a8d42833
__makeinfo__.m: Backout changeset 687872d279be which removes 3rd argument to func.
Rik <rik@octave.org>
parents:
17339
diff
changeset
|
41 ## will be expanded to the text |
8c22a8d42833
__makeinfo__.m: Backout changeset 687872d279be which removes 3rd argument to func.
Rik <rik@octave.org>
parents:
17339
diff
changeset
|
42 ## |
8c22a8d42833
__makeinfo__.m: Backout changeset 687872d279be which removes 3rd argument to func.
Rik <rik@octave.org>
parents:
17339
diff
changeset
|
43 ## @example |
8c22a8d42833
__makeinfo__.m: Backout changeset 687872d279be which removes 3rd argument to func.
Rik <rik@octave.org>
parents:
17339
diff
changeset
|
44 ## See also: arg1, arg2, ... |
8c22a8d42833
__makeinfo__.m: Backout changeset 687872d279be which removes 3rd argument to func.
Rik <rik@octave.org>
parents:
17339
diff
changeset
|
45 ## @end example |
8c22a8d42833
__makeinfo__.m: Backout changeset 687872d279be which removes 3rd argument to func.
Rik <rik@octave.org>
parents:
17339
diff
changeset
|
46 ## |
8c22a8d42833
__makeinfo__.m: Backout changeset 687872d279be which removes 3rd argument to func.
Rik <rik@octave.org>
parents:
17339
diff
changeset
|
47 ## @noindent |
8c22a8d42833
__makeinfo__.m: Backout changeset 687872d279be which removes 3rd argument to func.
Rik <rik@octave.org>
parents:
17339
diff
changeset
|
48 ## for @t{"plain text"} output, and |
8c22a8d42833
__makeinfo__.m: Backout changeset 687872d279be which removes 3rd argument to func.
Rik <rik@octave.org>
parents:
17339
diff
changeset
|
49 ## |
8c22a8d42833
__makeinfo__.m: Backout changeset 687872d279be which removes 3rd argument to func.
Rik <rik@octave.org>
parents:
17339
diff
changeset
|
50 ## @example |
8c22a8d42833
__makeinfo__.m: Backout changeset 687872d279be which removes 3rd argument to func.
Rik <rik@octave.org>
parents:
17339
diff
changeset
|
51 ## See also: @@ref@{arg1@}, @@ref@{arg2@}, ... |
8c22a8d42833
__makeinfo__.m: Backout changeset 687872d279be which removes 3rd argument to func.
Rik <rik@octave.org>
parents:
17339
diff
changeset
|
52 ## @end example |
8c22a8d42833
__makeinfo__.m: Backout changeset 687872d279be which removes 3rd argument to func.
Rik <rik@octave.org>
parents:
17339
diff
changeset
|
53 ## |
8c22a8d42833
__makeinfo__.m: Backout changeset 687872d279be which removes 3rd argument to func.
Rik <rik@octave.org>
parents:
17339
diff
changeset
|
54 ## @noindent |
8c22a8d42833
__makeinfo__.m: Backout changeset 687872d279be which removes 3rd argument to func.
Rik <rik@octave.org>
parents:
17339
diff
changeset
|
55 ## otherwise. |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff
changeset
|
56 ## |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff
changeset
|
57 ## The optional output argument @var{status} contains the exit status of the |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff
changeset
|
58 ## @code{makeinfo} program as returned by @code{system}. |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff
changeset
|
59 |
17424
8c22a8d42833
__makeinfo__.m: Backout changeset 687872d279be which removes 3rd argument to func.
Rik <rik@octave.org>
parents:
17339
diff
changeset
|
60 function [retval, status] = __makeinfo__ (text, output_type = "plain text", fsee_also) |
8768
e0fbf17a17bb
__makeinfo__.m: rename from makeinfo.m
John W. Eaton <jwe@octave.org>
parents:
8717
diff
changeset
|
61 |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff
changeset
|
62 ## Check input |
17424
8c22a8d42833
__makeinfo__.m: Backout changeset 687872d279be which removes 3rd argument to func.
Rik <rik@octave.org>
parents:
17339
diff
changeset
|
63 if (nargin < 1 || nargin > 3) |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff
changeset
|
64 print_usage (); |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff
changeset
|
65 endif |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
66 |
13122
f80273b38cc4
more fixes to __makeinfo__
Carlo de Falco <kingcrimson@tiscali.it>
parents:
13121
diff
changeset
|
67 if (! ischar (text)) |
8768
e0fbf17a17bb
__makeinfo__.m: rename from makeinfo.m
John W. Eaton <jwe@octave.org>
parents:
8717
diff
changeset
|
68 error ("__makeinfo__: first input argument must be a string"); |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff
changeset
|
69 endif |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
70 |
13122
f80273b38cc4
more fixes to __makeinfo__
Carlo de Falco <kingcrimson@tiscali.it>
parents:
13121
diff
changeset
|
71 if (! ischar (output_type)) |
17424
8c22a8d42833
__makeinfo__.m: Backout changeset 687872d279be which removes 3rd argument to func.
Rik <rik@octave.org>
parents:
17339
diff
changeset
|
72 error ("__makeinfo__: second input argument must be a string"); |
8c22a8d42833
__makeinfo__.m: Backout changeset 687872d279be which removes 3rd argument to func.
Rik <rik@octave.org>
parents:
17339
diff
changeset
|
73 endif |
8c22a8d42833
__makeinfo__.m: Backout changeset 687872d279be which removes 3rd argument to func.
Rik <rik@octave.org>
parents:
17339
diff
changeset
|
74 |
17425
cc7815488981
__makeinfo__.m: Add documentation note to code about use of 3rd argument.
Rik <rik@octave.org>
parents:
17424
diff
changeset
|
75 ## NOTE: The 3rd argument is used by Octave-Forge function |
cc7815488981
__makeinfo__.m: Add documentation note to code about use of 3rd argument.
Rik <rik@octave.org>
parents:
17424
diff
changeset
|
76 ## generate_package_html, not by core Octave. This functionality |
cc7815488981
__makeinfo__.m: Add documentation note to code about use of 3rd argument.
Rik <rik@octave.org>
parents:
17424
diff
changeset
|
77 ## can only be removed when that function has been updated. |
17424
8c22a8d42833
__makeinfo__.m: Backout changeset 687872d279be which removes 3rd argument to func.
Rik <rik@octave.org>
parents:
17339
diff
changeset
|
78 if (nargin < 3) |
8c22a8d42833
__makeinfo__.m: Backout changeset 687872d279be which removes 3rd argument to func.
Rik <rik@octave.org>
parents:
17339
diff
changeset
|
79 if (strcmpi (output_type, "plain text")) |
8c22a8d42833
__makeinfo__.m: Backout changeset 687872d279be which removes 3rd argument to func.
Rik <rik@octave.org>
parents:
17339
diff
changeset
|
80 fsee_also = @(T) strcat ... |
8c22a8d42833
__makeinfo__.m: Backout changeset 687872d279be which removes 3rd argument to func.
Rik <rik@octave.org>
parents:
17339
diff
changeset
|
81 ("\nSee also:", sprintf (" %s,", T{:})(1:end-1), "\n"); |
8c22a8d42833
__makeinfo__.m: Backout changeset 687872d279be which removes 3rd argument to func.
Rik <rik@octave.org>
parents:
17339
diff
changeset
|
82 else |
8c22a8d42833
__makeinfo__.m: Backout changeset 687872d279be which removes 3rd argument to func.
Rik <rik@octave.org>
parents:
17339
diff
changeset
|
83 fsee_also = @(T) strcat ... |
8c22a8d42833
__makeinfo__.m: Backout changeset 687872d279be which removes 3rd argument to func.
Rik <rik@octave.org>
parents:
17339
diff
changeset
|
84 ("\nSee also:", sprintf (" @ref{%s},", T{:})(1:end-1), "\n"); |
8c22a8d42833
__makeinfo__.m: Backout changeset 687872d279be which removes 3rd argument to func.
Rik <rik@octave.org>
parents:
17339
diff
changeset
|
85 endif |
8c22a8d42833
__makeinfo__.m: Backout changeset 687872d279be which removes 3rd argument to func.
Rik <rik@octave.org>
parents:
17339
diff
changeset
|
86 endif |
8c22a8d42833
__makeinfo__.m: Backout changeset 687872d279be which removes 3rd argument to func.
Rik <rik@octave.org>
parents:
17339
diff
changeset
|
87 |
8c22a8d42833
__makeinfo__.m: Backout changeset 687872d279be which removes 3rd argument to func.
Rik <rik@octave.org>
parents:
17339
diff
changeset
|
88 if (! isa (fsee_also, "function_handle")) |
8c22a8d42833
__makeinfo__.m: Backout changeset 687872d279be which removes 3rd argument to func.
Rik <rik@octave.org>
parents:
17339
diff
changeset
|
89 error ("__makeinfo__: third input argument must be a function handle"); |
13121
390add500107
Add back the third input parameter to __makeinfo__
Carlo de Falco <kingcrimson@tiscali.it>
parents:
13120
diff
changeset
|
90 endif |
13141
e81ddf9cacd5
maint: untabify and remove trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
13122
diff
changeset
|
91 |
14360
97883071e8e4
doc: Correct off-by-1 spacings in all .cc docstrings
Rik <octave@nomad.inbox5.com>
parents:
14327
diff
changeset
|
92 ## Formatting in m-files has an extra space at the beginning of every line. |
97883071e8e4
doc: Correct off-by-1 spacings in all .cc docstrings
Rik <octave@nomad.inbox5.com>
parents:
14327
diff
changeset
|
93 ## Remove these unwanted spaces if present. First text char is "\n" delim. |
97883071e8e4
doc: Correct off-by-1 spacings in all .cc docstrings
Rik <octave@nomad.inbox5.com>
parents:
14327
diff
changeset
|
94 if (text(2) == " ") |
97883071e8e4
doc: Correct off-by-1 spacings in all .cc docstrings
Rik <octave@nomad.inbox5.com>
parents:
14327
diff
changeset
|
95 text = strrep (text, "\n ", "\n"); |
97883071e8e4
doc: Correct off-by-1 spacings in all .cc docstrings
Rik <octave@nomad.inbox5.com>
parents:
14327
diff
changeset
|
96 endif |
97883071e8e4
doc: Correct off-by-1 spacings in all .cc docstrings
Rik <octave@nomad.inbox5.com>
parents:
14327
diff
changeset
|
97 ## Texinfo crashes if @end tex does not appear first on the line. |
97883071e8e4
doc: Correct off-by-1 spacings in all .cc docstrings
Rik <octave@nomad.inbox5.com>
parents:
14327
diff
changeset
|
98 text = regexprep (text, '^ +@end tex', '@end tex', 'lineanchors'); |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
99 |
14614
4e9dc46d4125
handle texinfo macros consistently in help system and manual
John W. Eaton <jwe@octave.org>
parents:
14363
diff
changeset
|
100 file = texi_macros_file (); |
4e9dc46d4125
handle texinfo macros consistently in help system and manual
John W. Eaton <jwe@octave.org>
parents:
14363
diff
changeset
|
101 fid = fopen (file, "r"); |
4e9dc46d4125
handle texinfo macros consistently in help system and manual
John W. Eaton <jwe@octave.org>
parents:
14363
diff
changeset
|
102 if (fid < 0) |
4e9dc46d4125
handle texinfo macros consistently in help system and manual
John W. Eaton <jwe@octave.org>
parents:
14363
diff
changeset
|
103 error ("unable to open %s for reading", file); |
4e9dc46d4125
handle texinfo macros consistently in help system and manual
John W. Eaton <jwe@octave.org>
parents:
14363
diff
changeset
|
104 else |
4e9dc46d4125
handle texinfo macros consistently in help system and manual
John W. Eaton <jwe@octave.org>
parents:
14363
diff
changeset
|
105 macros_text = fread (fid, Inf, "*char")'; |
16994
333243133364
Use matrix concatenation for strings, rather than cstrcat(), for clarity and performance.
Rik <rik@octave.org>
parents:
15701
diff
changeset
|
106 text = [macros_text text]; |
14614
4e9dc46d4125
handle texinfo macros consistently in help system and manual
John W. Eaton <jwe@octave.org>
parents:
14363
diff
changeset
|
107 endif |
4e9dc46d4125
handle texinfo macros consistently in help system and manual
John W. Eaton <jwe@octave.org>
parents:
14363
diff
changeset
|
108 fclose (fid); |
10803
75780a2b0417
__makeinfo__.m: Add support to process @nopsell macro.
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
109 |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff
changeset
|
110 if (strcmpi (output_type, "texinfo")) |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff
changeset
|
111 status = 0; |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff
changeset
|
112 retval = text; |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff
changeset
|
113 return; |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff
changeset
|
114 endif |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
115 |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff
changeset
|
116 ## Create the final TeXinfo input string |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff
changeset
|
117 text = sprintf ("\\input texinfo\n\n%s\n\n@bye\n", text); |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
118 |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff
changeset
|
119 unwind_protect |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff
changeset
|
120 ## Write Texinfo to tmp file |
9983 | 121 template = "octave-help-XXXXXX"; |
15701
edce7d75597b
Change .m files to use tempdir instead of P_tmpdir (patch #7875)
Corbin Champion <corbinlc@gmail.com>
parents:
14614
diff
changeset
|
122 [fid, name] = mkstemp (fullfile (tempdir, template), true); |
9982
7cef030b8069
let __makeinfo__ create temporary file in P_tmpdir
Jaroslav Hajek <highegg@gmail.com>
parents:
9263
diff
changeset
|
123 if (fid < 0) |
7cef030b8069
let __makeinfo__ create temporary file in P_tmpdir
Jaroslav Hajek <highegg@gmail.com>
parents:
9263
diff
changeset
|
124 error ("__makeinfo__: could not create temporary file"); |
7cef030b8069
let __makeinfo__ create temporary file in P_tmpdir
Jaroslav Hajek <highegg@gmail.com>
parents:
9263
diff
changeset
|
125 endif |
18745
2633b5f3106a
__makeinfo__: Process Texinfo docstrings without type conversion (bug #41965)
Mike Miller <mtmiller@ieee.org>
parents:
18469
diff
changeset
|
126 fprintf (fid, "%s", text); |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff
changeset
|
127 fclose (fid); |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff
changeset
|
128 |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff
changeset
|
129 ## Take action depending on output type |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff
changeset
|
130 switch (lower (output_type)) |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff
changeset
|
131 case "plain text" |
18469
1500ae1a1bea
__makeinfo__.m: Fix generating HTML output with Texinfo 5.2 (bug #41364).
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
132 cmd = sprintf ("%s --no-headers --no-warn --force --no-validate --output=- %s", |
13121
390add500107
Add back the third input parameter to __makeinfo__
Carlo de Falco <kingcrimson@tiscali.it>
parents:
13120
diff
changeset
|
133 makeinfo_program (), name); |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff
changeset
|
134 case "html" |
18469
1500ae1a1bea
__makeinfo__.m: Fix generating HTML output with Texinfo 5.2 (bug #41364).
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
135 cmd = sprintf ("%s --no-headers --html --no-warn --no-validate --force --output=- %s", |
13121
390add500107
Add back the third input parameter to __makeinfo__
Carlo de Falco <kingcrimson@tiscali.it>
parents:
13120
diff
changeset
|
136 makeinfo_program (), name); |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff
changeset
|
137 otherwise |
8768
e0fbf17a17bb
__makeinfo__.m: rename from makeinfo.m
John W. Eaton <jwe@octave.org>
parents:
8717
diff
changeset
|
138 error ("__makeinfo__: unsupported output type: '%s'", output_type); |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff
changeset
|
139 endswitch |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
140 |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff
changeset
|
141 ## Call makeinfo |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff
changeset
|
142 [status, retval] = system (cmd); |
10803
75780a2b0417
__makeinfo__.m: Add support to process @nopsell macro.
Rik <octave@nomad.inbox5.com>
parents:
10793
diff
changeset
|
143 |
20137
e884d5816471
Remove extra newlines at end of help printout (bug #44504).
Rik <rik@octave.org>
parents:
19898
diff
changeset
|
144 ## Clean up extra newlines generated by makeinfo |
e884d5816471
Remove extra newlines at end of help printout (bug #44504).
Rik <rik@octave.org>
parents:
19898
diff
changeset
|
145 if (strcmpi (output_type, "plain text")) |
e884d5816471
Remove extra newlines at end of help printout (bug #44504).
Rik <rik@octave.org>
parents:
19898
diff
changeset
|
146 if (numel (retval) > 2 && retval(end-1:end) == "\n\n") |
e884d5816471
Remove extra newlines at end of help printout (bug #44504).
Rik <rik@octave.org>
parents:
19898
diff
changeset
|
147 retval = retval(1:end-2); |
e884d5816471
Remove extra newlines at end of help printout (bug #44504).
Rik <rik@octave.org>
parents:
19898
diff
changeset
|
148 endif |
e884d5816471
Remove extra newlines at end of help printout (bug #44504).
Rik <rik@octave.org>
parents:
19898
diff
changeset
|
149 endif |
e884d5816471
Remove extra newlines at end of help printout (bug #44504).
Rik <rik@octave.org>
parents:
19898
diff
changeset
|
150 |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff
changeset
|
151 unwind_protect_cleanup |
8768
e0fbf17a17bb
__makeinfo__.m: rename from makeinfo.m
John W. Eaton <jwe@octave.org>
parents:
8717
diff
changeset
|
152 if (exist (name, "file")) |
e0fbf17a17bb
__makeinfo__.m: rename from makeinfo.m
John W. Eaton <jwe@octave.org>
parents:
8717
diff
changeset
|
153 delete (name); |
e0fbf17a17bb
__makeinfo__.m: rename from makeinfo.m
John W. Eaton <jwe@octave.org>
parents:
8717
diff
changeset
|
154 endif |
8575
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff
changeset
|
155 end_unwind_protect |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff
changeset
|
156 endfunction |
f134925a1cfa
m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff
changeset
|
157 |
14363
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14360
diff
changeset
|
158 |
13044
a04e32272ecb
codesprint: Turn off test warning for various internal helper functions
Rik <octave@nomad.inbox5.com>
parents:
12606
diff
changeset
|
159 ## No test needed for internal helper function. |
a04e32272ecb
codesprint: Turn off test warning for various internal helper functions
Rik <octave@nomad.inbox5.com>
parents:
12606
diff
changeset
|
160 %!assert (1) |
a04e32272ecb
codesprint: Turn off test warning for various internal helper functions
Rik <octave@nomad.inbox5.com>
parents:
12606
diff
changeset
|
161 |