GNU bug report logs -
#66079
[PATCH v2 18/23] DRAFT import: juliahub: Beautify description.
Previous Next
Reported by: Simon Tournier <zimon.toutoune <at> gmail.com>
Date: Mon, 18 Sep 2023 18:06:05 UTC
Severity: normal
Tags: patch
Merged with 66075,
66076,
66077,
66078,
66080,
66081,
66082,
66083,
66084,
66085,
66086,
66087,
66088,
66089,
66090,
66091,
66092
Done: Simon Tournier <zimon.toutoune <at> gmail.com>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 66079 in the body.
You can then email your comments to 66079 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
guix-patches <at> gnu.org
:
bug#66079
; Package
guix-patches
.
(Mon, 18 Sep 2023 18:06:06 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Simon Tournier <zimon.toutoune <at> gmail.com>
:
New bug report received and forwarded. Copy sent to
guix-patches <at> gnu.org
.
(Mon, 18 Sep 2023 18:06:06 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
From: Nicolas Graves via Guix-patches via <guix-patches <at> gnu.org>
Signed-off-by: Simon Tournier <zimon.toutoune <at> gmail.com>
---
guix/import/juliahub.scm | 60 +++++++++++++++++++++++++++++++++++++---
1 file changed, 56 insertions(+), 4 deletions(-)
diff --git a/guix/import/juliahub.scm b/guix/import/juliahub.scm
index 3985d8d0be44..338f0424414c 100644
--- a/guix/import/juliahub.scm
+++ b/guix/import/juliahub.scm
@@ -32,8 +32,10 @@ (define-module (guix import juliahub)
#:use-module (guix base32)
#:use-module (guix packages)
#:use-module (guix upstream)
- #:use-module (json)
#:use-module ((guix licenses) #:prefix license:)
+ #:use-module (json)
+ #:use-module (htmlprag)
+ #:use-module (sxml transform)
#:export (juliahub->guix-package
%juliahub-updater
@@ -164,6 +166,53 @@ (define (parse-test-dependencies directory)
(filter (lambda (x) (not (member x %julia-stdlibs)))
(string-split (string-drop (string-drop-right pure 1) 7) #\,))))
+(define %juliahub-beautify-description-rules
+ `((h1 *preorder* . ,(lambda args #f))
+ (h2 *preorder* . ,(lambda args #f))
+ (h3 *preorder* . ,(lambda args #f))
+ (h4 *preorder* . ,(lambda args #f))
+ (hr *preorder* . ,(lambda args #f))
+ (span *preorder* . ,(lambda args #f))
+ (img *preorder* . ,(lambda args #f))
+ (pre *preorder* . ,(lambda args #f))
+ (div *preorder* . ,(lambda args #f))
+ (table *preorder* . ,(lambda args #f))
+ (imgalt *preorder* . ,(lambda args #f))
+ (@ *preorder* . ,(lambda args #f))
+ (*TOP* . ,(lambda args (cdr args)))
+ (p . ,(lambda args (cdr args)))
+ (em . ,(lambda args (cdr args)))
+ (strong . ,(lambda args (cdr args)))
+ (a . ,(lambda args
+ (match args
+ ((tag link ref)
+ (if ref ref #f))
+ (_ #f))))
+ (ul . ,(lambda args
+ `("@itemize" ,@(cdr args) "\n <at> end itemize")))
+ (ol . ,(lambda args
+ `("@enumerate" ,@(cdr args) "@end enumerate")))
+ (blockquote . ,(lambda args
+ `("@quotation" ,@(cdr args) "@end quotation")))
+ (li . ,(lambda args
+ `("\n <at> item" ,@(cdr args))))
+ (code . ,(lambda args
+ (string-append
+ "@code{"
+ (string-join (cdr args) " ")
+ "}")))
+ (*text* . ,(lambda (tag x) x))
+ (*default* . ,(lambda (tag . body)
+ (cons tag body)))))
+
+(define (juliahub-beautify-description description)
+ (string-join
+ (filter (lambda (x) (if (equal? x " ") #f x))
+ (flatten
+ (pre-post-order (html->sxml description)
+ %juliahub-beautify-description-rules)))
+ " "))
+
;; Julia package.
(define-json-mapping <juliahub-package> make-juliahub-package juliahub-package?
json->juliahub-package
@@ -211,8 +260,9 @@ (define (make-julia-sexp name source home-page synopsis description
,@(if (null? direct-dependencies)
'()
`((propagated-inputs
- (list ,@(map (compose julia-name->guix-name juliahub-dependency-name)
- direct-dependencies)))))
+ (list
+ ,@(map (compose julia-name->guix-name juliahub-dependency-name)
+ direct-dependencies)))))
,@(if (null? test-dependencies-names)
'()
`((native-inputs
@@ -264,7 +314,9 @@ (define* (juliahub->guix-package package-name
source
(juliahub-package-homepage package)
(juliahub-package-description package)
- (beautify-description (juliahub-package-readme package))
+ ((compose beautify-description
+ juliahub-beautify-description)
+ (juliahub-package-readme package))
direct-dependencies
test-dependencies-names
licenses)
--
2.38.1
bug closed, send any further explanations to
66079 <at> debbugs.gnu.org and Simon Tournier <zimon.toutoune <at> gmail.com>
Request was from
Simon Tournier <zimon.toutoune <at> gmail.com>
to
control <at> debbugs.gnu.org
.
(Mon, 18 Sep 2023 21:01:09 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Tue, 17 Oct 2023 11:24:10 GMT)
Full text and
rfc822 format available.
This bug report was last modified 1 year and 206 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.