import/utils: beautify-description: Recognize more fragments.
* guix/import/utils.scm (beautify-description): Handle additional common initial sentence fragments in descriptions.
This commit is contained in:
		
							parent
							
								
									981dcc3b0c
								
							
						
					
					
						commit
						6e377b8893
					
				
					 1 changed files with 13 additions and 4 deletions
				
			
		| 
						 | 
					@ -212,10 +212,19 @@ with dashes."
 | 
				
			||||||
(define (beautify-description description)
 | 
					(define (beautify-description description)
 | 
				
			||||||
  "Improve the package DESCRIPTION by turning a beginning sentence fragment
 | 
					  "Improve the package DESCRIPTION by turning a beginning sentence fragment
 | 
				
			||||||
into a proper sentence and by using two spaces between sentences."
 | 
					into a proper sentence and by using two spaces between sentences."
 | 
				
			||||||
  (let ((cleaned (if (string-prefix? "A " description)
 | 
					  (let ((cleaned (cond
 | 
				
			||||||
 | 
					                  ((string-prefix? "A " description)
 | 
				
			||||||
                   (string-append "This package provides a"
 | 
					                   (string-append "This package provides a"
 | 
				
			||||||
                                    (substring description 1))
 | 
					                                  (substring description 1)))
 | 
				
			||||||
                     description)))
 | 
					                  ((string-prefix? "Provides " description)
 | 
				
			||||||
 | 
					                   (string-append "This package provides"
 | 
				
			||||||
 | 
					                                  (substring description
 | 
				
			||||||
 | 
					                                             (string-length "Provides"))))
 | 
				
			||||||
 | 
					                  ((string-prefix? "Functions " description)
 | 
				
			||||||
 | 
					                   (string-append "This package provides functions"
 | 
				
			||||||
 | 
					                                  (substring description
 | 
				
			||||||
 | 
					                                             (string-length "Functions"))))
 | 
				
			||||||
 | 
					                  (else description))))
 | 
				
			||||||
    ;; Use double spacing between sentences
 | 
					    ;; Use double spacing between sentences
 | 
				
			||||||
    (regexp-substitute/global #f "\\. \\b"
 | 
					    (regexp-substitute/global #f "\\. \\b"
 | 
				
			||||||
                              cleaned 'pre ".  " 'post)))
 | 
					                              cleaned 'pre ".  " 'post)))
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Reference in a new issue