[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Texinfo in descriptions?
From: |
Ludovic Courtès |
Subject: |
Re: Texinfo in descriptions? |
Date: |
Mon, 31 Aug 2015 23:21:25 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) |
Mathieu Lirzin <address@hidden> skribis:
>> Any performance figures? For instance, time of ‘guix package -s’ before
>> and after?
>
> With the updated patch I have obtained the following results for command
>
> time ./pre-inst-env guix package -s e
>
> - without patch:
> real 0m25.381s
> user 0m8.740s
> sys 0m0.184s
>
> - with patch:
> real 0m24.556s
> user 0m10.448s
> sys 0m0.220s
Sounds good.
[...]
> +(define (package-description-string package)
> + "Return a plain-text representation of PACKAGE description field."
> + (and=> (package-description package)
> + (compose stexi->plain-text texi-fragment->stexi P_)))
> +
> (define (string->recutils str)
> "Return a version of STR where newlines have been replaced by newlines
> followed by \"+ \", which makes for a valid multi-line field value in the
> @@ -786,10 +795,8 @@ 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)))
> - (string->recutils
> - (fill-paragraph str width
> - (string-length "description: ")))))
> + (string->recutils
> + (fill-paragraph str width (string-length "description: "))))
One last thing (I swear!).
AFAICS ‘stexi->plain-text’ already does paragraph filling, so the call
above is redundant (and could break the rendering.)
However, the width of the rendered text is fixed, unlike what
‘string->recutils’ did so far. To work around that, we’ll have to
monkey-patch the ‘wrap*’ procedure of (texinfo plain-text), along these
lines:
(define %text-width
(make-parameter (or (and=> (getenv "WIDTH") string->number)
80)))
(set! (@@ (texinfo plain-text) wrap*)
(lambda strings
... #:line-width (%text-width) ...))
and then in ‘package->recutils’, we need to ‘parameterize’ that.
We need a similar hack for #:initial-indent, that would allow us to
mimic the 3rd argument of ‘fill-paragraph’.
Could you try it?
> From 3c69e9f79f4d5bd5a75d4c083769caf32c1a63ec Mon Sep 17 00:00:00 2001
> From: Mathieu Lirzin <address@hidden>
> Date: Thu, 27 Aug 2015 17:51:11 +0200
> Subject: [PATCH] website: packages: Support Texinfo's markup.
>
> * website/www/packages.scm (package->sxml): Adapt to new Texinfo's
> markup in package description.
LGTM!
Thanks,
Ludo’.