[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
01/01: website: packages: Render Texinfo that appears in synopses.
From: |
Ludovic Courtès |
Subject: |
01/01: website: packages: Render Texinfo that appears in synopses. |
Date: |
Mon, 18 Sep 2017 04:53:47 -0400 (EDT) |
civodul pushed a commit to branch master
in repository guix-artwork.
commit ad849cd11b6499f2c8695a158a88b1e597f735b2
Author: Ludovic Courtès <address@hidden>
Date: Mon Sep 18 10:52:40 2017 +0200
website: packages: Render Texinfo that appears in synopses.
* website/www/packages.scm (texi->shtml): New procedure.
(package->sxml)[package-description-shtml]: Remove.
Use 'texi->shtml' for the synopsis and for the description.
---
website/www/packages.scm | 24 +++++++++++++-----------
1 file changed, 13 insertions(+), 11 deletions(-)
diff --git a/website/www/packages.scm b/website/www/packages.scm
index 6a06148..d34ced7 100644
--- a/website/www/packages.scm
+++ b/website/www/packages.scm
@@ -42,6 +42,7 @@
#:use-module (guix scripts substitute)
#:use-module (gnu packages)
#:use-module (sxml simple)
+ #:use-module (sxml match)
#:use-module (sxml fold)
#:use-module (json)
#:use-module (web uri)
@@ -109,6 +110,13 @@
(let ((loc (package-location package)))
(and loc (location-url loc))))
+(define (texi->shtml str)
+ "Return a SXML representation of STR with HTML vocabulary."
+ ;; 'texi-fragment->stexi' uses 'call-with-input-string', so make sure
+ ;; those string ports are Unicode-capable.
+ (with-fluids ((%default-port-encoding "UTF-8"))
+ (and=> str (compose stexi->shtml texi-fragment->stexi))))
+
(define (package->sxml package+anchor previous description-ids remaining)
"Return 3 values: the SXML for PACKAGE added to all previously collected
package output in PREVIOUS, a list of DESCRIPTION-IDS and the number of
@@ -215,15 +223,6 @@ decreasing, is 1."
(package-transitive-supported-systems package)))
" ")))
- (define (package-description-shtml package)
- "Return a SXML representation of PACKAGE description field with HTML
-vocabulary."
- ;; 'texi-fragment->stexi' uses 'call-with-input-string', so make sure
- ;; those string ports are Unicode-capable.
- (with-fluids ((%default-port-encoding "UTF-8"))
- (and=> (package-description package)
- (compose stexi->shtml texi-fragment->stexi))))
-
(define (package-logo name)
(and=> (lookup-gnu-package name)
gnu-package-logo))
@@ -251,7 +250,10 @@ description-ids as formal parameters."
,(package-name package) " "
,(package-version package)))
"\n"
- (td (span ,(package-synopsis package))
+ (td (span ,(sxml-match
+ (texi->shtml (package-synopsis package))
+ ((div (p ,body ...)) body) ;strip <p>
+ (,x x)))
(div (@ (id ,description-id))
,(match (package-logo (package-name package))
((? string? url)
@@ -261,7 +263,7 @@ description-ids as formal parameters."
(alt ("Logo of " ,(package-name package))))))
(_ #f))
"\n"
- ,(package-description-shtml package)
+ ,(texi->shtml (package-description package))
"\n"
,(license package)
(a (@ (href ,(package-home-page package))