From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2.migadu.com ([2001:41d0:700:3204::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id QO2VGa1FhGUe8QAAkFu2QA (envelope-from ) for ; Thu, 21 Dec 2023 15:03:25 +0100 Received: from aspmx1.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2.migadu.com with LMTPS id KPHFEa1FhGW1WwEAe85BDQ (envelope-from ) for ; Thu, 21 Dec 2023 15:03:25 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=none; 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"; dmarc=pass (policy=none) header.from=gnu.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1703167405; 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=k+R84N7Kp6IMJC+Magr1afjjNRBGNScFVm3+TJjIwZc=; b=EseoEyl6GRIPnLnGhxPwrSr2ZPNjM7iwPJ0gjY0ophKzgTGJNQPWnIJoqIcFMO+FlH0Y2Y +xNfdaR9mSIIh/4A+cpxUOuFkkRqJ4xIf58JIvqJDYCkDLGKjxfzECgUnKKX8I+0uW2x6i a669DV0R6i3ODrFqTuhsfe+GoeQlHWXpNWMsIPUd6n4W62xxc01Mm4ajEJ0v3ubQCW3dlk kkdxjCZ4YHhRgdHmda0nQBIXeWzpYjtvJLWQUKA8FvdB2Ijiv+IK7Ogx1dJT6ktO3aH4N3 G1IwXjsO1lIoc2sH/TKws6gUZ/EYpAWn9AR0DIMOFGJ8jOM51OkaePbbSWSATA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1703167405; a=rsa-sha256; cv=none; b=jI1jr6qRwpuk16aIzxzMH/iWSd7t7XrF+7Wr17a9CZ8SFyzgAgRIAbXpsejYiIfIwjwpCO vgyAgPqhYbW6vNK/qMqPJarKf+HpDuHuphVSkwheJ/aJpGN7D0n6T7itFEVvF4BmU0A07h vnlrgBjMgQqCmZ3Y7JToQRVBVPG1082caQbjlEgPZn6W/1phz8lnYrzCy1LpdGpF/ybcR3 mio88mQDkdt859sqSyDBKrcTwRnxAbAVllbUObzgEIPrbsnhgZesjpbeS9Q4mKo14+rczB N8TLh7V1+U5W/rHQ4p0Vaj/sKmXvg61YC1Ve5dulDQ+Fs7VSgt2eajRnqyj/4w== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; 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"; dmarc=pass (policy=none) header.from=gnu.org 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 0CA55553E8 for ; Thu, 21 Dec 2023 15:03:25 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rGJdc-0005iK-0O; Thu, 21 Dec 2023 09:03:00 -0500 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 1rGJda-0005hk-Pd for guix-patches@gnu.org; Thu, 21 Dec 2023 09:02:58 -0500 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rGJda-0005uv-5r for guix-patches@gnu.org; Thu, 21 Dec 2023 09:02:58 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rGJde-00010S-1u for guix-patches@gnu.org; Thu, 21 Dec 2023 09:03:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#62202] [PATCH v3 3/4] import: juliahub: Beautify description. Resent-From: Nicolas Graves Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 21 Dec 2023 14:03: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 moreinfo To: 62202@debbugs.gnu.org Cc: ngraves@ngraves.fr Received: via spool by 62202-submit@debbugs.gnu.org id=B62202.17031673233778 (code B ref 62202); Thu, 21 Dec 2023 14:03:02 +0000 Received: (at 62202) by debbugs.gnu.org; 21 Dec 2023 14:02:03 +0000 Received: from localhost ([127.0.0.1]:42695 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rGJcg-0000yd-7m for submit@debbugs.gnu.org; Thu, 21 Dec 2023 09:02:02 -0500 Received: from 5.mo576.mail-out.ovh.net ([46.105.43.105]:48553) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rGJca-0000xs-Bg for 62202@debbugs.gnu.org; Thu, 21 Dec 2023 09:01:57 -0500 Received: from director5.ghost.mail-out.ovh.net (unknown [10.109.139.217]) by mo576.mail-out.ovh.net (Postfix) with ESMTP id 2F74E28DF1 for <62202@debbugs.gnu.org>; Thu, 21 Dec 2023 14:01:51 +0000 (UTC) Received: from ghost-submission-6684bf9d7b-qnh7v (unknown [10.110.168.40]) by director5.ghost.mail-out.ovh.net (Postfix) with ESMTPS id 894721FEB9; Thu, 21 Dec 2023 14:01:50 +0000 (UTC) Received: from ngraves.fr ([37.59.142.107]) by ghost-submission-6684bf9d7b-qnh7v with ESMTPSA id TfEXGU5FhGUvHwAAfKi07w (envelope-from ); Thu, 21 Dec 2023 14:01:50 +0000 X-OVh-ClientIp: 89.85.249.141 Date: Thu, 21 Dec 2023 15:01:02 +0100 Message-ID: <20231221140142.16523-3-ngraves@ngraves.fr> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231221140142.16523-1-ngraves@ngraves.fr> References: <20231221140142.16523-1-ngraves@ngraves.fr> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Ovh-Tracer-Id: 4994210511922848482 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: 0 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvkedrvdduhedgfeegucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenucenucfjughrpefhvfevufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefpihgtohhlrghsucfirhgrvhgvshcuoehnghhrrghvvghssehnghhrrghvvghsrdhfrheqnecuggftrfgrthhtvghrnhepleffjeetueethfefkeffffefvddukeejkefgleduiedthfekvefhiedvhfffgeegnecukfhppeduvdejrddtrddtrddupdekledrkeehrddvgeelrddugedupdefjedrheelrddugedvrddutdejnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepuddvjedrtddrtddruddpmhgrihhlfhhrohhmpeeonhhgrhgrvhgvshesnhhgrhgrvhgvshdrfhhrqedpnhgspghrtghpthhtohepuddprhgtphhtthhopeeivddvtddvseguvggssghughhsrdhgnhhurdhorhhgpdfovfetjfhoshhtpehmohehjeeipdhmohguvgepshhmthhpohhuth 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 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-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Spam-Score: -6.19 X-Spam-Score: -6.19 X-Migadu-Queue-Id: 0CA55553E8 X-Migadu-Scanner: mx11.migadu.com X-TUID: 2Fe3dRx/PIvY --- guix/import/juliahub.scm | 53 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 51 insertions(+), 2 deletions(-) diff --git a/guix/import/juliahub.scm b/guix/import/juliahub.scm index ab838b6035..e4540de06d 100644 --- a/guix/import/juliahub.scm +++ b/guix/import/juliahub.scm @@ -30,8 +30,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 @@ -76,6 +78,53 @@ (define (ini-fetch url) (close-port port) (map ini-line->alist lines))) +;; Beautify description. +(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)) + (h5 *preorder* . ,(lambda args #f)) + (h6 *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 + `("@code{" ,@(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))) + " ")) + ;; Filtering out julia-stdlibs. ;; To update them, see file sysimg.jl. (define %julia-stdlibs @@ -264,7 +313,7 @@ (define* (juliahub->guix-package package-name ((? string?) homepage) (_ (juliahub-package-url package))) (juliahub-package-description package) - (beautify-description + ((compose beautify-description juliahub-beautify-description) (juliahub-package-readme package)) direct-dependencies test-dependencies-names -- 2.41.0