From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id cNF/OaDHvmVpnAAAe85BDQ:P1 (envelope-from ) for ; Sun, 04 Feb 2024 00:09:21 +0100 Received: from aspmx1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2.migadu.com with LMTPS id cNF/OaDHvmVpnAAAe85BDQ (envelope-from ) for ; Sun, 04 Feb 2024 00:09:21 +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=1707001760; 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=LeULb2UzYrkuMPvM9Mf+iq+QTPJMOMmAjzAhSyCuPuhE6uDpzs6XRUP2h2jXhLs/9wD1W+ uI1EW6lGfdP7YjxwY5+zxN+EKFapZds++sNeV+/D6jou5qlTe6AjaDSec6ZElhCXMISYz9 0h9NU/dwmROWuAO6u/3k/mye1rdqhIZEVDcxBfBwXcHFVky0YT92WgVfpv1idcK755E9eJ k7LNbwfmtEU9IvITSCc2wozBVx3vJ/RN2ycf6rIdtYLCOrQgYFUSwlEpgka8kf6KwiXvkV ruPmg7vqBzwx3tezM6Z3NK2yEnn10xI+YteSL0HDOPJ+mjbgn6qilYnbIRXTIg== 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 ARC-Seal: i=1; s=key1; d=yhetil.org; t=1707001760; a=rsa-sha256; cv=none; b=ROVcqtECPzSvup7Xu8jfsdqs0eJuxoAanml7pE+WjoFYkzwwOfx5qUeL48uGE7LFeBPg6N Ommcjzamr9Y3xEhz0RF9f/84RV7ykbeLh4NIe0hbL3L7GO/lc6+Yu1Pv6oRBoBQ1d669aX Oku20IMimiK7NAJNX0RWiS0/AM83XLntmiZdnLCtmZR33nwCATeHjXMN4wozu4nLTYFv1z d0yxDDM/SXuoh8SOmkaL/mzTUGrBi/7jfI9mmKqIv2c3ziz02KSbYmxrkvgBCfOh8Prcm6 67WHpdeUll3l+MEKW+CSmfbT/p/zT6ezUeajoJo7M9OFc+NFHWeL0QzWjSDV4w== 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 892455528A for ; Sun, 4 Feb 2024 00:09:20 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rWP81-0008BF-0g; Sat, 03 Feb 2024 18:08:53 -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 1rWP7z-0008Aw-Rs for guix-patches@gnu.org; Sat, 03 Feb 2024 18:08:51 -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 1rWP7z-0008ED-K0 for guix-patches@gnu.org; Sat, 03 Feb 2024 18:08:51 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rWP8B-0001HW-4z for guix-patches@gnu.org; Sat, 03 Feb 2024 18:09:03 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#62202] [PATCH v4 3/6] import: juliahub: Beautify description. Resent-From: Nicolas Graves Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 03 Feb 2024 23:09:03 +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, zimoun.toutoune@gmail.com Received: via spool by 62202-submit@debbugs.gnu.org id=B62202.17070017114846 (code B ref 62202); Sat, 03 Feb 2024 23:09:03 +0000 Received: (at 62202) by debbugs.gnu.org; 3 Feb 2024 23:08:31 +0000 Received: from localhost ([127.0.0.1]:47250 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rWP7f-0001G4-Gm for submit@debbugs.gnu.org; Sat, 03 Feb 2024 18:08:31 -0500 Received: from 9.mo584.mail-out.ovh.net ([46.105.40.176]:53255) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rWP7b-0001FI-5O for 62202@debbugs.gnu.org; Sat, 03 Feb 2024 18:08:28 -0500 Received: from director10.ghost.mail-out.ovh.net (unknown [10.109.176.72]) by mo584.mail-out.ovh.net (Postfix) with ESMTP id BBD8E25BDC for <62202@debbugs.gnu.org>; Sat, 3 Feb 2024 23:08:13 +0000 (UTC) Received: from ghost-submission-6684bf9d7b-xfz5d (unknown [10.108.42.33]) by director10.ghost.mail-out.ovh.net (Postfix) with ESMTPS id 565DD1FDEC; Sat, 3 Feb 2024 23:08:13 +0000 (UTC) Received: from ngraves.fr ([37.59.142.103]) by ghost-submission-6684bf9d7b-xfz5d with ESMTPSA id 12T/C13HvmUznggA0jpIEA (envelope-from ); Sat, 03 Feb 2024 23:08:13 +0000 X-OVh-ClientIp: 81.67.146.208 Date: Sun, 4 Feb 2024 00:07:13 +0100 Message-ID: <20240203230807.25751-3-ngraves@ngraves.fr> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240203230807.25751-1-ngraves@ngraves.fr> References: <20240203230807.25751-1-ngraves@ngraves.fr> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Ovh-Tracer-Id: 14365638387764814439 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: 0 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvkedrfedujedgtdejucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenucenucfjughrpefhvfevufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefpihgtohhlrghsucfirhgrvhgvshcuoehnghhrrghvvghssehnghhrrghvvghsrdhfrheqnecuggftrfgrthhtvghrnhepleffjeetueethfefkeffffefvddukeejkefgleduiedthfekvefhiedvhfffgeegnecukfhppeduvdejrddtrddtrddupdekuddrieejrddugeeirddvtdekpdefjedrheelrddugedvrddutdefnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepuddvjedrtddrtddruddpmhgrihhlfhhrohhmpeeonhhgrhgrvhgvshesnhhgrhgrvhgvshdrfhhrqedpnhgspghrtghpthhtohepuddprhgtphhtthhopeeivddvtddvseguvggssghughhsrdhgnhhurdhorhhgpdfovfetjfhoshhtpehmohehkeegpdhmohguvgepshhmthhpohhuth 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.66 X-Migadu-Scanner: mx13.migadu.com X-Spam-Score: -6.66 X-Migadu-Queue-Id: 892455528A X-TUID: c2HXg/6hu6uO --- 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