Mathieu Lirzin <m...@openmailbox.org> writes:

> From 665c92dc5e9976719ac7a6e427253b6ee65c78d8 Mon Sep 17 00:00:00 2001
> From: Mathieu Lirzin <m...@openmailbox.org>
> Date: Fri, 7 Aug 2015 00:10:43 +0200
> Subject: [PATCH] packages: Add package-description-string.
>
> * guix/packages.scm (package-description-string): New variable.
> * guix/utils.scm (texi->plain-text): Likewise.
> * guix/ui.scm (package->recutils): Use it.
> * gnu/packages/perl.scm (perl-devel-globaldestruction)
>   (perl-devel-lexalias, perl-exporter-lite): Adapt to Texinfo's markup.
> * gnu/packages/python.scm (python2-empy): Likewise.
> ---
>  gnu/packages/perl.scm   | 6 +++---
>  gnu/packages/python.scm | 2 +-
>  guix/packages.scm       | 6 ++++++
>  guix/ui.scm             | 5 +++--
>  guix/utils.scm          | 8 ++++++++
>  5 files changed, 21 insertions(+), 6 deletions(-)
>
[...]
> -  (define (description->recutils str)
> -    (let ((str (P_ str)))
> +  (define (description->recutils package)
                                    ^^^
> +    (let ((str (texi->plain-text (P_ str))))
>        (string->recutils
>         (fill-paragraph str width
>                         (string-length "description: ")))))

There is a mistake here, it should be 'str' instead of 'package'.

Here is the updated draft.

>From e98c0ec3b609c077bf471cf838f12f54a89a0226 Mon Sep 17 00:00:00 2001
From: Mathieu Lirzin <m...@openmailbox.org>
Date: Fri, 7 Aug 2015 00:10:43 +0200
Subject: [PATCH] packages: Add package-description-string.

* guix/packages.scm (package-description-string): New variable.
* guix/utils.scm (texi->plain-text): Likewise.
* guix/ui.scm (package->recutils): Use it.
* gnu/packages/perl.scm (perl-devel-globaldestruction)
  (perl-devel-lexalias, perl-exporter-lite): Adapt to Texinfo's markup.
* gnu/packages/python.scm (python2-empy): Likewise.
---
 gnu/packages/perl.scm   | 6 +++---
 gnu/packages/python.scm | 2 +-
 guix/packages.scm       | 6 ++++++
 guix/ui.scm             | 3 ++-
 guix/utils.scm          | 8 ++++++++
 5 files changed, 20 insertions(+), 5 deletions(-)

diff --git a/gnu/packages/perl.scm b/gnu/packages/perl.scm
index f784798..0236d05 100644
--- a/gnu/packages/perl.scm
+++ b/gnu/packages/perl.scm
@@ -1665,7 +1665,7 @@ particular command is available.")
     (home-page "http://search.cpan.org/dist/Devel-GlobalDestruction";)
     (synopsis "Provides equivalent of ${^GLOBAL_PHASE} eq 'DESTRUCT' for older perls")
     (description "Devel::GlobalDestruction provides a function returning the
-equivalent of \"${^GLOBAL_PHASE} eq 'DESTRUCT'\" for older perls.")
+equivalent of \"$@{^GLOBAL_PHASE@} eq 'DESTRUCT'\" for older perls.")
     (license (package-license perl))))
 
 (define-public perl-devel-lexalias
@@ -1909,7 +1909,7 @@ constructors, which speeds code up at runtime by a significant amount.  String
 eval is not without its issues however - it's difficult to control the scope
 it's used in (which determines which variables are in scope inside the eval),
 and it's easy to miss compilation errors, since eval catches them and sticks
-them in $@ instead.  This module attempts to solve these problems.  It
+them in $@@ instead.  This module attempts to solve these problems.  It
 provides an eval_closure function, which evals a string in a clean
 environment, other than a fixed list of specified variables.  Compilation
 errors are rethrown automatically.")
@@ -1953,7 +1953,7 @@ in your modules in a \"Java-esque\" manner.")
     (description
      "Exporter::Lite is an alternative to Exporter, intended to provide a
 lightweight subset of the most commonly-used functionality.  It supports
-import(), @EXPORT and @EXPORT_OK and not a whole lot else.")
+import(), @@EXPORT and @@EXPORT_OK and not a whole lot else.")
     (home-page (string-append "http://search.cpan.org/~neilb/";
                               "Exporter-Lite-" version))
     (license (package-license perl))))
diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm
index 940efec..07275d7 100644
--- a/gnu/packages/python.scm
+++ b/gnu/packages/python.scm
@@ -1171,7 +1171,7 @@ other Python program.")
      "EmPy is a system for embedding Python expressions and statements in
 template text; it takes an EmPy source file, processes it, and produces
 output.  This is accomplished via expansions, which are special signals to the
-EmPy system and are set off by a special prefix (by default the at sign, @).
+EmPy system and are set off by a special prefix (by default the at sign, @@).
 EmPy can expand arbitrary Python expressions and statements in this way, as
 well as a variety of special forms.  Textual data not explicitly delimited in
 this way is sent unaffected to the output, allowing Python to be used in
diff --git a/guix/packages.scm b/guix/packages.scm
index 3983d14..56d0f56 100644
--- a/guix/packages.scm
+++ b/guix/packages.scm
@@ -1,5 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2012, 2013, 2014, 2015 Ludovic Courtès <l...@gnu.org>
+;;; Copyright © 2015 Mathieu Lirzin <m...@openmailbox.org>
 ;;; Copyright © 2014, 2015 Mark H Weaver <m...@netris.org>
 ;;;
 ;;; This file is part of GNU Guix.
@@ -71,6 +72,7 @@
             package-replacement
             package-synopsis
             package-description
+            package-description-string
             package-license
             package-home-page
             package-supported-systems
@@ -315,6 +317,10 @@ representation."
   "Return the full name of PACKAGE--i.e., `NAME-VERSION'."
   (string-append (package-name package) "-" (package-version package)))
 
+(define (package-description-string package)
+  "Return a plain-text representation of PACKAGE description field."
+  (texi->plain-text (package-description package)))
+
 (define (%standard-patch-inputs)
   (let* ((canonical (module-ref (resolve-interface '(gnu packages base))
                                 'canonical-package))
diff --git a/guix/ui.scm b/guix/ui.scm
index a6d4fd1..0f66301 100644
--- a/guix/ui.scm
+++ b/guix/ui.scm
@@ -3,6 +3,7 @@
 ;;; Copyright © 2013 Mark H Weaver <m...@netris.org>
 ;;; Copyright © 2013 Nikita Karetnikov <nik...@karetnikov.org>
 ;;; Copyright © 2014 Alex Kost <alez...@gmail.com>
+;;; Copyright © 2015 Mathieu Lirzin <m...@openmailbox.org>
 ;;; Copyright © 2014 Deck Pickard <deck.r.pick...@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
@@ -785,7 +786,7 @@ followed by \"+ \", which makes for a valid multi-line field value in the
   "Write to PORT a `recutils' record of package P, arranging to fit within
 WIDTH columns."
   (define (description->recutils str)
-    (let ((str (P_ str)))
+    (let ((str (texi->plain-text (P_ str))))
       (string->recutils
        (fill-paragraph str width
                        (string-length "description: ")))))
diff --git a/guix/utils.scm b/guix/utils.scm
index 44913c6..e6513aa 100644
--- a/guix/utils.scm
+++ b/guix/utils.scm
@@ -3,6 +3,7 @@
 ;;; Copyright © 2013, 2014, 2015 Mark H Weaver <m...@netris.org>
 ;;; Copyright © 2014 Eric Bavier <bav...@member.fsf.org>
 ;;; Copyright © 2014 Ian Denhardt <i...@zenhack.net>
+;;; Copyright © 2015 Mathieu Lirzin <m...@openmailbox.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -38,6 +39,8 @@
   #:use-module (ice-9 regex)
   #:use-module (ice-9 match)
   #:use-module (ice-9 format)
+  #:use-module (texinfo)
+  #:use-module (texinfo plain-text)
   #:use-module (system foreign)
   #:export (bytevector->base16-string
             base16-string->bytevector
@@ -72,6 +75,7 @@
             version-major+minor
             guile-version>?
             package-name->name+version
+            texi->plain-text
             string-replace-substring
             arguments-from-environment-variable
             file-extension
@@ -594,6 +598,10 @@ introduce the version part."
       ((head tail ...)
        (loop tail (cons head prefix))))))
 
+(define (texi->plain-text str)
+  "Return a plain-text representation of texinfo fragment STR."
+  (stexi->plain-text (texi-fragment->stexi str)))
+
 (define (file-extension file)
   "Return the extension of FILE or #f if there is none."
   (let ((dot (string-rindex file #\.)))
-- 
2.5.0

--
Mathieu Lirzin



Reply via email to