changeset 27846:4075474fd9d0

fix URL parsing of `publish` (bug #57426). * scripts/miscellaneous/publish.m (format_text): With cset 85ad4689aa05 a warning is thrown, if indexing happens with non-scalar values. Thus ensure, that the result of strfind is scalar. Modified the comments to get a better idea of this in the future.
author Kai T. Ohlhus <k.ohlhus@gmail.com>
date Tue, 17 Dec 2019 13:19:36 +0900
parents 25f914321e7b
children 56d94f86a659
files scripts/miscellaneous/publish.m
diffstat 1 files changed, 6 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/miscellaneous/publish.m	Mon Dec 16 14:42:06 2019 -0800
+++ b/scripts/miscellaneous/publish.m	Tue Dec 17 13:19:36 2019 +0900
@@ -845,8 +845,8 @@
   ## Regular expressions for the formats:
   ##
   ## 1) Links "<http://www.someurl.com>"
-  ## 2) Links "<octave:Function TEXT>"
-  ## 3) Links "<http://www.someurl.com TEXT>"
+  ## 2) Links "<octave:Function SOME TEXT>"
+  ## 3) Links "<http://www.someurl.com SOME TEXT>"
   ## 4) LaTeX block math "$$x^2$$"
   ## 5) LaTeX inline math "$x^2$"
   ## 6) Bold *text*
@@ -882,8 +882,8 @@
           url = cstr{j};
           cstr{j} = formatter ("link", url(2:end-1), url(2:end-1));
         case 2
-          ## Links "<octave:Function TEXT>"
-          idx = strfind (cstr{j}, " ");
+          ## Links "<octave:Function SOME TEXT>"
+          idx = strfind (cstr{j}, " ")(1);
           url = cstr{j};
           url = texinfo_esc (url(9:idx-1));
           v = version ();
@@ -896,8 +896,8 @@
           txt = format_text (txt(idx+1:end-1), formatter);
           cstr{j} = formatter ("link", url, txt);
         case 3
-          ## Links "<http://www.someurl.com TEXT>"
-          idx = strfind (cstr{j}, " ");
+          ## Links "<http://www.someurl.com SOME TEXT>"
+          idx = strfind (cstr{j}, " ")(1);
           url = cstr{j};
           url = url(2:idx-1);
           txt = cstr{j};