# HG changeset patch # User Rik # Date 1381184196 25200 # Node ID 7c479b7d3aab423713e88fba2d169e3956799a98 # Parent a53a97faf61a6bb797fdebc3d1c9ef90301b75ba get_first_help_sentence.m: Fix code for m-files with multiple @deftypefn pairs like gallery (bug #40197). * scripts/help/get_first_help_sentence.m: Remove everything after the first @def block before passing to __makeinfo__. diff -r a53a97faf61a -r 7c479b7d3aab scripts/help/get_first_help_sentence.m --- a/scripts/help/get_first_help_sentence.m Mon Oct 07 21:10:36 2013 +0200 +++ b/scripts/help/get_first_help_sentence.m Mon Oct 07 15:16:36 2013 -0700 @@ -107,10 +107,9 @@ for k = 1:length (def_idx) endl = endl_idx(find (endl_idx > def_idx(k), 1)); if (isempty (endl)) - keep(def_idx(k):end) = false; - else - keep(def_idx(k):endl) = false; + endl = numel (keep); endif + keep(def_idx(k):endl) = false; endfor ## Remove the @end ... that corresponds to the @def we removed above @@ -125,16 +124,11 @@ sep_idx = min (space_idx, bracket_idx); def_type = help_text(def1+1:sep_idx-1); - end_idx = strfind (help_text, sprintf ("@end %s", def_type)); + end_idx = strfind (help_text, sprintf ("@end %s", def_type))(1); if (isempty (end_idx)) error ("get_first_help_sentence: couldn't parse texinfo"); endif - endl = endl_idx(find (endl_idx > end_idx, 1)); - if (isempty (endl)) - keep(end_idx:end) = false; - else - keep(end_idx:endl) = false; - endif + keep(end_idx:end) = false; help_text = help_text(keep); endif