From 689db38e3467f66725e8841eac72225110a75a17 Mon Sep 17 00:00:00 2001 From: Alex Kost Date: Mon, 20 Mar 2017 13:41:41 +0300 Subject: ui: Support Texinfo markup in package synopses. * guix/ui.scm (package-field-string): New procedure. (package-description-string): Use it. (package-synopsis-string): New procedure. (package->recutils): Use it. * guix/scripts/lint.scm (check-synopsis-style)[check-texinfo-markup]: New procedure. Use it in checks. * tests/lint.scm: Test it. * gnu/packages/perl.scm (perl-try-tiny)[synopsis]: Adjust for the Texinfo markup. --- guix/ui.scm | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'guix/ui.scm') diff --git a/guix/ui.scm b/guix/ui.scm index 3a0a6501d1..345bf490b2 100644 --- a/guix/ui.scm +++ b/guix/ui.scm @@ -4,7 +4,7 @@ ;;; Copyright © 2013 Nikita Karetnikov ;;; Copyright © 2014 Cyril Roelandt ;;; Copyright © 2014 Cyrill Schenkel -;;; Copyright © 2014, 2015 Alex Kost +;;; Copyright © 2014, 2015, 2017 Alex Kost ;;; Copyright © 2015 David Thompson ;;; Copyright © 2015, 2016 Mathieu Lirzin ;;; Copyright © 2016 Roel Janssen @@ -81,6 +81,7 @@ fill-paragraph texi->plain-text package-description-string + package-synopsis-string string->recutils package->recutils package-specification->name+version+output @@ -848,10 +849,18 @@ converted to a space; sequences of more than one line break are preserved." (with-fluids ((%default-port-encoding "UTF-8")) (stexi->plain-text (texi-fragment->stexi str)))) +(define (package-field-string package field-accessor) + "Return a plain-text representation of PACKAGE field." + (and=> (field-accessor package) + (compose texi->plain-text P_))) + (define (package-description-string package) "Return a plain-text representation of PACKAGE description field." - (and=> (package-description package) - (compose texi->plain-text P_))) + (package-field-string package package-description)) + +(define (package-synopsis-string package) + "Return a plain-text representation of PACKAGE synopsis field." + (package-field-string package package-synopsis)) (define (string->recutils str) "Return a version of STR where newlines have been replaced by newlines @@ -914,7 +923,7 @@ WIDTH columns." (string-map (match-lambda (#\newline #\space) (chr chr)) - (or (and=> (package-synopsis p) P_) + (or (and=> (package-synopsis-string p) P_) ""))) (format port "~a~2%" (string->recutils -- cgit v1.2.3