changeset 17591:7c479b7d3aab

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__.
author Rik <rik@octave.org>
date Mon, 07 Oct 2013 15:16:36 -0700
parents a53a97faf61a
children 28eb00d3edf4
files scripts/help/get_first_help_sentence.m
diffstat 1 files changed, 4 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/help/get_first_help_sentence.m
+++ b/scripts/help/get_first_help_sentence.m
@@ -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