Mercurial > hg > octave-lojdl
comparison scripts/help/__makeinfo__.m @ 17347:687872d279be
__makeinfo__.m: Remove @seealso code made obsolete by cset 4e9dc46d4125.
* scripts/help/__makeinfo__.m: Remove fsee_also definitions and error checking.
Remove fsee_also input from function and redo docstring.
author | Rik <rik@octave.org> |
---|---|
date | Wed, 28 Aug 2013 10:29:03 -0700 |
parents | f4c8c66faf34 |
children | 8c22a8d42833 |
comparison
equal
deleted
inserted
replaced
17346:1c89599167a6 | 17347:687872d279be |
---|---|
15 ## You should have received a copy of the GNU General Public License | 15 ## You should have received a copy of the GNU General Public License |
16 ## along with Octave; see the file COPYING. If not, see | 16 ## along with Octave; see the file COPYING. If not, see |
17 ## <http://www.gnu.org/licenses/>. | 17 ## <http://www.gnu.org/licenses/>. |
18 | 18 |
19 ## -*- texinfo -*- | 19 ## -*- texinfo -*- |
20 ## @deftypefn {Function File} {[@var{retval}, @var{status}] =} __makeinfo__ (@var{text}, @var{output_type}) | 20 ## @deftypefn {Function File} {[@var{retval}, @var{status}] =} __makeinfo__ (@var{text}) |
21 ## @deftypefnx {Function File} {[@var{retval}, @var{status}] =} __makeinfo__ (@var{text}, @var{output_type}, @var{see_also}) | 21 ## @deftypefnx {Function File} {[@var{retval}, @var{status}] =} __makeinfo__ (@var{text}, @var{output_type}) |
22 ## Undocumented internal function. | 22 ## Undocumented internal function. |
23 ## @end deftypefn | 23 ## @end deftypefn |
24 | 24 |
25 ## Run @code{makeinfo} on a given text. | 25 ## Run @code{makeinfo} on a given text. |
26 ## | 26 ## |
27 ## The string @var{text} is run through the @code{__makeinfo__} program | 27 ## The string @var{text} is run through the @code{__makeinfo__} program |
28 ## to generate output in various formats. This string must contain valid | 28 ## to generate output in various formats. This string must contain valid |
29 ## Texinfo formatted text. | 29 ## Texinfo formatted text. |
30 ## | 30 ## |
31 ## The @var{output_type} selects the format of the output. This can be either | 31 ## The @var{output_type} selects the format of the output. This can be either |
32 ## @t{"html"}, @t{"texinfo"}, or @t{"plain text"}. By default this is | 32 ## @qcode{"html"}, @qcode{"texinfo"}, or @qcode{"plain text"}. By default this |
33 ## @t{"plain text"}. If @var{output_type} is @t{"texinfo"}, the @t{@@seealso} | 33 ## is @qcode{"plain text"}. |
34 ## macro is expanded, but otherwise the text is unaltered. | |
35 ## | |
36 ## If the optional argument @var{see_also} is present, it is used to expand the | |
37 ## Octave specific @t{@@seealso} macro. This argument must be a function handle, | |
38 ## that accepts a cell array of strings as input argument (each elements of the | |
39 ## array corresponds to the arguments to the @t{@@seealso} macro), and return | |
40 ## the expanded string. If this argument is not given, the @t{@@seealso} macro | |
41 ## will be expanded to the text | |
42 ## | |
43 ## @example | |
44 ## See also: arg1, arg2, ... | |
45 ## @end example | |
46 ## | |
47 ## @noindent | |
48 ## for @t{"plain text"} output, and | |
49 ## | |
50 ## @example | |
51 ## See also: @@ref@{arg1@}, @@ref@{arg2@}, ... | |
52 ## @end example | |
53 ## | |
54 ## @noindent | |
55 ## otherwise. | |
56 ## | 34 ## |
57 ## The optional output argument @var{status} contains the exit status of the | 35 ## The optional output argument @var{status} contains the exit status of the |
58 ## @code{makeinfo} program as returned by @code{system}. | 36 ## @code{makeinfo} program as returned by @code{system}. |
59 | 37 |
60 function [retval, status] = __makeinfo__ (text, output_type = "plain text", fsee_also) | 38 function [retval, status] = __makeinfo__ (text, output_type = "plain text") |
61 | 39 |
62 ## Check input | 40 ## Check input |
63 if (nargin < 1 || nargin > 3) | 41 if (nargin < 1 || nargin > 2) |
64 print_usage (); | 42 print_usage (); |
65 endif | 43 endif |
66 | 44 |
67 if (! ischar (text)) | 45 if (! ischar (text)) |
68 error ("__makeinfo__: first input argument must be a string"); | 46 error ("__makeinfo__: first input argument must be a string"); |
69 endif | 47 endif |
70 | 48 |
71 if (! ischar (output_type)) | 49 if (! ischar (output_type)) |
72 error ("__makeinfo__: second input argument must be a string"); | 50 error ("__makeinfo__: OUTPUT_TYPE must be a string"); |
73 endif | |
74 | |
75 if (nargin < 3) | |
76 if (strcmpi (output_type, "plain text")) | |
77 fsee_also = @(T) strcat ... | |
78 ("\nSee also:", sprintf (" %s,", T{:})(1:end-1), "\n"); | |
79 else | |
80 fsee_also = @(T) strcat ... | |
81 ("\nSee also:", sprintf (" @ref{%s},", T{:})(1:end-1), "\n"); | |
82 endif | |
83 endif | |
84 | |
85 if (! isa (fsee_also, "function_handle")) | |
86 error ("__makeinfo__: third input argument must be a function handle"); | |
87 endif | 51 endif |
88 | 52 |
89 ## Formatting in m-files has an extra space at the beginning of every line. | 53 ## Formatting in m-files has an extra space at the beginning of every line. |
90 ## Remove these unwanted spaces if present. First text char is "\n" delim. | 54 ## Remove these unwanted spaces if present. First text char is "\n" delim. |
91 if (text(2) == " ") | 55 if (text(2) == " ") |
124 fclose (fid); | 88 fclose (fid); |
125 | 89 |
126 ## Take action depending on output type | 90 ## Take action depending on output type |
127 switch (lower (output_type)) | 91 switch (lower (output_type)) |
128 case "plain text" | 92 case "plain text" |
129 cmd = sprintf ("%s --no-headers --no-warn --force --no-validate %s", | 93 cmd = sprintf ("%s --no-headers --no-warn --no-validate --force %s", |
130 makeinfo_program (), name); | 94 makeinfo_program (), name); |
131 case "html" | 95 case "html" |
132 cmd = sprintf ("%s --no-headers --html --no-warn --no-validate --force %s", | 96 cmd = sprintf ("%s --html --no-headers --no-warn --no-validate --force %s", |
133 makeinfo_program (), name); | 97 makeinfo_program (), name); |
134 otherwise | 98 otherwise |
135 error ("__makeinfo__: unsupported output type: '%s'", output_type); | 99 error ("__makeinfo__: unsupported output type: '%s'", output_type); |
136 endswitch | 100 endswitch |
137 | 101 |