From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mathieu Lirzin Subject: Re: Texinfo in descriptions? Date: Sun, 30 Aug 2015 22:42:46 +0200 Message-ID: <87zj18ik3d.fsf@openmailbox.org> References: <87wpy0nygt.fsf@gmail.com> <87y4ige2ux.fsf@openmailbox.org> <87wpy0t83c.fsf@gnu.org> <87r3o7pz3h.fsf@openmailbox.org> <87y4ietrdz.fsf_-_@gnu.org> <874mkx8a5o.fsf@openmailbox.org> <87wpxs9ux0.fsf@gnu.org> <87h9ov51j9.fsf@gnu.org> <87a8tcfnox.fsf@openmailbox.org> <87a8tbf5lu.fsf@openmailbox.org> <87613wlmgv.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:51762) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZW9RQ-0005Cy-7G for guix-devel@gnu.org; Sun, 30 Aug 2015 16:43:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZW9RM-0003MP-OD for guix-devel@gnu.org; Sun, 30 Aug 2015 16:43:04 -0400 Received: from smtp17.openmailbox.org ([62.4.1.51]:50253) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZW9RM-0003M9-5q for guix-devel@gnu.org; Sun, 30 Aug 2015 16:43:00 -0400 In-Reply-To: <87613wlmgv.fsf@gnu.org> ("Ludovic \=\?utf-8\?Q\?Court\=C3\=A8s\=22'\?\= \=\?utf-8\?Q\?s\?\= message of "Sun, 30 Aug 2015 19:23:12 +0200") List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org To: Ludovic =?utf-8?Q?Court=C3=A8s?= Cc: guix-devel@gnu.org, Alex Kost --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Here is an updated patch. ludo@gnu.org (Ludovic Court=C3=A8s) writes: > Mathieu Lirzin skribis: > >> From e98c0ec3b609c077bf471cf838f12f54a89a0226 Mon Sep 17 00:00:00 2001 >> From: Mathieu Lirzin >> 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. > > LGTM. > > We must also make sure that the Emacs UI (and guix-web, but that=E2=80=99= s a > different repo) use =E2=80=98package-description-string=E2=80=99 instead = of > =E2=80=98package-description=E2=80=99. > > For Emacs, I think it=E2=80=99s enough to > s/package-description/package-description-string/ in guix-main.scm. > Alex? Added. > >> 5 files changed, 20 insertions(+), 5 deletions(-) > > I like that it=E2=80=99s all it takes. :-) 5 files changed, 18 insertions(+), 11 deletions(-) Can you say less?! :) > Any performance figures? For instance, time of =E2=80=98guix package -s= =E2=80=99 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 This test has revealed one missing modification for "perl-dbd-pg" package description. > What about moving =E2=80=98package-description-string=E2=80=99 to (guix u= i) and have it > do both rendering and translation? > > If an application really needs rendered-but-not-translated stuff, it can > always use (compose texi-fragment->text package-description); I think > that=E2=80=99d be an unusual use case anyway. Yeah that's a nice minimal solution! Thanks. --=-=-= Content-Type: text/x-diff; charset=utf-8 Content-Disposition: attachment; filename=0001-ui-Add-package-description-string.patch Content-Transfer-Encoding: quoted-printable >From bb1ce4f315912e49d4416c2ed213f5f93e802db1 Mon Sep 17 00:00:00 2001 From: Mathieu Lirzin Date: Fri, 7 Aug 2015 00:10:43 +0200 Subject: [PATCH] ui: Add package-description-string. Provide support for Texinfo's markup in package description. * guix/ui.scm (package-description-string): New variable. (package->recutils): Use it. * emacs/guix-main.scm (%package-param-alist): Likewise. * gnu/packages/databases.scm (perl-dbd-pg): Adapt to Texinfo's markup. * gnu/packages/perl.scm (perl-devel-globaldestruction) (perl-devel-lexalias, perl-exporter-lite): Likewise. * gnu/packages/python.scm (python2-empy): Likewise. --- emacs/guix-main.scm | 2 +- gnu/packages/databases.scm | 2 +- gnu/packages/perl.scm | 6 +++--- gnu/packages/python.scm | 2 +- guix/ui.scm | 17 ++++++++++++----- 5 files changed, 18 insertions(+), 11 deletions(-) diff --git a/emacs/guix-main.scm b/emacs/guix-main.scm index fe224fb..73173f2 100644 --- a/emacs/guix-main.scm +++ b/emacs/guix-main.scm @@ -281,7 +281,7 @@ Example: (license . ,package-license-names) (source . ,package-source-names) (synopsis . ,package-synopsis) - (description . ,package-description) + (description . ,package-description-string) (home-url . ,package-home-page) (outputs . ,package-outputs) (non-unique . ,(negate package-unique?)) diff --git a/gnu/packages/databases.scm b/gnu/packages/databases.scm index cbac16e..1710d0e 100644 --- a/gnu/packages/databases.scm +++ b/gnu/packages/databases.scm @@ -578,7 +578,7 @@ columns, primary keys, unique constraints and relations= hips.") ("postgresql" ,postgresql))) (home-page "http://search.cpan.org/dist/DBD-Pg") (synopsis "DBI PostgreSQL interface") - (description "") + (description #f) (license (package-license perl)))) =20 (define-public perl-dbd-sqlite 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 o= lder perls") (description "Devel::GlobalDestruction provides a function returning t= he -equivalent of \"${^GLOBAL_PHASE} eq 'DESTRUCT'\" for older perls.") +equivalent of \"$@{^GLOBAL_PHASE@} eq 'DESTRUCT'\" for older perls.") (license (package-license perl)))) =20 (define-public perl-devel-lexalias @@ -1909,7 +1909,7 @@ constructors, which speeds code up at runtime by a si= gnificant amount. String eval is not without its issues however - it's difficult to control the sco= pe it's used in (which determines which variables are in scope inside the eva= l), and it's easy to miss compilation errors, since eval catches them and stic= ks -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/ui.scm b/guix/ui.scm index 8de8e3c..d355bd9 100644 --- a/guix/ui.scm +++ b/guix/ui.scm @@ -3,6 +3,7 @@ ;;; Copyright =C2=A9 2013 Mark H Weaver ;;; Copyright =C2=A9 2013 Nikita Karetnikov ;;; Copyright =C2=A9 2014, 2015 Alex Kost +;;; Copyright =C2=A9 2015 Mathieu Lirzin ;;; Copyright =C2=A9 2014 Deck Pickard ;;; ;;; This file is part of GNU Guix. @@ -45,6 +46,8 @@ #:use-module (ice-9 regex) #:autoload (system repl repl) (start-repl) #:autoload (system repl debug) (make-debug stack->vector) + #:use-module (texinfo) + #:use-module (texinfo plain-text) #:export (_ N_ P_ @@ -69,6 +72,7 @@ switch-symlinks config-directory fill-paragraph + package-description-string string->recutils package->recutils package-specification->name+version+output @@ -767,6 +771,11 @@ converted to a space; sequences of more than one line = break are preserved." ;;; Packages. ;;; =20 +(define (package-description-string package) + "Return a plain-text representation of PACKAGE description field." + (and=3D> (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: ")))) =20 (define (dependencies->recutils packages) (let ((list (string-join (map package-full-name @@ -835,7 +842,7 @@ WIDTH columns." (or (and=3D> (package-synopsis p) P_) ""))) (format port "description: ~a~%" - (and=3D> (package-description p) description->recutils)) + (and=3D> (package-description-string p) description->recutils)) (newline port)) =20 (define (string->generations str) --=20 2.5.0 --=-=-= Content-Type: text/plain And for the website. --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-website-packages-Support-Texinfo-s-markup.patch >From 3c69e9f79f4d5bd5a75d4c083769caf32c1a63ec Mon Sep 17 00:00:00 2001 From: Mathieu Lirzin 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. --- website/www/packages.scm | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/website/www/packages.scm b/website/www/packages.scm index 09da932..fe4fb2b 100644 --- a/website/www/packages.scm +++ b/website/www/packages.scm @@ -37,6 +37,8 @@ #:use-module (ice-9 i18n) #:use-module (srfi srfi-1) #:use-module (srfi srfi-19) + #:use-module (texinfo) + #:use-module (texinfo html) #:export (packages-page)) (define lookup-gnu-package @@ -170,6 +172,12 @@ decreasing, is 1." (package-transitive-supported-systems package))) " "))) + (define (package-description-shtml package) + "Return a SXML representation of PACKAGE description field with HTML +vocabulary." + (and=> (package-description package) + (compose stexi->shtml texi-fragment->stexi))) + (define (package-logo name) (and=> (lookup-gnu-package name) gnu-package-logo)) @@ -203,7 +211,7 @@ description-ids as formal parameters." (class "package-logo") (alt ("Logo of " ,(package-name package)))))) (_ #f)) - (p ,(package-description package)) + (p ,(package-description-shtml package)) ,(license package) (a (@ (href ,(package-home-page package)) (title "Link to the package's website")) -- 2.5.0 --=-=-= Content-Type: text/plain -- Mathieu Lirzin --=-=-=--