summaryrefslogtreecommitdiff
path: root/guix
diff options
context:
space:
mode:
authorMathieu Lirzin <mthl@openmailbox.org>2015-09-20 12:27:23 +0200
committerMathieu Lirzin <mthl@openmailbox.org>2015-09-24 22:46:20 +0200
commit2748ee3bcf9373bef58fee7458606fef05626781 (patch)
treee8a5be2546b2bfd535187fe18b129bc18a465fe5 /guix
parenta7a4fd9a7cd02e4897e7b2156bd9ecc7e72e9818 (diff)
lint: Check non-translated package descriptions.
* guix/ui.scm (texi->plain-text): Export. * guix/scripts/lint.scm (check-description-style): Use it instead of 'package-description-string'.
Diffstat (limited to 'guix')
-rw-r--r--guix/scripts/lint.scm18
-rw-r--r--guix/ui.scm1
2 files changed, 12 insertions, 7 deletions
diff --git a/guix/scripts/lint.scm b/guix/scripts/lint.scm
index 8224f540bb..95a8e2e66d 100644
--- a/guix/scripts/lint.scm
+++ b/guix/scripts/lint.scm
@@ -143,12 +143,14 @@ monad."
(_ "description should not be empty")
'description)))
- (define (check-texinfo-markup package)
- "Check that PACKAGE description can be parsed as a Texinfo fragment."
+ (define (check-texinfo-markup description)
+ "Check that DESCRIPTION can be parsed as a Texinfo fragment. If the
+markup is valid return a plain-text version of DESCRIPTION, otherwise #f."
(catch 'parser-error
- (lambda () (package-description-string package))
+ (lambda () (texi->plain-text description))
(lambda (keys . args)
- (emit-warning package (_ "Texinfo markup in description is invalid")))))
+ (emit-warning package (_ "Texinfo markup in description is invalid"))
+ #f)))
(define (check-proper-start description)
(unless (or (properly-starts-sentence? description)
@@ -179,9 +181,11 @@ by two spaces; possible infraction~p at ~{~a~^, ~}")
(let ((description (package-description package)))
(when (string? description)
(check-not-empty description)
- (check-texinfo-markup package)
- (check-proper-start description)
- (check-end-of-sentence-space description))))
+ ;; Use raw description for this because Texinfo rendering automatically
+ ;; fixes end of sentence space.
+ (check-end-of-sentence-space description)
+ (and=> (check-texinfo-markup description)
+ check-proper-start))))
(define (check-inputs-should-be-native package)
;; Emit a warning if some inputs of PACKAGE are likely to belong to its
diff --git a/guix/ui.scm b/guix/ui.scm
index 67dd062a34..fb8121c213 100644
--- a/guix/ui.scm
+++ b/guix/ui.scm
@@ -75,6 +75,7 @@
switch-symlinks
config-directory
fill-paragraph
+ texi->plain-text
package-description-string
string->recutils
package->recutils