changeset 25846:e88d3e648e1c

get_first_help_sentence.m: Use a better regexp for sentence-end detection. * get_first_help_sentence.m: Change regexp to search for a period, followed by whitespace, followed by a capital letter or newline.
author Rik <rik@octave.org>
date Thu, 30 Aug 2018 11:14:43 -0700
parents aa4e0ca9873b
children c756e9a1e776
files scripts/help/get_first_help_sentence.m
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/help/get_first_help_sentence.m	Thu Aug 30 12:23:38 2018 -0400
+++ b/scripts/help/get_first_help_sentence.m	Thu Aug 30 11:14:43 2018 -0700
@@ -84,9 +84,9 @@
 
 ## This function extracts the first sentence from a plain text help text
 function [text, status] = first_sentence_plain_text (help_text, max_len)
-  ## Extract first line by searching for a period followed by a space class
-  ## character (to support periods in numbers or words) ...
-  period_idx = regexp (help_text, '\.\s', "once");
+  ## Extract first line by searching for a period followed by whitespace
+  ## followed by a capital letter (Nearly the same rule as Texinfo).
+  period_idx = regexp (help_text, '\.\s+(?:[A-Z]|\n)', "once");
   ## ... or a double end-of-line (we subtract 1 because we are not interested
   ## in capturing the first newline).
   line_end_idx = regexp (help_text, "\n\n", "once") - 1;