# HG changeset patch # User Carnë Draug # Date 1339440376 -3600 # Node ID 461d268b10eb3e14cfeb54a60fc4ce16fdc48173 # Parent 154c150f6a21ee74c6e331f5f942e6edad4eff90 get_first_help_sentence: do not capture the first newline when end of sentence is a double newline diff --git a/scripts/help/get_first_help_sentence.m b/scripts/help/get_first_help_sentence.m --- a/scripts/help/get_first_help_sentence.m +++ b/scripts/help/get_first_help_sentence.m @@ -81,9 +81,11 @@ ## 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 non-word - ## character to support periods in numbers or words) or a double line-end. + ## character to support periods in numbers or words)... period_idx = regexp (help_text, '\.\W', "once"); - line_end_idx = regexp (help_text, "\n\n", "once"); + ## ... or a double line-end (we subtract 1 because we are not interested on + ## capturing the first newline) + line_end_idx = regexp (help_text, "\n\n", "once") -1; text = help_text (1:min ([period_idx; line_end_idx; max_len; length(help_text)])); status = 0; endfunction