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 ms5.migadu.com with LMTPS id CA+uEgoXcWL7rgAAbAwnHQ (envelope-from ) for ; Tue, 03 May 2022 13:50:34 +0200 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 6DbEEgoXcWKQoAAA9RJhRA (envelope-from ) for ; Tue, 03 May 2022 13:50:34 +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 0E7F7861D for ; Tue, 3 May 2022 13:50:34 +0200 (CEST) Received: from localhost ([::1]:48616 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nlr33-0006BM-0q for larch@yhetil.org; Tue, 03 May 2022 07:50:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38596) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nlqwl-0003dg-HL for guix-patches@gnu.org; Tue, 03 May 2022 07:44:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:44942) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nlqwl-0002RQ-8c for guix-patches@gnu.org; Tue, 03 May 2022 07:44:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nlqwl-0005Q5-6l for guix-patches@gnu.org; Tue, 03 May 2022 07:44:03 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#55242] [PATCH 05/10] guix: import: go: Harden sxml->texi conversion. Resent-From: Attila Lendvai Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 03 May 2022 11:44:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 55242 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 55242@debbugs.gnu.org Cc: Attila Lendvai Received: via spool by 55242-submit@debbugs.gnu.org id=B55242.165157821220716 (code B ref 55242); Tue, 03 May 2022 11:44:03 +0000 Received: (at 55242) by debbugs.gnu.org; 3 May 2022 11:43:32 +0000 Received: from localhost ([127.0.0.1]:38822 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nlqwG-0005O4-2u for submit@debbugs.gnu.org; Tue, 03 May 2022 07:43:32 -0400 Received: from mail-ed1-f42.google.com ([209.85.208.42]:34329) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nlqwD-0005N7-Ke for 55242@debbugs.gnu.org; Tue, 03 May 2022 07:43:29 -0400 Received: by mail-ed1-f42.google.com with SMTP id a21so19525563edb.1 for <55242@debbugs.gnu.org>; Tue, 03 May 2022 04:43:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=l8EBOt5SVXWzpaDhx/Bhrgf83/rE3rCzepMLOfV+yCc=; b=AnPL6C6a0VvRTC5OJaMcI5ikMZDsRmcY4TNvZl2eUXHxwUJrI/73kBs1seZuRxZzJe pYdcWlhnMify8Ogen1ulhnNJ10841tb5TEb6+BClw8F6wYps4aJfqGXV1egtDtHYJuEx tHo6wakwsxti7L+sROcRdQ0+XDoqOvxfluvGnaPYEmA9mSmv40ZQLCYZnPX0rsqd4K2A Pjx3jR8kvNvtNkJJgsQr82yQyUTE1QVQM5C2aITH8FCUtX2YrGw8QyH8o2/oDYlIdDad eB7q11GYcbprjcS+om+SiP+0ffHesrrLh7VeW1cJNzbL7PWfHcaKDMIgr7L+VmBouH1z WiaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=l8EBOt5SVXWzpaDhx/Bhrgf83/rE3rCzepMLOfV+yCc=; b=LNa4spye5B8UMcq+gz1vqYjw2taZsUHfSbZ0RpiO/cTHIMsi9mosUbbaHNicn4lEHs iXhw3F/Zy7v8c/7kn4FH+rVBv4J/+0X/moOwUmfo0UAwzYxlGnFzgdysN/y3gUtZDFmN RXOhXLAOKp9UzHAWwmviG9ODOYhZ1KdxYrX3XCx5J4oPSCeN8LwsfIBrM+1YctyUEjUm NXV1YGRBZBUeStGImRfvk7N2cOrF12MsuLv9Z8PjHuH4Vva/kfjn8n8rV4q3zJZx0NVF vu+gRxrYyqyEoNCZXZFKyiQhHYqyrFKLLPL5eVpz7BpgaoqFnItpxQxFsJXj6iDGTkbT 7n/w== X-Gm-Message-State: AOAM530tHTpc1qIxQb/LueJJs9A/2rR53Jxeyw9lBEzSzEvYVFvD/B0i wkEyjJQgmpNG1ZSl7DF7WkaKoS+uSUQ= X-Google-Smtp-Source: ABdhPJyiF6hFnrR6qsZw7KZ2CKW6ZpWVIHoS4lW2O+m2Me6l/HPUiVOMsskzxKz8pElVyAUNPWL6Vw== X-Received: by 2002:a50:8a96:0:b0:425:e046:76d9 with SMTP id j22-20020a508a96000000b00425e04676d9mr17531066edj.115.1651578204017; Tue, 03 May 2022 04:43:24 -0700 (PDT) Received: from lelap.local (catv-89-132-245-188.catv.fixed.vodafone.hu. [89.132.245.188]) by smtp.gmail.com with ESMTPSA id k13-20020a05640212cd00b0042617ba63d6sm7766964edx.96.2022.05.03.04.43.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 May 2022 04:43:23 -0700 (PDT) From: Attila Lendvai Date: Tue, 3 May 2022 13:42:56 +0200 Message-Id: <20220503114301.9524-5-attila@lendvai.name> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220503114301.9524-2-attila@lendvai.name> References: <20220503114301.9524-2-attila@lendvai.name> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1651578634; 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=l8EBOt5SVXWzpaDhx/Bhrgf83/rE3rCzepMLOfV+yCc=; b=XeHEnbxCmms9GeGKxqvRjP3MWMB1Omlov3WpPDIGIJoZob3BnL2ks/YPSKuJLUOjSv0LzT 7gamBBX7z7pJ537CKFdEtageSxNfqPftaGAOmmGNvG+n1/1/gFbDvXCu2QldO12aGFe/nz nRW4SXMfzyj0k/LX+8r2RTbxLNR6SviGTQzfyppZmpx85TzqvPf4evDyFeMBaRXiSTyRox jRek2b9VRfu75xv3XwHtHPaApkYF6JGPhsJ3Fs5eXTbuFbGtQWlnFG4rLuOkq8KMAiOAKp yEUJOI2IZwVDaRF19diHW+f/pkBP9cxvE/w7RnabgGgRcyHDE9vit+ubUua99A== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1651578634; a=rsa-sha256; cv=none; b=BLDoRjOYYwST4dWNoys8xa6iX+y5yIQcePq6kPWbyJkru78K5H/sXWbq+lMxhMq98PF4Hk 1lhLMKY1MEfq7EfbJIecq1oNKRINmoADRgr20sGb/9vq6/xwbGDCLwO065Qs7MD5t4zxUV S7KW0bFAXAHFsd1OGXC5L6RldbAHIrNHxhZJ2sm4/iV72kNWHVSSaJ1rLtstYETb7Rf+uB 2VLHK++kpaLedlorbodYUT2ssHk4Okp8HwlgMk/jzbHMe56abfNaWoOKfp/2Ns6frQV7iW 0Oum3INb9dt7XfXjmv4QW5LJYx44+jMQHcGi5gG+UFIcCe6jUeV1yBNhX93p3A== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=AnPL6C6a; dmarc=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" X-Migadu-Spam-Score: 2.52 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=AnPL6C6a; dmarc=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" X-Migadu-Queue-Id: 0E7F7861D X-Spam-Score: 2.52 X-Migadu-Scanner: scn1.migadu.com X-TUID: lzHEPoN4q1pt * guix/import/go.scm (sxml->texi): Escape @ as @@, and only emit the text part of URLs if they are plain strings. --- guix/import/go.scm | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/guix/import/go.scm b/guix/import/go.scm index a115c61adc..6b0fbaa8b6 100644 --- a/guix/import/go.scm +++ b/guix/import/go.scm @@ -172,13 +172,26 @@ (define (sxml->texi sxml-node) "A very basic SXML to Texinfo converter which attempts to preserve HTML formatting and links as text." (sxml-match sxml-node - ((strong ,text) - (format #f "@strong{~a}" text)) - ((a (@ (href ,url)) ,text) - (format #f "@url{~a,~a}" url text)) - ((code ,text) - (format #f "@code{~a}" text)) - (,something-else something-else))) + ((strong ,text) + (format #f "@strong{~a}" text)) + ((a (@ (href ,url)) ,body) + ;; Examples: image in the url: github.com/go-openapi/jsonpointer + ;; (code ...) in the URL body: github.com/mwitkow/go-conntrack + (if (string? body) + (format #f "@url{~a,~a}" url body) + (sxml-match body + ((code ,text) + (format #f "@url{~a,~a}" url (sxml->texi body))) + (,_ + (format #f "@url{~a}" url))))) + ((code ,text) + (format #f "@code{~a}" text)) + (,something-else + ;; Example: @ in the description: github.com/ethersphere/langos + (if (string? something-else) + (string-replace-substring something-else + "@" "@@") + something-else)))) (define (go-package-description name) "Retrieve a short description for NAME, a Go package name, -- 2.35.1