@@ -321,10 +321,8 @@ fn get_path_parameters(template: &str) -> Vec<&str> {
321321fn split_summary_desc ( desc : & str ) -> SplitDesc {
322322 let segmenter = SentenceSegmenter :: new ( ) ;
323323
324- let desc_no_newlines = desc. replace ( "\n \n " , ".\n " ) . replace ( '\n' , " " ) ;
325-
326324 let breakpoints: Vec < usize > = segmenter
327- . segment_str ( & desc_no_newlines )
325+ . segment_str ( & desc )
328326 . collect ( ) ;
329327
330328 if breakpoints. len ( ) <2 {
@@ -333,8 +331,8 @@ fn split_summary_desc(desc: &str) -> SplitDesc{
333331 description : None
334332 }
335333 }
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 ] ] ;
338336
339337 SplitDesc {
340338 summary : Some ( String :: from ( first_line. trim ( ) . strip_suffix ( '.' ) . unwrap_or ( first_line) ) ) ,
@@ -370,20 +368,20 @@ mod tests {
370368 summary: Some ( String :: from( "One sentence" ) ) ,
371369 description: None
372370 } ) ;
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" ) ,
374372 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" ) ) ,
376374 description: None
377375 } ) ;
378376 assert_eq ! ( split_summary_desc( "These are two totally. Separate sentences!" ) ,
379377 SplitDesc {
380378 summary: Some ( String :: from( "These are two totally" ) ) ,
381379 description: Some ( String :: from( "Separate sentences!" ) )
382380 } ) ;
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 " ) ,
384382 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 " ) )
387385 } ) ;
388386 assert_eq ! ( split_summary_desc( "" ) ,
389387 SplitDesc {
0 commit comments