File tree Expand file tree Collapse file tree 2 files changed +16
-4
lines changed Expand file tree Collapse file tree 2 files changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -304,10 +304,10 @@ def transform_comments(separator, &block)
304
304
private :transform_comments
305
305
306
306
# Get the first sentence in a string. The sentence is terminated
307
- # by the first period or the end of the line. Decimal points do
308
- # not count as periods.
307
+ # by the first period, exclamation mark, or the end of the line.
308
+ # Decimal points do not count as periods.
309
309
def first_sentence ( string )
310
- string . split ( /\. [ \t ]|\. $|\n / ) . first
310
+ string . split ( /(?<= \w )( \. |!) [ \t ]|( \. $|!) |\n / ) . first
311
311
end
312
312
private :first_sentence
313
313
Original file line number Diff line number Diff line change @@ -352,12 +352,24 @@ def test_comment_setting
352
352
assert_equal "A Comment" , t . comment
353
353
end
354
354
355
- def test_comments_with_sentences
355
+ def test_comments_with_sentences_period
356
356
desc "Comment 1. Comment 2."
357
357
t = task ( :t , :name , :rev )
358
358
assert_equal "Comment 1" , t . comment
359
359
end
360
360
361
+ def test_comments_with_sentences_exclamation_mark
362
+ desc "An exclamation mark! Comment."
363
+ t = task ( :t , :name , :rev )
364
+ assert_equal "An exclamation mark" , t . comment
365
+ end
366
+
367
+ def test_comments_with_many_periods
368
+ desc "This is a test...I think ... testing. Comment."
369
+ t = task ( :t , :name , :rev )
370
+ assert_equal "This is a test...I think ... testing" , t . comment
371
+ end
372
+
361
373
def test_comments_with_tabbed_sentences
362
374
desc "Comment 1.\t Comment 2."
363
375
t = task ( :t , :name , :rev )
You can’t perform that action at this time.
0 commit comments