From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:306:2d92::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id wIo7KdaRCGU2igAAauVa8A:P1 (envelope-from ) for ; Mon, 18 Sep 2023 20:07:18 +0200 Received: from aspmx1.migadu.com ([2001:41d0:306:2d92::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id wIo7KdaRCGU2igAAauVa8A (envelope-from ) for ; Mon, 18 Sep 2023 20:07:18 +0200 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 532DC57066 for ; Mon, 18 Sep 2023 20:07:18 +0200 (CEST) Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20230601 header.b=PomADEew; 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=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none) ARC-Seal: i=1; s=key1; d=yhetil.org; t=1695060438; a=rsa-sha256; cv=none; b=C26Jyadee9bydoG9WDZBrMGvwbMRIeEvyDCrvbW4Zzb4Oo93/Ke4hRGXrCWHIqKcgaYECO 8H+3j/J/vx1/jnwgqgKF6puIE/efP4Wu3tMmEAC7059EGNePzAIB7XIr7FKjP+nPkZ+kyr CqFwjn8bMYooVAEdERv3d05Q/J2YM1IFlsyU1wHOYoYIVeRc0NtX0KLb37QZfZ5EOSZ8eu b0kDLMtQ3ZozQNwAn1zKfAKpZO4tqiGcpIKD6XLbTEymktEYQV4NMx9xKTTwRVk4Kb8/Fx rxCM950Iarr2FNz3S5XAFD/h5kn7I1y+jnPMS7i/bEIg6QnT/MHxYRLYY3xykg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1695060438; h=from:from:sender:sender: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:dkim-signature; bh=+V8mAgQnV80VBwmubrhWWZdiRKsOpmwZCKgdLsNinEA=; b=Aoyj7VW434ygjz9RIVATWO4IJTkMX1o27xhhfmnt821FqrbvnGIA9xO5PcQwq2JKW+Bg9y FuTmcB54MF78PFB47AZ0QNE5Tk9y3YxjTGTUif5wwg8Me0yUig4EmKirb1udbP7KTGBELK 4wHKfiZemTQLjELWqmByrT4gw7EczSpgEqO+/+X69SuMHb1UulZWGgC4Bpmz5HoAv7sGS7 MlVRZKi0hMNYQN1SJsJ3Vn16VA6lyTBx7QaNB/5g/pVmrzuLgkMD/kfHC5ql0AH2NXhx4D 0nEjlfJRHt6Zx1yjG6XYc0spRN5FydD9xgjILSrWI3Irv5Y6iY6dg7m9XpYI1Q== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20230601 header.b=PomADEew; 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=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qiIdS-0005Iv-Rx; Mon, 18 Sep 2023 14:06:17 -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 1qiIdC-00052Q-5h for guix-patches@gnu.org; Mon, 18 Sep 2023 14:05:58 -0400 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 1qiIdB-00042D-SC for guix-patches@gnu.org; Mon, 18 Sep 2023 14:05:57 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qiIdK-0002U8-2t for guix-patches@gnu.org; Mon, 18 Sep 2023 14:06:06 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#66079] [PATCH v2 18/23] DRAFT import: juliahub: Beautify description. Resent-From: Simon Tournier Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 18 Sep 2023 18:06:05 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 66079 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 62202@debbugs.gnu.org Cc: 66079@debbugs.gnu.org, zimon.toutoune@gmail.com X-Debbugs-Original-Cc: Nicolas Graves via Guix-patches via , Simon Tournier Received: via spool by submit@debbugs.gnu.org id=B.16950603249351 (code B ref -1); Mon, 18 Sep 2023 18:06:05 +0000 Received: (at submit) by debbugs.gnu.org; 18 Sep 2023 18:05:24 +0000 Received: from localhost ([127.0.0.1]:54461 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qiIce-0002Qe-2q for submit@debbugs.gnu.org; Mon, 18 Sep 2023 14:05:24 -0400 Received: from lists.gnu.org ([2001:470:142::17]:58312) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qiIbe-0002Jg-Ny for submit@debbugs.gnu.org; Mon, 18 Sep 2023 14:04:25 -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 1qiIbD-0002Pg-88 for guix-patches@gnu.org; Mon, 18 Sep 2023 14:04:00 -0400 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qiIb9-0003QK-Tr for guix-patches@gnu.org; Mon, 18 Sep 2023 14:03:54 -0400 Received: by mail-wr1-x42a.google.com with SMTP id ffacd0b85a97d-32163c3ece5so66562f8f.1 for ; Mon, 18 Sep 2023 11:03:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1695060229; x=1695665029; darn=gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=+V8mAgQnV80VBwmubrhWWZdiRKsOpmwZCKgdLsNinEA=; b=PomADEewKMp+p8Zzli11DK+z/leh9Nv7xVXK2B4YztEtHZVZfdKMV2Bar287/ooAvy GShH3ubmkCbKvWvlIukU7LyBTfMIHiodXph29/qhladFLTfWmi4haof4XDGBt8Jkigh3 XhfDYZeWpalprwNPOVEbr+Jt8MSVFgMzpWZ5bYd72ds0y3cCIdq4H7CQXwgNmJ/IORJt xtegjvEYGVeMTiFSbbCQ7kLBTMgVAWVR8NAYIszkYFHO4Tg68ag2IFqGhS4mv8UjECAK aJCreBdfRf+sGbzE8pIi7T4r4kXMlbsuaDCW3Xt6ISyu8QMGjlllsPoCHkfMXTxbbGLG ARaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695060229; x=1695665029; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+V8mAgQnV80VBwmubrhWWZdiRKsOpmwZCKgdLsNinEA=; b=UR54BQTX3Ld6wFIhYYncSwwRo5YfZxjVYyZohbYCEGmUex1WD/7F0QttQUotUQgA5l kMNBFn5xkg1OA1H/dALOoJfdmZrYAvK2wPquKmt/LgrZixebs5velqPTO/PiTlGKoa42 AqFTLNFcYPqzl5u+NZuMGHk9MPGIBZuJ6dZWggrstsh4NLQKpaYh8IuykJhucfHB126H mTCBUgtVlBRxyoY23P4VxFicXaLkp2E4uJFZuv+MaAi5ec2oIVdhzy/7xgIkW/W/G30g rCqkG5jP/wL5Roiw6gY98tTZJOU1Gxju6yOxX56/u6E5x4q8cbG3OX6JZ8jHp7dvKwKn 8fgQ== X-Gm-Message-State: AOJu0YznxzNtyQ4MUId997OC09fl3euYUeOmXwzkUicZZ+tmGsxRFVY7 p0c/3bwuEdpzyjisbpjykhdqTSfcDx4= X-Google-Smtp-Source: AGHT+IHVRevR7p6J+iiE15IGIXyXC2TlCBoh6GqtOIb9L5A34ZcF7YTbO6C6qMezc72Zp+/3gdDxaQ== X-Received: by 2002:adf:e903:0:b0:31a:ed75:75e8 with SMTP id f3-20020adfe903000000b0031aed7575e8mr7681532wrm.2.1695060228730; Mon, 18 Sep 2023 11:03:48 -0700 (PDT) Received: from localhost.localdomain ([193.48.40.241]) by smtp.gmail.com with ESMTPSA id z2-20020adfd0c2000000b0030ada01ca78sm2210465wrh.10.2023.09.18.11.03.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Sep 2023 11:03:48 -0700 (PDT) From: Simon Tournier Date: Mon, 18 Sep 2023 20:03:25 +0200 Message-Id: <378987b3ca7040ffbc2f8f665651e8efee4238ae.1695060058.git.zimon.toutoune@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2a00:1450:4864:20::42a; envelope-from=zimon.toutoune@gmail.com; helo=mail-wr1-x42a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: , 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: -4.60 X-Spam-Score: -4.60 X-Migadu-Queue-Id: 532DC57066 X-Migadu-Scanner: mx2.migadu.com X-TUID: cZRw4lEXzslt From: Nicolas Graves via Guix-patches via Signed-off-by: Simon Tournier --- 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@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.38.1