# HG changeset patch # User Carnë Draug # Date 1339435514 -3600 # Node ID 154c150f6a21ee74c6e331f5f942e6edad4eff90 # Parent 8d3ab19f8599faf0fae15037ab1e6baf8b7d1f81 get_first_help_sentence: use period followed by non-word character to indentify end of sentence 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 @@ -80,10 +80,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 or a double line-end. - period_idx = find (help_text == '.', 1); - line_end_idx = strfind (help_text, "\n\n"); - text = help_text (1:min ([period_idx(:); line_end_idx(:); max_len; length(help_text)])); + ## 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. + period_idx = regexp (help_text, '\.\W', "once"); + line_end_idx = regexp (help_text, "\n\n", "once"); + text = help_text (1:min ([period_idx; line_end_idx; max_len; length(help_text)])); status = 0; endfunction