@@ -26,6 +26,7 @@ pub fn fix(
26
26
return ;
27
27
}
28
28
let table = & mut table_element. unwrap ( ) . first ( ) . unwrap ( ) . borrow_mut ( ) ;
29
+ let re = Regex :: new ( r" \.(\W)" ) . unwrap ( ) ;
29
30
expand_entry_points_inline_tables ( table) ;
30
31
for_entries ( table, & mut |key, entry| match key. split ( '.' ) . next ( ) . unwrap ( ) {
31
32
"name" => {
@@ -36,18 +37,20 @@ pub fn fix(
36
37
}
37
38
"description" => {
38
39
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. split_whitespace ( )
45
+ . filter ( |part| !part. trim ( ) . is_empty ( ) )
46
+ . collect :: < Vec < & str > > ( )
47
+ . join ( " " )
48
+ } )
49
+ . collect :: < Vec < String > > ( )
50
+ . join ( " " ) ,
51
+ ".$1" ,
52
+ )
53
+ . to_string ( )
51
54
} ) ;
52
55
}
53
56
"requires-python" => {
@@ -659,10 +662,10 @@ mod tests {
659
662
( 3 , 13 ) ,
660
663
) ]
661
664
#[ 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'" ,
665
+ "[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'" ,
663
666
indoc ! { r#"
664
667
[project]
665
- description = "A magic stuff is great. Like really."
668
+ description = "A magic stuff is great. Like really. Works on .rst and .NET :) "
666
669
requires-python = "==3.12"
667
670
classifiers = [
668
671
"Programming Language :: Python :: 3 :: Only",
0 commit comments