@@ -321,10 +321,8 @@ fn get_path_parameters(template: &str) -> Vec<&str> {
321
321
fn split_summary_desc ( desc : & str ) -> SplitDesc {
322
322
let segmenter = SentenceSegmenter :: new ( ) ;
323
323
324
- let desc_no_newlines = desc. replace ( "\n \n " , ".\n " ) . replace ( '\n' , " " ) ;
325
-
326
324
let breakpoints: Vec < usize > = segmenter
327
- . segment_str ( & desc_no_newlines )
325
+ . segment_str ( & desc )
328
326
. collect ( ) ;
329
327
330
328
if breakpoints. len ( ) <2 {
@@ -333,8 +331,8 @@ fn split_summary_desc(desc: &str) -> SplitDesc{
333
331
description : None
334
332
}
335
333
}
336
- let first_line = & desc_no_newlines [ breakpoints[ 0 ] ..breakpoints[ 1 ] ] ;
337
- let rest = & desc_no_newlines [ breakpoints[ 1 ] ..breakpoints[ breakpoints. len ( ) -1 ] ] ;
334
+ let first_line = & desc [ breakpoints[ 0 ] ..breakpoints[ 1 ] ] ;
335
+ let rest = & desc [ breakpoints[ 1 ] ..breakpoints[ breakpoints. len ( ) -1 ] ] ;
338
336
339
337
SplitDesc {
340
338
summary : Some ( String :: from ( first_line. trim ( ) . strip_suffix ( '.' ) . unwrap_or ( first_line) ) ) ,
@@ -370,20 +368,20 @@ mod tests {
370
368
summary: Some ( String :: from( "One sentence" ) ) ,
371
369
description: None
372
370
} ) ;
373
- assert_eq ! ( split_summary_desc( "This is\n still one. sentence: all; together" ) ,
371
+ assert_eq ! ( split_summary_desc( "This is - still one. sentence: all; together" ) ,
374
372
SplitDesc {
375
- summary: Some ( String :: from( "This is still one. sentence: all; together" ) ) ,
373
+ summary: Some ( String :: from( "This is - still one. sentence: all; together" ) ) ,
376
374
description: None
377
375
} ) ;
378
376
assert_eq ! ( split_summary_desc( "These are two totally. Separate sentences!" ) ,
379
377
SplitDesc {
380
378
summary: Some ( String :: from( "These are two totally" ) ) ,
381
379
description: Some ( String :: from( "Separate sentences!" ) )
382
380
} ) ;
383
- assert_eq ! ( split_summary_desc( "Such a weird way to separate sentences \n \n Right? " ) ,
381
+ assert_eq ! ( split_summary_desc( "These -> \n are allowed \n because they're needed \n \n for \n \n \n formatting " ) ,
384
382
SplitDesc {
385
- summary: Some ( String :: from( "Such a weird way to separate sentences " ) ) ,
386
- description: Some ( String :: from( "Right? " ) )
383
+ summary: Some ( String :: from( "These -> \n " ) ) ,
384
+ description: Some ( String :: from( "are allowed \n because they're needed \n \n for \n \n \n formatting " ) )
387
385
} ) ;
388
386
assert_eq ! ( split_summary_desc( "" ) ,
389
387
SplitDesc {
0 commit comments