# HG changeset patch # User Markus Mützel # Date 1664624216 -7200 # Node ID 2deb14b9ad27e736464cc22c61089ddbd2940456 # Parent fa4bb329a51a32869624d7b69c13b7459d713c37 Replace all occurrences of @seealso in docstring with @xseealso (bug #63141). * scripts/help/__makeinfo__.m: Avoid greedy regular expression to match too many characters. Loop over and replace all matches of "@seealso". diff -r fa4bb329a51a -r 2deb14b9ad27 scripts/help/__makeinfo__.m --- a/scripts/help/__makeinfo__.m Tue Oct 04 17:05:21 2022 -0700 +++ b/scripts/help/__makeinfo__.m Sat Oct 01 13:36:56 2022 +0200 @@ -102,11 +102,14 @@ ## Texinfo crashes if @end tex does not appear first on the line. text = regexprep (text, '^ +@end tex', '@end tex', 'lineanchors'); ## Replace @seealso with Octave specific @xseealso macro, and escape '@' - [s, e] = regexp (text, '@seealso{.*}'); - if (! isempty (s)) - esc_text = strrep (text(s+8:e), '@', '@@'); - text = [text(1:s), 'xseealso', esc_text, text(e+1:end)]; - endif + [s, e] = regexp (text, '@seealso{[^}]*}'); + cum_rep = 0; + for (i_match = 1:numel (s)) + esc_text = strrep (text(((s(i_match)+8:e(i_match))+i_match-1)+cum_rep), '@', '@@'); + text = [text(1:s(i_match)+i_match+cum_rep-1), 'xseealso', esc_text, ... + text(e(i_match)+1+i_match+cum_rep-1:end)]; + cum_rep += numel (esc_text) - (e(i_match)-(s(i_match)+8)+1); + endfor ## We don't want *ref macros to clutter plain text output with "Note ..." if (strcmp (output_type, "plain text"))