From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id kIGKBOe/EWQwRAAASxT56A (envelope-from ) for ; Wed, 15 Mar 2023 13:53:59 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id OEKQBOe/EWRz3QAA9RJhRA (envelope-from ) for ; Wed, 15 Mar 2023 13:53:59 +0100 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id C2F95394DD for ; Wed, 15 Mar 2023 13:53:58 +0100 (CET) Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1678884838; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post; bh=kkBtYR4O8UN434nLLjYA4gGc+VD9GQWjr09FXbwSnSs=; b=fzVdvaSJ/pneXNXQot0VHz0vSmY+FJp1hC4Gib4nih618Rr9PNhUaugkDGlZIku7Gamqj7 TiJtdBiwGHjFEpmDpIhrVof+4RnJQiJ2L7JtB21aMz61lMguOXvxs3voUb+BRfwX65eM3I 0v+yT+DRpyjFAE4IZWOQJqWbSYshC9arga3RMzqkAIqBu3HBNuVL4vvJBz1I5RouHH6DED WOBL6X3lDoYP2shb0S1yXtP2dbcBsvZOAyk6z5cYMa+fvet3U8Tq8anH979ZLVd6C7U3mk 8UsVrE9mlJeX9bjVROdp07d8K2AjjYteCpXhZL/qcFsl+XZWq6DWLKcWKw/PYA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" ARC-Seal: i=1; s=key1; d=yhetil.org; t=1678884838; a=rsa-sha256; cv=none; b=dX5QwrwGJF59Z1abUB/pDYwE1H+t5j7HjWZVfRUG7wzfFE2vHV7hBfVnNNBxHLy0pNdWxo Wo0BxofZmCJh2LHo4WUtDVz8Eco7KpDFvx35debsWRXN5eCYBztmgAOBaoWkz1JpeX2ALs gLAgZmbV6gI31nv7xTBy5FNHD+94Z4zCAfdIbiEx6rC84EdNLzqtHRcNH6cpd/ic4i1hBq 1f0PYBLNSz3M9MTxD+nWGda1BvqmkehWLXsk9EZuGtgDuafqCYgW4K50OcrdzWc/e8moHn k/dwMQ0+Nt9yZFFlEk+jdMp9nYzBlsvRQO8UCbYa8Sk1ZXGwazBVyqm6RkuXJg== Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pcQd5-0003xx-C8; Wed, 15 Mar 2023 08:53:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pcQcp-0003wD-5L for guix-patches@gnu.org; Wed, 15 Mar 2023 08:53:04 -0400 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pcQco-0003MS-So for guix-patches@gnu.org; Wed, 15 Mar 2023 08:53:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pcQco-0001dH-MM for guix-patches@gnu.org; Wed, 15 Mar 2023 08:53:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#62202] [PATCH 16/21] import: juliahub: Beautify description. Resent-From: Nicolas Graves Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 15 Mar 2023 12:53:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62202 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 62202@debbugs.gnu.org Cc: ngraves@ngraves.fr Received: via spool by 62202-submit@debbugs.gnu.org id=B62202.16788847346151 (code B ref 62202); Wed, 15 Mar 2023 12:53:02 +0000 Received: (at 62202) by debbugs.gnu.org; 15 Mar 2023 12:52:14 +0000 Received: from localhost ([127.0.0.1]:39350 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pcQc1-0001ax-8i for submit@debbugs.gnu.org; Wed, 15 Mar 2023 08:52:13 -0400 Received: from 6.mo581.mail-out.ovh.net ([188.165.39.218]:50091) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pcQbx-0001aF-DF for 62202@debbugs.gnu.org; Wed, 15 Mar 2023 08:52:10 -0400 Received: from director2.ghost.mail-out.ovh.net (unknown [10.109.146.19]) by mo581.mail-out.ovh.net (Postfix) with ESMTP id 70B6924945 for <62202@debbugs.gnu.org>; Wed, 15 Mar 2023 12:52:08 +0000 (UTC) Received: from ghost-submission-6684bf9d7b-fx869 (unknown [10.110.208.177]) by director2.ghost.mail-out.ovh.net (Postfix) with ESMTPS id 0E7061FE6C; Wed, 15 Mar 2023 12:52:08 +0000 (UTC) Received: from ngraves.fr ([37.59.142.97]) by ghost-submission-6684bf9d7b-fx869 with ESMTPSA id 67TSAXi/EWRJHgwAtympfQ (envelope-from ); Wed, 15 Mar 2023 12:52:08 +0000 X-OVh-ClientIp: 81.67.140.142 Date: Wed, 15 Mar 2023 13:51:25 +0100 Message-Id: <20230315125130.23041-16-ngraves@ngraves.fr> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230315125130.23041-1-ngraves@ngraves.fr> References: <20230315125130.23041-1-ngraves@ngraves.fr> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Ovh-Tracer-Id: 13796777460289561314 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: 0 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvhedrvddvkedggeegucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenucenucfjughrpefhvfevufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefpihgtohhlrghsucfirhgrvhgvshcuoehnghhrrghvvghssehnghhrrghvvghsrdhfrheqnecuggftrfgrthhtvghrnhepleffjeetueethfefkeffffefvddukeejkefgleduiedthfekvefhiedvhfffgeegnecukfhppeduvdejrddtrddtrddupdefjedrheelrddugedvrdeljeenucevlhhushhtvghrufhiiigvpeefnecurfgrrhgrmhepihhnvghtpeduvdejrddtrddtrddupdhmrghilhhfrhhomhepoehnghhrrghvvghssehnghhrrghvvghsrdhfrheqpdhnsggprhgtphhtthhopedupdhrtghpthhtohepiedvvddtvdesuggvsggsuhhgshdrghhnuhdrohhrghdpoffvtefjohhsthepmhhoheekuddpmhhouggvpehsmhhtphhouhht X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Nicolas Graves X-ACL-Warn: , Nicolas Graves via Guix-patches X-Migadu-Queue-Id: C2F95394DD X-Spam-Score: -3.03 X-Migadu-Spam-Score: -3.03 X-Migadu-Scanner: scn0.migadu.com From: Nicolas Graves via Guix-patches via Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN X-TUID: uTu75zIwjSNE --- 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 3985d8d0be..338f042441 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 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.39.2