# HG changeset patch # User Rik # Date 1559687262 25200 # Node ID f0da934bca61be97b8f5726a686b6b7c7123e70d # Parent c776d553c19e80c62d19a9bbeb5528916bb5b5ef 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. diff -r c776d553c19e -r f0da934bca61 scripts/web/web.m --- 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 web ([]) + +%!error web (1) %!error web ('') %!error <'-invalid_Option' does not match> %! web ("https://www.octave.org", "-invalid_Option")