[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
01/02: import: cran: Move beautify-description to utils module.
From: |
Ben Woodcroft |
Subject: |
01/02: import: cran: Move beautify-description to utils module. |
Date: |
Thu, 14 Jan 2016 09:48:35 +0000 |
benwoodcroft pushed a commit to branch master
in repository guix.
commit 2028a2c9607b407d3686ca5791c604ddec45f8f8
Author: Ben Woodcroft <address@hidden>
Date: Wed Jan 6 00:09:19 2016 +1000
import: cran: Move beautify-description to utils module.
* guix/import/cran.scm (beautify-description): Move from here...
* guix/import/utils.scm: ... to here.
---
guix/import/cran.scm | 11 -----------
guix/import/utils.scm | 14 +++++++++++++-
2 files changed, 13 insertions(+), 12 deletions(-)
diff --git a/guix/import/cran.scm b/guix/import/cran.scm
index fc27090..1c30da8 100644
--- a/guix/import/cran.scm
+++ b/guix/import/cran.scm
@@ -136,17 +136,6 @@ empty list when the FIELD cannot be found."
(string-any char-set:whitespace item)))
(map string-trim-both items))))))
-(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)))
- ;; Use double spacing between sentences
- (regexp-substitute/global #f "\\. \\b"
- cleaned 'pre ". " 'post)))
-
(define (description->package meta)
"Return the `package' s-expression for a CRAN package from the alist META,
which was derived from the R package's DESCRIPTION file."
diff --git a/guix/import/utils.scm b/guix/import/utils.scm
index 0734fa1..44e004b 100644
--- a/guix/import/utils.scm
+++ b/guix/import/utils.scm
@@ -37,7 +37,8 @@
string->license
license->symbol
- snake-case))
+ snake-case
+ beautify-description))
(define (factorize-uri uri version)
"Factorize URI, a package tarball URI as a string, such that any occurrences
@@ -136,3 +137,14 @@ to in the (guix licenses) module, or #f if there is no
such known license."
"Return a downcased version of the string STR where underscores are replaced
with dashes."
(string-join (string-split (string-downcase str) #\_) "-"))
+
+(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)))
+ ;; Use double spacing between sentences
+ (regexp-substitute/global #f "\\. \\b"
+ cleaned 'pre ". " 'post)))