changeset 27151:f0da934bca61

web.m: Tweaks to new function. * web.m: Use @url Texinfo macro instead of @code to mark web addresses. Use @sc{} macro to place Matlab in small caps. Use isrow() rather than isvector() to guarantee that input is a char vector string. Use only one '#' to mark comments which are not stand-alone on a line. Use two newlines after "endfunction" and start of BIST tests.
author Rik <rik@octave.org>
date Tue, 04 Jun 2019 15:27:42 -0700
parents c776d553c19e
children 224ce8329074
files scripts/web/web.m
diffstat 1 files changed, 13 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/web/web.m	Tue Jun 04 22:33:49 2019 +0200
+++ b/scripts/web/web.m	Tue Jun 04 15:27:42 2019 -0700
@@ -20,17 +20,16 @@
 ## @deftypefn  {} {@var{status} =} web ()
 ## @deftypefnx {} {@var{status} =} web (@var{url})
 ## @deftypefnx {} {@var{status} =} web (@var{url}, @var{option})
-## @deftypefnx {} {@var{status} =} web (@var{url}, @var{option1}, @dots{}, @var{optionN})
-## @deftypefnx {} {[@var{status}, @var{h}] =} web (@dots{})
+## @deftypefnx {} {@var{status} =} web (@var{url}, @var{option_1}, @dots{}, @var{option_N})
 ## @deftypefnx {} {[@var{status}, @var{h}, @var{url}] =} web (@dots{})
 ##
 ## Open @var{url} in the default system web browser.
 ##
-## With no arguments given, the address @code{https://www.octave.org} is
+## With no arguments given, the address @url{https://www.octave.org} is
 ## opened.
 ##
-## Additional options can be passed due to Matlab compatibility, but they have
-## no effect on the system web browser:
+## Additional options can be passed for @sc{matlab} compatibility, but are
+## ignored.
 ##
 ## @itemize @bullet
 ## @item
@@ -73,16 +72,16 @@
     url = "https://www.octave.org";
   endif
 
-  if (! (ischar (url) && isvector (url)))
+  if (! (ischar (url) && isrow (url)))
     error ("web: URL must be a string");
   endif
 
-  for i = 1:length (varargin)
-    validatestring (varargin{i}, ...
-      {"-browser", "-new", "-noaddressbox", "-notoolbar"});
+  for i = 1:numel (varargin)
+    validatestring (varargin{i},
+                    {"-browser", "-new", "-noaddressbox", "-notoolbar"});
   endfor
 
-  ## Store text after "text://" to temporary file and open it.
+  ## Store text after "text://" to a temporary file and open it.
   if (strncmpi (url, "text://", 7))
     fname = [tempname() ".html"];
     fid = fopen (fname, "w");
@@ -91,7 +90,7 @@
     endif
     fprintf (fid, "%s", url(8:end));
     fclose (fid);
-    url = ["file://", fname];
+    url = ["file://" fname];
   endif
 
   status = __open_with_system_app__ (url);
@@ -101,7 +100,7 @@
     status = 2;
   endif
 
-  h = [];  ## Empty handle, as we cannot control an external browser.
+  h = [];  # Empty handle, as we cannot control an external browser.
 
   ## For Matlab compatibility.
   if (any (strcmp (varargin, "-browser")))
@@ -110,7 +109,8 @@
 
 endfunction
 
-%!error <URL must be a string> web ([])
+
+%!error <URL must be a string> web (1)
 %!error <URL must be a string> web ('')
 %!error <'-invalid_Option' does not match>
 %!  web ("https://www.octave.org", "-invalid_Option")