summaryrefslogtreecommitdiff
path: root/guix/import
diff options
context:
space:
mode:
authorRicardo Wurmus <rekado@elephly.net>2022-09-28 22:05:52 +0200
committerRicardo Wurmus <rekado@elephly.net>2022-09-28 22:10:33 +0200
commit7ea6e9f79f8d259a75c455183e07afa60771abcc (patch)
tree5b3a2a3dff98e7fd9269e6da6d90e1ea86a6c983 /guix/import
parente761ed7384a8a086c5fed95336123a0ba6fc0cb1 (diff)
import/utils: Add beautify-synopsis.
* guix/import/utils.scm (beautify-synopsis): New procedure.
Diffstat (limited to 'guix/import')
-rw-r--r--guix/import/utils.scm18
1 files changed, 17 insertions, 1 deletions
diff --git a/guix/import/utils.scm b/guix/import/utils.scm
index 7e7d116d1d..dd8c61b79a 100644
--- a/guix/import/utils.scm
+++ b/guix/import/utils.scm
@@ -72,6 +72,7 @@
snake-case
beautify-description
+ beautify-synopsis
alist->package
@@ -295,7 +296,22 @@ LENGTH characters."
;; Use double spacing between sentences
(fill-paragraph (regexp-substitute/global #f "\\. \\b"
cleaned 'pre ". " 'post)
- length)))
+ length)))
+
+(define (beautify-synopsis synopsis)
+ "Improve the package SYNOPSIS."
+ (let ((cleaned (cond
+ ((not (string? synopsis))
+ (G_ "This package lacks a synopsis. Run \
+\"info '(guix) Synopses and Descriptions'\" for more information."))
+ ((string-prefix? "A " synopsis)
+ (substring synopsis 1))
+ ;; Remove trailing period.
+ ((string-suffix? "." synopsis)
+ (substring synopsis 0
+ (1- (string-length synopsis))))
+ (else synopsis))))
+ (string-trim-both cleaned)))
(define* (package-names->package-inputs names #:optional (output #f))
"Given a list of PACKAGE-NAMES or (PACKAGE-NAME VERSION) pairs, and an