annotate scripts/help/print_usage.m @ 30244:4fe897f5db8e

print_usage.m: Fix error on invalid texinfo (bug #61363). * scripts/help/print_usage.m (get_usage_texinfo): Do not call __makeinfo__ if help string doesn't contain a @def* macro.
author Markus Mützel <markus.muetzel@gmx.de>
date Thu, 21 Oct 2021 16:42:38 +0200
parents 7854d5752dd2
children 63147d7d53a0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
1 ########################################################################
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
2 ##
29358
0a5b15007766 update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents: 27923
diff changeset
3 ## Copyright (C) 2009-2021 The Octave Project Developers
27918
b442ec6dda5c use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents: 26691
diff changeset
4 ##
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
5 ## See the file COPYRIGHT.md in the top-level directory of this
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
6 ## distribution or <https://octave.org/copyright/>.
8575
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
7 ##
11104
2c356a35d7f5 fix copyright notices
John W. Eaton <jwe@octave.org>
parents: 10793
diff changeset
8 ## This file is part of Octave.
2c356a35d7f5 fix copyright notices
John W. Eaton <jwe@octave.org>
parents: 10793
diff changeset
9 ##
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 23220
diff changeset
10 ## 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
11 ## under the terms of the GNU General Public License as published by
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 23220
diff changeset
12 ## the Free Software Foundation, either version 3 of the License, or
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22323
diff changeset
13 ## (at your option) any later version.
8575
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
14 ##
11104
2c356a35d7f5 fix copyright notices
John W. Eaton <jwe@octave.org>
parents: 10793
diff changeset
15 ## 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
16 ## WITHOUT ANY WARRANTY; without even the implied warranty of
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22323
diff changeset
17 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22323
diff changeset
18 ## GNU General Public License for more details.
8575
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
19 ##
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
20 ## You should have received a copy of the GNU General Public License
11104
2c356a35d7f5 fix copyright notices
John W. Eaton <jwe@octave.org>
parents: 10793
diff changeset
21 ## along with Octave; see the file COPYING. If not, see
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 23220
diff changeset
22 ## <https://www.gnu.org/licenses/>.
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
23 ##
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
24 ########################################################################
8575
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
25
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
26 ## -*- texinfo -*-
20852
516bb87ea72e 2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents: 20778
diff changeset
27 ## @deftypefn {} {} print_usage ()
516bb87ea72e 2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents: 20778
diff changeset
28 ## @deftypefnx {} {} print_usage (@var{name})
20158
7503499a252b doc: Update docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents: 19833
diff changeset
29 ## Print the usage message for the function @var{name}.
7503499a252b doc: Update docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents: 19833
diff changeset
30 ##
7503499a252b doc: Update docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents: 19833
diff changeset
31 ## When called with no input arguments the @code{print_usage} function displays
7503499a252b doc: Update docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents: 19833
diff changeset
32 ## the usage message of the currently executing function.
8575
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
33 ## @seealso{help}
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
34 ## @end deftypefn
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
35
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
36 function print_usage (name)
21758
ffad2baa90f7 maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents: 21751
diff changeset
37
10131
30817aa3889a allow print_usage to print backtrace if called from functions
Jaroslav Hajek <highegg@gmail.com>
parents: 9535
diff changeset
38 x = dbstack ();
8575
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
39 ## Handle input
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
40 if (nargin == 0)
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
41 ## Determine the name of the calling function
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
42 if (numel (x) > 1)
17100
ae7872816611 print_usage.m: Fix handling of functions with multiple @deftypefn/@end deftypefn pairs.
Rik <rik@octave.org>
parents: 15559
diff changeset
43 name = x(2).name;
8575
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
44 else
15559
6f3363ff368c print_usage.m: Adding error identifiers.
Juan Pablo Carbajal (desktop) <ajuanpi+dev@gmail.com>
parents: 15466
diff changeset
45 error ("Octave:invalid-context", "print_usage: invalid function\n");
8575
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
46 endif
26691
f2bb4f2093b9 Fix print_usage() messages in subfunctions (bug #55599).
Rik <rik@octave.org>
parents: 26376
diff changeset
47 fullname = evalin ("caller", 'mfilename ("fullpath")');
28912
0de38a6ef693 maint: Use Octave convention of space after function name in scripts dir.
Rik <rik@octave.org>
parents: 27923
diff changeset
48 if (strcmp (fullname(end-length (name)+1:end), name))
26691
f2bb4f2093b9 Fix print_usage() messages in subfunctions (bug #55599).
Rik <rik@octave.org>
parents: 26376
diff changeset
49 fullname = [fullname ".m"];
9530
f3df413338c5 print_usage: support calling from methods
Jaroslav Hajek <highegg@gmail.com>
parents: 8768
diff changeset
50 endif
17100
ae7872816611 print_usage.m: Fix handling of functions with multiple @deftypefn/@end deftypefn pairs.
Rik <rik@octave.org>
parents: 15559
diff changeset
51 elseif (! ischar (name))
15559
6f3363ff368c print_usage.m: Adding error identifiers.
Juan Pablo Carbajal (desktop) <ajuanpi+dev@gmail.com>
parents: 15466
diff changeset
52 error ("Octave:invalid-input-arg",
17100
ae7872816611 print_usage.m: Fix handling of functions with multiple @deftypefn/@end deftypefn pairs.
Rik <rik@octave.org>
parents: 15559
diff changeset
53 "print_usage: input argument must be a string");
9535
936734e15a4d print_usage: make it work again if an argument is given
John W. Eaton <jwe@octave.org>
parents: 9530
diff changeset
54 else
936734e15a4d print_usage: make it work again if an argument is given
John W. Eaton <jwe@octave.org>
parents: 9530
diff changeset
55 fullname = name;
8575
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
56 endif
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
57
17100
ae7872816611 print_usage.m: Fix handling of functions with multiple @deftypefn/@end deftypefn pairs.
Rik <rik@octave.org>
parents: 15559
diff changeset
58 ## Determine if we were called from top level.
10131
30817aa3889a allow print_usage to print backtrace if called from functions
Jaroslav Hajek <highegg@gmail.com>
parents: 9535
diff changeset
59 at_toplev = length (x) < 2 || (length (x) == 2 && strcmp (x(2).name, name));
30817aa3889a allow print_usage to print backtrace if called from functions
Jaroslav Hajek <highegg@gmail.com>
parents: 9535
diff changeset
60
8575
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
61 ## Do the actual work
9535
936734e15a4d print_usage: make it work again if an argument is given
John W. Eaton <jwe@octave.org>
parents: 9530
diff changeset
62 [text, format] = get_help_text (fullname);
8575
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
63 max_len = 80;
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
64 switch (lower (format))
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
65 case "plain text"
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
66 [usage_string, status] = get_usage_plain_text (text, max_len);
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
67 case "texinfo"
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
68 [usage_string, status] = get_usage_texinfo (text, max_len);
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
69 case "html"
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
70 [usage_string, status] = get_usage_html (text, max_len);
8631
52956d669506 Display sensible error message when the help text of an undocumented function is requested
Soren Hauberg <hauberg@gmail.com>
parents: 8575
diff changeset
71 case "not documented"
15466
d174210ce1ec use ' instead of ` in error messages, warnings and most comments
John W. Eaton <jwe@octave.org>
parents: 14138
diff changeset
72 error ("print_usage: '%s' is not documented\n", name);
8575
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
73 case "not found"
15466
d174210ce1ec use ' instead of ` in error messages, warnings and most comments
John W. Eaton <jwe@octave.org>
parents: 14138
diff changeset
74 error ("print_usage: '%s' not found\n", name);
8575
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
75 otherwise
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
76 error ("print_usage: internal error: unsupported help text format: '%s'\n", format);
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
77 endswitch
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
78
8575
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
79 ## Raise the final error
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
80 if (status != 0)
8768
e0fbf17a17bb __makeinfo__.m: rename from makeinfo.m
John W. Eaton <jwe@octave.org>
parents: 8631
diff changeset
81 warning ("print_usage: Texinfo formatting filter exited abnormally");
e0fbf17a17bb __makeinfo__.m: rename from makeinfo.m
John W. Eaton <jwe@octave.org>
parents: 8631
diff changeset
82 warning ("print_usage: raw Texinfo source of help text follows...\n");
8575
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
83 endif
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
84
10131
30817aa3889a allow print_usage to print backtrace if called from functions
Jaroslav Hajek <highegg@gmail.com>
parents: 9535
diff changeset
85 if (at_toplev)
17100
ae7872816611 print_usage.m: Fix handling of functions with multiple @deftypefn/@end deftypefn pairs.
Rik <rik@octave.org>
parents: 15559
diff changeset
86 error ("Octave:invalid-fun-call",
ae7872816611 print_usage.m: Fix handling of functions with multiple @deftypefn/@end deftypefn pairs.
Rik <rik@octave.org>
parents: 15559
diff changeset
87 "Invalid call to %s. Correct usage is:\n\n%s\n%s",
10131
30817aa3889a allow print_usage to print backtrace if called from functions
Jaroslav Hajek <highegg@gmail.com>
parents: 9535
diff changeset
88 name, usage_string, __additional_help_message__ ());
30817aa3889a allow print_usage to print backtrace if called from functions
Jaroslav Hajek <highegg@gmail.com>
parents: 9535
diff changeset
89 else
30817aa3889a allow print_usage to print backtrace if called from functions
Jaroslav Hajek <highegg@gmail.com>
parents: 9535
diff changeset
90 msg = sprintf ("Invalid call to %s. Correct usage is:\n\n%s",
30817aa3889a allow print_usage to print backtrace if called from functions
Jaroslav Hajek <highegg@gmail.com>
parents: 9535
diff changeset
91 name, usage_string);
30817aa3889a allow print_usage to print backtrace if called from functions
Jaroslav Hajek <highegg@gmail.com>
parents: 9535
diff changeset
92 ## Ensure that the error doesn't end up with a newline, as that disables
30817aa3889a allow print_usage to print backtrace if called from functions
Jaroslav Hajek <highegg@gmail.com>
parents: 9535
diff changeset
93 ## backtraces.
30817aa3889a allow print_usage to print backtrace if called from functions
Jaroslav Hajek <highegg@gmail.com>
parents: 9535
diff changeset
94 if (msg(end) == "\n")
30817aa3889a allow print_usage to print backtrace if called from functions
Jaroslav Hajek <highegg@gmail.com>
parents: 9535
diff changeset
95 msg(end) = " ";
30817aa3889a allow print_usage to print backtrace if called from functions
Jaroslav Hajek <highegg@gmail.com>
parents: 9535
diff changeset
96 endif
30817aa3889a allow print_usage to print backtrace if called from functions
Jaroslav Hajek <highegg@gmail.com>
parents: 9535
diff changeset
97
15559
6f3363ff368c print_usage.m: Adding error identifiers.
Juan Pablo Carbajal (desktop) <ajuanpi+dev@gmail.com>
parents: 15466
diff changeset
98 error ("Octave:invalid-fun-call", msg);
10131
30817aa3889a allow print_usage to print backtrace if called from functions
Jaroslav Hajek <highegg@gmail.com>
parents: 9535
diff changeset
99 endif
30817aa3889a allow print_usage to print backtrace if called from functions
Jaroslav Hajek <highegg@gmail.com>
parents: 9535
diff changeset
100
8575
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
101 endfunction
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
102
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
103 function [retval, status] = get_usage_plain_text (help_text, max_len)
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
104 ## Extract first line by searching for a double line-end.
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
105 line_end_idx = strfind (help_text, "\n\n");
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
106 retval = help_text (1:min ([line_end_idx , max_len, length(help_text)]));
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
107 status = 0;
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
108 endfunction
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
109
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
110 function [retval, status] = get_usage_texinfo (help_text, max_len)
21758
ffad2baa90f7 maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents: 21751
diff changeset
111
8575
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
112 ## Lines ending with "@\n" are continuation lines, so they should be
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
113 ## concatenated with the following line.
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
114 help_text = strrep (help_text, "@\n", " ");
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
115
21751
b571fc85953f maint: Use two spaces after period to indicate sentence break.
Rik <rik@octave.org>
parents: 20852
diff changeset
116 ## Find, and keep, lines that start with @def or @end def. This should
17100
ae7872816611 print_usage.m: Fix handling of functions with multiple @deftypefn/@end deftypefn pairs.
Rik <rik@octave.org>
parents: 15559
diff changeset
117 ## include things such as @deftypefn, @deftypefnx, @defvar, etc. and their
ae7872816611 print_usage.m: Fix handling of functions with multiple @deftypefn/@end deftypefn pairs.
Rik <rik@octave.org>
parents: 15559
diff changeset
118 ## corresponding @end's.
8575
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
119 def_idx = strfind (help_text, "@def");
30244
4fe897f5db8e print_usage.m: Fix error on invalid texinfo (bug #61363).
Markus Mützel <markus.muetzel@gmx.de>
parents: 29359
diff changeset
120 if (isempty (def_idx))
8575
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
121 [retval, status] = get_usage_plain_text (help_text, max_len);
30244
4fe897f5db8e print_usage.m: Fix error on invalid texinfo (bug #61363).
Markus Mützel <markus.muetzel@gmx.de>
parents: 29359
diff changeset
122 return;
8575
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
123 endif
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
124
30244
4fe897f5db8e print_usage.m: Fix error on invalid texinfo (bug #61363).
Markus Mützel <markus.muetzel@gmx.de>
parents: 29359
diff changeset
125 endf_idx = strfind (help_text, "@end def");
4fe897f5db8e print_usage.m: Fix error on invalid texinfo (bug #61363).
Markus Mützel <markus.muetzel@gmx.de>
parents: 29359
diff changeset
126 def_idx = sort ([def_idx, endf_idx]);
4fe897f5db8e print_usage.m: Fix error on invalid texinfo (bug #61363).
Markus Mützel <markus.muetzel@gmx.de>
parents: 29359
diff changeset
127 endl_idx = find (help_text == "\n");
4fe897f5db8e print_usage.m: Fix error on invalid texinfo (bug #61363).
Markus Mützel <markus.muetzel@gmx.de>
parents: 29359
diff changeset
128 buffer = "";
4fe897f5db8e print_usage.m: Fix error on invalid texinfo (bug #61363).
Markus Mützel <markus.muetzel@gmx.de>
parents: 29359
diff changeset
129 for k = 1:length (def_idx)
4fe897f5db8e print_usage.m: Fix error on invalid texinfo (bug #61363).
Markus Mützel <markus.muetzel@gmx.de>
parents: 29359
diff changeset
130 endl = endl_idx(find (endl_idx > def_idx(k), 1));
4fe897f5db8e print_usage.m: Fix error on invalid texinfo (bug #61363).
Markus Mützel <markus.muetzel@gmx.de>
parents: 29359
diff changeset
131 if (isempty (endl))
4fe897f5db8e print_usage.m: Fix error on invalid texinfo (bug #61363).
Markus Mützel <markus.muetzel@gmx.de>
parents: 29359
diff changeset
132 buffer = [buffer, help_text(def_idx(k):end), "\n"];
4fe897f5db8e print_usage.m: Fix error on invalid texinfo (bug #61363).
Markus Mützel <markus.muetzel@gmx.de>
parents: 29359
diff changeset
133 else
4fe897f5db8e print_usage.m: Fix error on invalid texinfo (bug #61363).
Markus Mützel <markus.muetzel@gmx.de>
parents: 29359
diff changeset
134 buffer = [buffer, help_text(def_idx(k):endl)];
4fe897f5db8e print_usage.m: Fix error on invalid texinfo (bug #61363).
Markus Mützel <markus.muetzel@gmx.de>
parents: 29359
diff changeset
135 endif
4fe897f5db8e print_usage.m: Fix error on invalid texinfo (bug #61363).
Markus Mützel <markus.muetzel@gmx.de>
parents: 29359
diff changeset
136 endfor
4fe897f5db8e print_usage.m: Fix error on invalid texinfo (bug #61363).
Markus Mützel <markus.muetzel@gmx.de>
parents: 29359
diff changeset
137
8575
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
138 ## Run makeinfo to generate plain text
8768
e0fbf17a17bb __makeinfo__.m: rename from makeinfo.m
John W. Eaton <jwe@octave.org>
parents: 8631
diff changeset
139 [retval, status] = __makeinfo__ (buffer, "plain text");
21758
ffad2baa90f7 maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents: 21751
diff changeset
140
8575
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
141 endfunction
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
142
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
143 function [retval, status] = get_usage_html (help_text, max_len)
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
144 ## Strip tags
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
145 [help_text, status] = strip_html_tags (help_text);
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11523
diff changeset
146
8575
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
147 ## Extract first line with plain text method.
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
148 retval = get_usage_plain_text (help_text, max_len);
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
149 endfunction
f134925a1cfa m-file implementation of help system
Soren Hauberg <soren@hauberg.org>
parents:
diff changeset
150
12830
208f0a181be6 codesprint: Stop reporting print_usage() as missing tests.
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
151
208f0a181be6 codesprint: Stop reporting print_usage() as missing tests.
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
152 ## Stop reporting function as missing tests. No good tests possible.
208f0a181be6 codesprint: Stop reporting print_usage() as missing tests.
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
153 %!assert (1)