[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
06/29: website: packages: Interpret synopsis/description Texinfo.
From: |
Ludovic Courtès |
Subject: |
06/29: website: packages: Interpret synopsis/description Texinfo. |
Date: |
Wed, 6 Dec 2017 09:24:22 -0500 (EST) |
civodul pushed a commit to branch master
in repository guix-artwork.
commit ed469f21d8cbcfe4360416918ed465318737ed4b
Author: Ludovic Courtès <address@hidden>
Date: Sat Jul 29 17:46:00 2017 +0200
website: packages: Interpret synopsis/description Texinfo.
* website/apps/packages/utils.scm (texinfo->shtml)
(package-description-shtml, package-synopsis-shtml): New procedures.
* website/apps/packages/templates/components.scm (detailed-package-preview):
Use them.
* website/apps/packages/templates/package.scm (package-t): Use them.
---
website/apps/packages/templates/components.scm | 4 +-
website/apps/packages/templates/package.scm | 6 +--
website/apps/packages/utils.scm | 51 ++++++++++++++++++++++++--
3 files changed, 53 insertions(+), 8 deletions(-)
diff --git a/website/apps/packages/templates/components.scm
b/website/apps/packages/templates/components.scm
index d4fedee..48c06e5 100644
--- a/website/apps/packages/templates/components.scm
+++ b/website/apps/packages/templates/components.scm
@@ -38,10 +38,10 @@
(span
(@ (class "package-synopsis"))
" — "
- ,(package-synopsis package)))
+ ,(package-synopsis-shtml package)))
(p
(@ (class "package-description"))
- ,(package-description package))
+ ,(package-description-shtml package))
(ul
(@ (class "package-info"))
diff --git a/website/apps/packages/templates/package.scm
b/website/apps/packages/templates/package.scm
index 86d64da..178a567 100644
--- a/website/apps/packages/templates/package.scm
+++ b/website/apps/packages/templates/package.scm
@@ -23,7 +23,7 @@
(lint-issues (package-lint-issues package)))
(theme
#:title (list package-id "Packages")
- #:description (package-synopsis package)
+ #:description (package-synopsis-shtml package)
#:keywords
'("GNU" "Linux" "Unix" "Free software" "Libre software"
"Operating system" "GNU Hurd" "GNU Guix package manager"
@@ -44,9 +44,9 @@
(h2 ,package-id " "
(span
(@ (class "synopsis"))
- ,(package-synopsis package)))
+ ,(package-synopsis-shtml package)))
- (p ,(package-description package))
+ (p ,(package-description-shtml package))
(ul
(@ (class "package-info"))
diff --git a/website/apps/packages/utils.scm b/website/apps/packages/utils.scm
index 4e435be..1ca8069 100644
--- a/website/apps/packages/utils.scm
+++ b/website/apps/packages/utils.scm
@@ -1,6 +1,23 @@
;;; GuixSD website --- GNU's advanced distro website
-;;; Initially written by sirgazil who waves all
-;;; copyright interest on this file.
+;;; Copyright © 2017 Ludovic Courtès <address@hidden>
+;;;
+;;; Initially written by sirgazil
+;;; who waives all copyright interest on this file.
+;;;
+;;; This file is part of GuixSD website.
+;;;
+;;; GuixSD website is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU Affero General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GuixSD website is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;;; GNU Affero General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU Affero General Public License
+;;; along with GuixSD website. If not, see <http://www.gnu.org/licenses/>.
(define-module (apps packages utils)
#:use-module (apps aux web)
@@ -9,8 +26,13 @@
#:use-module (apps packages types)
#:use-module (guix packages)
#:use-module (guix utils)
+ #:use-module (texinfo)
+ #:use-module (texinfo html)
#:use-module (ice-9 match)
- #:export (location->ilink
+ #:export (package-description-shtml
+ package-synopsis-shtml
+
+ location->ilink
package-build-issues
package-issues?
package-lint-issues
@@ -23,6 +45,29 @@
;;; Helper procedures.
;;;
+(define (texinfo->shtml texi)
+ "Parse TEXI, a string, and return the corresponding SHTML."
+ ;; 'texi-fragment->stexi' uses 'call-with-input-string', so make sure
+ ;; those string ports are Unicode-capable.
+ (with-fluids ((%default-port-encoding "UTF-8"))
+ (stexi->shtml (texi-fragment->stexi texi))))
+
+(define (package-description-shtml package)
+ "Return a SXML representation of PACKAGE description field with HTML
+vocabulary."
+ (and=> (package-description package) texinfo->shtml))
+
+(define (package-synopsis-shtml package)
+ "Return a SXML representation of PACKAGE synopsis field with HTML
+vocabulary."
+ (and=> (package-synopsis package)
+ (lambda (synopsis)
+ ;; Strip the paragraph that 'texinfo->shtml' adds.
+ (match (texinfo->shtml synopsis)
+ (('div ('p text ...))
+ text)))))
+
+
(define (location->ilink loc)
"Convert the given location LOC into an Ilink.
- 05/29: website: packages: Implement grouping by letter., (continued)
- 05/29: website: packages: Implement grouping by letter., Ludovic Courtès, 2017/12/06
- 11/29: website: "download", not "test"., Ludovic Courtès, 2017/12/06
- 08/29: website: packages: Fix typo., Ludovic Courtès, 2017/12/06
- 07/29: website: packages: Add the commit in package source URLs., Ludovic Courtès, 2017/12/06
- 12/29: website: packages: Mark GNU packages in the listing., Ludovic Courtès, 2017/12/06
- 15/29: website: downloads: Change http to https in alpha.gnu.org URL., Ludovic Courtès, 2017/12/06
- 13/29: website: packages: Correctly compute supported systems., Ludovic Courtès, 2017/12/06
- 10/29: website: Use actual GuixSD screenshots., Ludovic Courtès, 2017/12/06
- 17/29: website: base: Change http to https in 'graphics'., Ludovic Courtès, 2017/12/06
- 19/29: website: base: Change URLs in 'data' from http to https., Ludovic Courtès, 2017/12/06
- 06/29: website: packages: Interpret synopsis/description Texinfo.,
Ludovic Courtès <=
- 21/29: website: packages: Gracefully deal with empty package descriptions., Ludovic Courtès, 2017/12/06
- 24/29: website: packages: Remove links to package issues., Ludovic Courtès, 2017/12/06
- 18/29: website: base: Change some http to https., Ludovic Courtès, 2017/12/06
- 23/29: website: Hard-code file:// URL root when GUIX_WEB_SITE_LOCAL., Ludovic Courtès, 2017/12/06
- 20/29: website: Change http to https in URLs., Ludovic Courtès, 2017/12/06
- 25/29: website: packages: 'all-packages' memoizes its result., Ludovic Courtès, 2017/12/06
- 28/29: website: Insert surrounding spaces when flattening markup., Ludovic Courtès, 2017/12/06
- 29/29: website: Add pseudo-post about GPCE., Ludovic Courtès, 2017/12/06
- 14/29: website: packages: Add a newline between packages., Ludovic Courtès, 2017/12/06
- 09/29: website: packages: Implement patch links., Ludovic Courtès, 2017/12/06