Mercurial > hg > octave-nkf
annotate scripts/help/doc.m @ 17243:f4c8c66faf34
maint: Update source file encodings to UTF-8 and fix character errors
* scripts/help/doc.m, scripts/help/lookfor.m,
scripts/help/private/__additional_help_message__.m,
scripts/help/private/__strip_html_tags__.m, scripts/miscellaneous/tar.m,
scripts/miscellaneous/untar.m, scripts/miscellaneous/unzip.m: Update
file encoding to UTF-8.
* etc/OLD-ChangeLogs/scripts-ChangeLog, scripts/geometry/inpolygon.m,
scripts/help/__makeinfo__.m, scripts/help/doc_cache_create.m,
scripts/help/get_first_help_sentence.m, scripts/help/help.m,
scripts/help/print_usage.m, scripts/help/type.m, scripts/pkg/pkg.m:
Restore correct characters in contributor names instead of UTF-8
replacement character.
author | Mike Miller <mtmiller@ieee.org> |
---|---|
date | Wed, 14 Aug 2013 00:13:40 -0400 |
parents | 359c5ca795cd |
children | b81b9d079515 |
rev | line source |
---|---|
17243
f4c8c66faf34
maint: Update source file encodings to UTF-8 and fix character errors
Mike Miller <mtmiller@ieee.org>
parents:
17029
diff
changeset
|
1 ## Copyright (C) 2005-2012 Søren Hauberg |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11547
diff
changeset
|
2 ## |
7016 | 3 ## This file is part of Octave. |
4 ## | |
5 ## Octave is free software; you can redistribute it and/or modify it | |
6 ## under the terms of the GNU General Public License as published by | |
7 ## the Free Software Foundation; either version 3 of the License, or (at | |
8 ## your option) any later version. | |
9 ## | |
10 ## Octave is distributed in the hope that it will be useful, but | |
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 ## General Public License for more details. | |
14 ## | |
5672 | 15 ## You should have received a copy of the GNU General Public License |
7016 | 16 ## along with Octave; see the file COPYING. If not, see |
17 ## <http://www.gnu.org/licenses/>. | |
5672 | 18 |
19 ## -*- texinfo -*- | |
11547 | 20 ## @deftypefn {Command} {} doc @var{function_name} |
6615 | 21 ## Display documentation for the function @var{function_name} |
15544
6a4e79110857
doc: Replace 'on-line' with modern 'online' in documentation and messages.
Rik <rik@octave.org>
parents:
15466
diff
changeset
|
22 ## directly from an online version of |
6615 | 23 ## the printed manual, using the GNU Info browser. If invoked without |
24 ## any arguments, the manual is shown from the beginning. | |
25 ## | |
26 ## For example, the command @kbd{doc rand} starts the GNU Info browser | |
15544
6a4e79110857
doc: Replace 'on-line' with modern 'online' in documentation and messages.
Rik <rik@octave.org>
parents:
15466
diff
changeset
|
27 ## at the @code{rand} node in the online version of the manual. |
6615 | 28 ## |
29 ## Once the GNU Info browser is running, help for using it is available | |
30 ## using the command @kbd{C-h}. | |
5672 | 31 ## @seealso{help} |
11547 | 32 ## @end deftypefn |
5672 | 33 |
34 ## Author: Soren Hauberg <soren@hauberg.org> | |
35 ## Adapted-by: jwe | |
36 | |
37 function retval = doc (fname) | |
38 | |
5830 | 39 if (nargin == 0 || nargin == 1) |
40 | |
41 ftype = 0; | |
42 | |
43 if (nargin == 1) | |
44 ## Get the directory where the function lives. | |
45 ## FIXME -- maybe we should have a better way of doing this. | |
5672 | 46 |
5830 | 47 if (ischar (fname)) |
10549 | 48 ftype = exist (fname); |
5830 | 49 else |
10549 | 50 error ("doc: expecting argument to be a character string"); |
5830 | 51 endif |
52 else | |
53 fname = ""; | |
54 endif | |
5672 | 55 |
17029
359c5ca795cd
Display doc info pages using documentation browser when in GUI mode (Bug #39451)
John Donoghue <john.donoghue@ieee.org>
parents:
15545
diff
changeset
|
56 # if GUI is running, let it display the function |
359c5ca795cd
Display doc info pages using documentation browser when in GUI mode (Bug #39451)
John Donoghue <john.donoghue@ieee.org>
parents:
15545
diff
changeset
|
57 if isguirunning () |
359c5ca795cd
Display doc info pages using documentation browser when in GUI mode (Bug #39451)
John Donoghue <john.donoghue@ieee.org>
parents:
15545
diff
changeset
|
58 __octave_link_show_doc__ (fname); |
5830 | 59 else |
17029
359c5ca795cd
Display doc info pages using documentation browser when in GUI mode (Bug #39451)
John Donoghue <john.donoghue@ieee.org>
parents:
15545
diff
changeset
|
60 |
359c5ca795cd
Display doc info pages using documentation browser when in GUI mode (Bug #39451)
John Donoghue <john.donoghue@ieee.org>
parents:
15545
diff
changeset
|
61 if (ftype == 2 || ftype == 3) |
359c5ca795cd
Display doc info pages using documentation browser when in GUI mode (Bug #39451)
John Donoghue <john.donoghue@ieee.org>
parents:
15545
diff
changeset
|
62 ffile = which (fname); |
359c5ca795cd
Display doc info pages using documentation browser when in GUI mode (Bug #39451)
John Donoghue <john.donoghue@ieee.org>
parents:
15545
diff
changeset
|
63 else |
359c5ca795cd
Display doc info pages using documentation browser when in GUI mode (Bug #39451)
John Donoghue <john.donoghue@ieee.org>
parents:
15545
diff
changeset
|
64 ffile = ""; |
359c5ca795cd
Display doc info pages using documentation browser when in GUI mode (Bug #39451)
John Donoghue <john.donoghue@ieee.org>
parents:
15545
diff
changeset
|
65 endif |
5830 | 66 |
17029
359c5ca795cd
Display doc info pages using documentation browser when in GUI mode (Bug #39451)
John Donoghue <john.donoghue@ieee.org>
parents:
15545
diff
changeset
|
67 if (isempty (ffile)) |
359c5ca795cd
Display doc info pages using documentation browser when in GUI mode (Bug #39451)
John Donoghue <john.donoghue@ieee.org>
parents:
15545
diff
changeset
|
68 info_dir = octave_config_info ("infodir"); |
359c5ca795cd
Display doc info pages using documentation browser when in GUI mode (Bug #39451)
John Donoghue <john.donoghue@ieee.org>
parents:
15545
diff
changeset
|
69 else |
359c5ca795cd
Display doc info pages using documentation browser when in GUI mode (Bug #39451)
John Donoghue <john.donoghue@ieee.org>
parents:
15545
diff
changeset
|
70 info_dir = fileparts (ffile); |
359c5ca795cd
Display doc info pages using documentation browser when in GUI mode (Bug #39451)
John Donoghue <john.donoghue@ieee.org>
parents:
15545
diff
changeset
|
71 endif |
5830 | 72 |
17029
359c5ca795cd
Display doc info pages using documentation browser when in GUI mode (Bug #39451)
John Donoghue <john.donoghue@ieee.org>
parents:
15545
diff
changeset
|
73 ## Determine if a file called doc.info exist in the same |
359c5ca795cd
Display doc info pages using documentation browser when in GUI mode (Bug #39451)
John Donoghue <john.donoghue@ieee.org>
parents:
15545
diff
changeset
|
74 ## directory as the function. |
359c5ca795cd
Display doc info pages using documentation browser when in GUI mode (Bug #39451)
John Donoghue <john.donoghue@ieee.org>
parents:
15545
diff
changeset
|
75 |
359c5ca795cd
Display doc info pages using documentation browser when in GUI mode (Bug #39451)
John Donoghue <john.donoghue@ieee.org>
parents:
15545
diff
changeset
|
76 info_file_name = fullfile (info_dir, "doc.info"); |
359c5ca795cd
Display doc info pages using documentation browser when in GUI mode (Bug #39451)
John Donoghue <john.donoghue@ieee.org>
parents:
15545
diff
changeset
|
77 |
359c5ca795cd
Display doc info pages using documentation browser when in GUI mode (Bug #39451)
John Donoghue <john.donoghue@ieee.org>
parents:
15545
diff
changeset
|
78 [stat_info, err] = stat (info_file_name); |
5830 | 79 |
17029
359c5ca795cd
Display doc info pages using documentation browser when in GUI mode (Bug #39451)
John Donoghue <john.donoghue@ieee.org>
parents:
15545
diff
changeset
|
80 if (err < 0) |
359c5ca795cd
Display doc info pages using documentation browser when in GUI mode (Bug #39451)
John Donoghue <john.donoghue@ieee.org>
parents:
15545
diff
changeset
|
81 info_file_name = info_file (); |
359c5ca795cd
Display doc info pages using documentation browser when in GUI mode (Bug #39451)
John Donoghue <john.donoghue@ieee.org>
parents:
15545
diff
changeset
|
82 endif |
359c5ca795cd
Display doc info pages using documentation browser when in GUI mode (Bug #39451)
John Donoghue <john.donoghue@ieee.org>
parents:
15545
diff
changeset
|
83 |
359c5ca795cd
Display doc info pages using documentation browser when in GUI mode (Bug #39451)
John Donoghue <john.donoghue@ieee.org>
parents:
15545
diff
changeset
|
84 ## FIXME -- don't change the order of the arguments below because |
359c5ca795cd
Display doc info pages using documentation browser when in GUI mode (Bug #39451)
John Donoghue <john.donoghue@ieee.org>
parents:
15545
diff
changeset
|
85 ## the info-emacs-info script currently expects --directory DIR as |
359c5ca795cd
Display doc info pages using documentation browser when in GUI mode (Bug #39451)
John Donoghue <john.donoghue@ieee.org>
parents:
15545
diff
changeset
|
86 ## the third and fourth arguments. Someone should fix that. |
359c5ca795cd
Display doc info pages using documentation browser when in GUI mode (Bug #39451)
John Donoghue <john.donoghue@ieee.org>
parents:
15545
diff
changeset
|
87 |
359c5ca795cd
Display doc info pages using documentation browser when in GUI mode (Bug #39451)
John Donoghue <john.donoghue@ieee.org>
parents:
15545
diff
changeset
|
88 cmd = sprintf ("\"%s\" --file \"%s\" --directory \"%s\"", |
359c5ca795cd
Display doc info pages using documentation browser when in GUI mode (Bug #39451)
John Donoghue <john.donoghue@ieee.org>
parents:
15545
diff
changeset
|
89 info_program (), info_file_name, info_dir); |
359c5ca795cd
Display doc info pages using documentation browser when in GUI mode (Bug #39451)
John Donoghue <john.donoghue@ieee.org>
parents:
15545
diff
changeset
|
90 |
359c5ca795cd
Display doc info pages using documentation browser when in GUI mode (Bug #39451)
John Donoghue <john.donoghue@ieee.org>
parents:
15545
diff
changeset
|
91 have_fname = ! isempty (fname); |
6017 | 92 |
17029
359c5ca795cd
Display doc info pages using documentation browser when in GUI mode (Bug #39451)
John Donoghue <john.donoghue@ieee.org>
parents:
15545
diff
changeset
|
93 if (have_fname) |
359c5ca795cd
Display doc info pages using documentation browser when in GUI mode (Bug #39451)
John Donoghue <john.donoghue@ieee.org>
parents:
15545
diff
changeset
|
94 status = system (sprintf ("%s --index-search \"%s\"", cmd, fname)); |
359c5ca795cd
Display doc info pages using documentation browser when in GUI mode (Bug #39451)
John Donoghue <john.donoghue@ieee.org>
parents:
15545
diff
changeset
|
95 endif |
359c5ca795cd
Display doc info pages using documentation browser when in GUI mode (Bug #39451)
John Donoghue <john.donoghue@ieee.org>
parents:
15545
diff
changeset
|
96 |
5672 | 97 |
17029
359c5ca795cd
Display doc info pages using documentation browser when in GUI mode (Bug #39451)
John Donoghue <john.donoghue@ieee.org>
parents:
15545
diff
changeset
|
98 if (! (have_fname && status == 0)) |
359c5ca795cd
Display doc info pages using documentation browser when in GUI mode (Bug #39451)
John Donoghue <john.donoghue@ieee.org>
parents:
15545
diff
changeset
|
99 status = system (cmd); |
359c5ca795cd
Display doc info pages using documentation browser when in GUI mode (Bug #39451)
John Donoghue <john.donoghue@ieee.org>
parents:
15545
diff
changeset
|
100 if (status == 127) |
359c5ca795cd
Display doc info pages using documentation browser when in GUI mode (Bug #39451)
John Donoghue <john.donoghue@ieee.org>
parents:
15545
diff
changeset
|
101 warning ("unable to find info program '%s'", info_program ()); |
359c5ca795cd
Display doc info pages using documentation browser when in GUI mode (Bug #39451)
John Donoghue <john.donoghue@ieee.org>
parents:
15545
diff
changeset
|
102 endif |
359c5ca795cd
Display doc info pages using documentation browser when in GUI mode (Bug #39451)
John Donoghue <john.donoghue@ieee.org>
parents:
15545
diff
changeset
|
103 endif |
6344 | 104 |
17029
359c5ca795cd
Display doc info pages using documentation browser when in GUI mode (Bug #39451)
John Donoghue <john.donoghue@ieee.org>
parents:
15545
diff
changeset
|
105 if (nargout > 0) |
359c5ca795cd
Display doc info pages using documentation browser when in GUI mode (Bug #39451)
John Donoghue <john.donoghue@ieee.org>
parents:
15545
diff
changeset
|
106 retval = status; |
359c5ca795cd
Display doc info pages using documentation browser when in GUI mode (Bug #39451)
John Donoghue <john.donoghue@ieee.org>
parents:
15545
diff
changeset
|
107 endif |
359c5ca795cd
Display doc info pages using documentation browser when in GUI mode (Bug #39451)
John Donoghue <john.donoghue@ieee.org>
parents:
15545
diff
changeset
|
108 |
5830 | 109 endif |
5672 | 110 else |
5830 | 111 print_usage (); |
5672 | 112 endif |
113 | |
114 endfunction | |
8558
438520011621
Check for successful build of the documentation
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
7017
diff
changeset
|
115 |
14363
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
116 |
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
117 %!test |
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
118 %! ifile = info_file (); |
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
119 %! if (exist (ifile) != 2 && exist (sprintf ("%s.gz", ifile)) != 2) |
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
120 %! error ("Info file %s or %s.gz does not exist!", ifile, ifile); |
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
121 %! endif |
f3d52523cde1
Use Octave coding conventions in all m-file %!test blocks
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
122 |