@@ -26,6 +26,7 @@ pub fn fix(
2626 return ;
2727 }
2828 let table = & mut table_element. unwrap ( ) . first ( ) . unwrap ( ) . borrow_mut ( ) ;
29+ let re = Regex :: new ( r" \.(\W)" ) . unwrap ( ) ;
2930 expand_entry_points_inline_tables ( table) ;
3031 for_entries ( table, & mut |key, entry| match key. split ( '.' ) . next ( ) . unwrap ( ) {
3132 "name" => {
@@ -36,18 +37,21 @@ pub fn fix(
3637 }
3738 "description" => {
3839 update_content ( entry, |s| {
39- s. trim ( )
40- . lines ( )
41- . map ( |part| {
42- part. trim ( )
43- . split ( char:: is_whitespace)
44- . filter ( |part| !part. trim ( ) . is_empty ( ) )
45- . collect :: < Vec < & str > > ( )
46- . join ( " " )
47- . replace ( " ." , "." )
48- } )
49- . collect :: < Vec < String > > ( )
50- . join ( " " )
40+ re. replace_all (
41+ & s. trim ( )
42+ . lines ( )
43+ . map ( |part| {
44+ part. trim ( )
45+ . split ( char:: is_whitespace)
46+ . filter ( |part| !part. trim ( ) . is_empty ( ) )
47+ . collect :: < Vec < & str > > ( )
48+ . join ( " " )
49+ } )
50+ . collect :: < Vec < String > > ( )
51+ . join ( " " ) ,
52+ ".$1" ,
53+ )
54+ . to_string ( )
5155 } ) ;
5256 }
5357 "requires-python" => {
@@ -659,10 +663,10 @@ mod tests {
659663 ( 3 , 13 ) ,
660664 ) ]
661665 #[ case:: project_description_whitespace(
662- "[project]\n description = ' A magic stuff \t is great\t \t .\r \n Like really .\t \' \n requires-python = '==3.12'" ,
666+ "[project]\n description = ' A magic stuff \t is great\t \t .\r \n Like really . Works on .rst and .NET :) \t \' \n requires-python = '==3.12'" ,
663667 indoc ! { r#"
664668 [project]
665- description = "A magic stuff is great. Like really."
669+ description = "A magic stuff is great. Like really. Works on .rst and .NET :) "
666670 requires-python = "==3.12"
667671 classifiers = [
668672 "Programming Language :: Python :: 3 :: Only",
0 commit comments