[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
04/11: ui: Gracefully handle invalid Texinfo markup in package blurbs.
From: |
guix-commits |
Subject: |
04/11: ui: Gracefully handle invalid Texinfo markup in package blurbs. |
Date: |
Thu, 28 Oct 2021 15:43:14 -0400 (EDT) |
civodul pushed a commit to branch master
in repository guix.
commit 6938d9f1c738666d0554d832e12a87b5d69c1e71
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Mon Oct 18 13:37:56 2021 +0200
ui: Gracefully handle invalid Texinfo markup in package blurbs.
Previously 'guix search' & co. would crash when encountering invalid
Texinfo.
* guix/ui.scm (texi->plain-text*): New procedure.
(package-field-string, package->recutils): Use it.
---
guix/ui.scm | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/guix/ui.scm b/guix/ui.scm
index 1428c25..eb7f0af 100644
--- a/guix/ui.scm
+++ b/guix/ui.scm
@@ -1431,10 +1431,22 @@ 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 (texi->plain-text* package str)
+ "Same as 'texi->plain-text', but gracefully handle Texinfo errors."
+ (catch 'parser-error
+ (lambda ()
+ (texi->plain-text str))
+ (lambda args
+ (warning (package-location package)
+ (G_ "~a: invalid Texinfo markup~%")
+ (package-full-name package))
+ 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_)))
+ (lambda (str)
+ (texi->plain-text* package (P_ str)))))
(define (package-description-string package)
"Return a plain-text representation of PACKAGE description field."
@@ -1555,7 +1567,8 @@ HYPERLINKS? is true, emit hyperlink escape sequences when
appropriate."
(parameterize ((%text-width width*))
;; Call 'texi->plain-text' on the concatenated string to account
;; for the width of "description:" in paragraph filling.
- (texi->plain-text
+ (texi->plain-text*
+ p
(string-append "description: "
(or (and=> (package-description p) P_)
""))))
- branch master updated (3fb1928 -> 7dbd533), guix-commits, 2021/10/28
- 02/11: doc: Allow offloading of the expensive derivations., guix-commits, 2021/10/28
- 01/11: import: cran: Use the standard diagnostic procedures., guix-commits, 2021/10/28
- 03/11: store: 'map/accumulate-builds' handler checks the store received., guix-commits, 2021/10/28
- 04/11: ui: Gracefully handle invalid Texinfo markup in package blurbs.,
guix-commits <=
- 06/11: gnu: waypipe: Simplify 'fix-sleep-path phase., guix-commits, 2021/10/28
- 08/11: gnu: Add cln., guix-commits, 2021/10/28
- 05/11: packages: Optionally validate Texinfo markup at expansion time., guix-commits, 2021/10/28
- 07/11: gnu: waypipe: Update to 0.8.1, guix-commits, 2021/10/28
- 09/11: gnu: Add ginac., guix-commits, 2021/10/28
- 11/11: gnu: python-slugify: Honor #:tests?., guix-commits, 2021/10/28
- 10/11: gnu: python-slugify: Update to 5.0.2., guix-commits, 2021/10/28