summary refs log tree commit diff
diff options
context:
space:
mode:
authorRicardo Wurmus <rekado@elephly.net>2019-09-14 00:36:51 +0200
committerRicardo Wurmus <rekado@elephly.net>2019-09-14 00:37:47 +0200
commit6e377b88930226f3f74ba9fac74d80c36494d9be (patch)
tree7c0b105685f7b2112129888ed1208e7edb3bf059
parent981dcc3b0cb6b043b673dc0f31912a8443ad49e3 (diff)
downloadguix-6e377b88930226f3f74ba9fac74d80c36494d9be.tar.gz
import/utils: beautify-description: Recognize more fragments.
* guix/import/utils.scm (beautify-description): Handle additional common
initial sentence fragments in descriptions.
-rw-r--r--guix/import/utils.scm17
1 files changed, 13 insertions, 4 deletions
diff --git a/guix/import/utils.scm b/guix/import/utils.scm
index 252875eeab..4694b6e7ef 100644
--- a/guix/import/utils.scm
+++ b/guix/import/utils.scm
@@ -212,10 +212,19 @@ with dashes."
 (define (beautify-description description)
   "Improve the package DESCRIPTION by turning a beginning sentence fragment
 into a proper sentence and by using two spaces between sentences."
-  (let ((cleaned (if (string-prefix? "A " description)
-                     (string-append "This package provides a"
-                                    (substring description 1))
-                     description)))
+  (let ((cleaned (cond
+                  ((string-prefix? "A " description)
+                   (string-append "This package provides a"
+                                  (substring description 1)))
+                  ((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
     (regexp-substitute/global #f "\\. \\b"
                               cleaned 'pre ".  " 'post)))