[PATCH v2 18/23] DRAFT import: juliahub: Beautify description.

  • Done
  • quality assurance status badge
Details
One participant
  • Simon Tournier
Owner
unassigned
Submitted by
Simon Tournier
Severity
normal
Merged with

Debbugs page

Simon Tournier wrote 1 years ago
(address . 62202@debbugs.gnu.org)
378987b3ca7040ffbc2f8f665651e8efee4238ae.1695060058.git.zimon.toutoune@gmail.com
From: Nicolas Graves via Guix-patches via <guix-patches@gnu.org>

Signed-off-by: Simon Tournier <zimon.toutoune@gmail.com>
---
guix/import/juliahub.scm | 60 +++++++++++++++++++++++++++++++++++++---
1 file changed, 56 insertions(+), 4 deletions(-)

Toggle diff (95 lines)
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@end itemize")))
+ (ol . ,(lambda args
+ `("@enumerate" ,@(cdr args) "@end enumerate")))
+ (blockquote . ,(lambda args
+ `("@quotation" ,@(cdr args) "@end quotation")))
+ (li . ,(lambda args
+ `("\n@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
Simon Tournier wrote 1 years ago
control message for bug #66079
(address . control@debbugs.gnu.org)
86pm2fmc83.fsf@gmail.com
close 66079
quit
Simon Tournier wrote 1 years ago
control message for bug #66075
(address . control@debbugs.gnu.org)
86edivmc6m.fsf@gmail.com
merge 66075 66079
quit
Simon Tournier wrote 1 years ago
(address . control@debbugs.gnu.org)
86cyyfmc6f.fsf@gmail.com
merge 66075 66080
quit
Simon Tournier wrote 1 years ago
(address . control@debbugs.gnu.org)
86bkdzmc63.fsf@gmail.com
merge 66075 66081
quit
Simon Tournier wrote 1 years ago
(address . control@debbugs.gnu.org)
86a5tjmc4o.fsf@gmail.com
merge 66075 66089 66088 66087 66086 66085 66084 66083 66082
quit
Simon Tournier wrote 1 years ago
(address . control@debbugs.gnu.org)
868r93mc3w.fsf@gmail.com
merge 66075 66092 66091 66090
quit
?
Your comment

This issue is archived.

To comment on this conversation send an email to 66079@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 66079
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch
You may also tag this issue. See list of standard tags. For example, to set the confirmed and easy tags
mumi command -t +confirmed -t +easy
Or, remove the moreinfo tag and set the help tag
mumi command -t -moreinfo -t +help