From unknown Sat Aug 09 01:11:43 2025 X-Loop: help-debbugs@gnu.org Subject: bug#71889: [PATCH] nnatom: Ensure some parsed values are one line Resent-From: Daniel Semyonov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 01 Jul 2024 23:45:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 71889 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: 71889@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.171987749116495 (code B ref -1); Mon, 01 Jul 2024 23:45:02 +0000 Received: (at submit) by debbugs.gnu.org; 1 Jul 2024 23:44:51 +0000 Received: from localhost ([127.0.0.1]:35127 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sOQhX-0004Hy-AI for submit@debbugs.gnu.org; Mon, 01 Jul 2024 19:44:51 -0400 Received: from lists.gnu.org ([209.51.188.17]:35676) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sOQhV-0004Hr-Jo for submit@debbugs.gnu.org; Mon, 01 Jul 2024 19:44:50 -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 1sOQhU-0008HC-HA for bug-gnu-emacs@gnu.org; Mon, 01 Jul 2024 19:44:48 -0400 Received: from dsemy.com ([46.23.89.208]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sOQhS-00039p-NZ for bug-gnu-emacs@gnu.org; Mon, 01 Jul 2024 19:44:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=dkim; bh=4US5cMPPPKavI CFyQxz2g4QQ84uqrgfqm1nZeui62Cw=; h=date:subject:to:from; d=dsemy.com; b=uc4fJlgoeYsSHyEshx3JjG6wHkvD2OFzqPlO3Jd0juI/FIN6mSkhPWnBKUDrjbIlXq84 zlq3qKw+Oj2sSF5Xl0A+RgcidAOP3OZ6jQOS6Y2fTybA70y8DPxtBFMgGeieg0WEgcow91 Vm1JxEga2E+FyDv+1WT1nCNi+6UINQ7DysgcX1JaEVz9FivoGiiPOQZoC6I+VyCVPmF/6r WtEBgnPp4aF8RGKLibziXEQCbzAhADbS4izZW+vDO1qqK9uoTYNZXwrkrjM0yQ7PPVdgcw N2PKPFBLnJ9OAgP0gFryC86Ombu5AQz41su49FuAri0y2HgRBs4zn6+9D5nXMScQ== Received: from coldharbour ( [2a06:c701:4840:6800:1231:246:5c8b:b4ed]) by dsemy.com (OpenSMTPD) with ESMTPSA id 6bc840c4 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO) for ; Tue, 2 Jul 2024 01:44:45 +0200 (CEST) From: Daniel Semyonov Date: Tue, 02 Jul 2024 02:44:04 +0300 Message-ID: <87zfr065kr.fsf@dsemy.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=46.23.89.208; envelope-from=daniel@dsemy.com; helo=dsemy.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, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_FILL_THIS_FORM_SHORT=0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.4 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.4 (--) --=-=-= Content-Type: text/plain Tags: patch Hi, Attached is a patch which ensures some values parsed by nnatom from Atom feeds only contain a single line of whitespace-trimmed text. Daniel In GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.41, cairo version 1.18.0) of 2024-06-12 built on coldharbour Repository revision: 3905db6e3aa947b847c072259ad6d08c8a15e10e Repository branch: master System Description: Void Linux Configured using: 'configure -C --prefix=/opt/Emacs --without-x --with-pgtk --with-small-ja-dic --with-native-compilation 'CFLAGS=-march=native -O2'' --=-=-= Content-Type: text/patch Content-Disposition: attachment; filename=0001-nnatom-Ensure-some-parsed-values-are-one-line.patch >From 3fa370de964dbbaa89b4cce5baa0602951dabfcf Mon Sep 17 00:00:00 2001 From: Daniel Semyonov Date: Tue, 2 Jul 2024 02:15:24 +0300 Subject: [PATCH] nnatom: Ensure some parsed values are one line * lisp/gnus/nnatom.el (nnatom--dom-line): New function. (nnatom--read-title, nnatom--read-description) (nnatom--read-article-or-group-authors, nnatom--read-subject) (nnatom--read-id, nnatom--read-publish, nnatom--read-update) (nnatom--read-links): Read text using `nnatom--dom-line'. --- lisp/gnus/nnatom.el | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/lisp/gnus/nnatom.el b/lisp/gnus/nnatom.el index 13286159784..f6885abb634 100644 --- a/lisp/gnus/nnatom.el +++ b/lisp/gnus/nnatom.el @@ -108,15 +108,19 @@ nnatom--read-article (defvoo nnatom-read-article-function #'nnatom--read-article nil nnfeed-read-article-function) +(defun nnatom--dom-line (node) + "Return NODE's text as a single, whitespace-trimmed line." + (string-trim (replace-regexp-in-string "[\r\n]+" " " (dom-text node) t))) + (defun nnatom--read-title (group) "Return the title of GROUP, or nil." - (dom-text (dom-child-by-tag group 'title))) + (nnatom--dom-line (dom-child-by-tag group 'title))) (defvoo nnatom-read-title-function #'nnatom--read-title nil nnfeed-read-title-function) (defun nnatom--read-description (group) "Return the description of GROUP, or nil." - (dom-text (dom-child-by-tag group 'subtitle))) + (nnatom--dom-line (dom-child-by-tag group 'subtitle))) (defvoo nnatom-read-description-function #'nnatom--read-description nil nnfeed-read-description-function) @@ -125,9 +129,9 @@ nnatom--read-article-or-group-authors (when-let ((a (mapconcat (lambda (author) - (let* ((name (dom-text (dom-child-by-tag author 'name))) + (let* ((name (nnatom--dom-line (dom-child-by-tag author 'name))) (name (unless (string-blank-p name) name)) - (email (dom-text (dom-child-by-tag author 'email))) + (email (nnatom--dom-line (dom-child-by-tag author 'email))) (email (unless (string-blank-p email) email))) (or (and name email (format "%s <%s>" name email)) name email))) (dom-children (dom-child-by-tag article-or-group 'authors)) @@ -142,7 +146,7 @@ nnatom-read-group-author-function (defun nnatom--read-subject (article) "Return the subject of ARTICLE, or nil." - (dom-text (dom-child-by-tag article 'title))) + (nnatom--dom-line (dom-child-by-tag article 'title))) (defvoo nnatom-read-subject-function #'nnatom--read-subject nil nnfeed-read-subject-function) @@ -150,7 +154,7 @@ nnatom--read-id "Return the ID of ARTICLE. If the ARTICLE doesn't contain an ID but it does contain a subject, return the subject. Otherwise, return nil." - (or (dom-text (dom-child-by-tag article 'id)) + (or (nnatom--dom-line (dom-child-by-tag article 'id)) (nnatom--read-subject article))) (defvoo nnatom-read-id-function #'nnatom--read-id nil nnfeed-read-id-function) @@ -158,14 +162,14 @@ nnatom-read-id-function (defun nnatom--read-publish (article) "Return the date and time ARTICLE was published, or nil." (when-let (d (dom-child-by-tag article 'published)) - (date-to-time (dom-text d)))) + (date-to-time (nnatom--dom-line d)))) (defvoo nnatom-read-publish-date-function #'nnatom--read-publish nil nnfeed-read-publish-date-function) (defun nnatom--read-update (article) "Return the date and time of the last update to ARTICLE, or nil." (when-let (d (dom-child-by-tag article 'updated)) - (date-to-time (dom-text d)))) + (date-to-time (nnatom--dom-line d)))) (defvoo nnatom-read-update-date-function #'nnatom--read-update nil nnfeed-read-update-date-function) @@ -185,13 +189,13 @@ nnatom--read-links (("text/html") . ,(format "[%s] " src label))))) (when-let (((or (eq l 'author) (eq l 'contributor))) - (name (dom-text (dom-child-by-tag link 'name))) + (name (nnatom--dom-line (dom-child-by-tag link 'name))) (name (if (string-blank-p name) (concat "Author" (and (< 1 (cl-incf aut)) (format " %s" aut))) name)) - (uri (dom-text (dom-child-by-tag link 'uri))) + (uri (nnatom--dom-line (dom-child-by-tag link 'uri))) ((not (string-blank-p uri)))) `(((("text/plain") . ,(format "%s: %s\n" name uri)) (("text/html") . ,(format "[%s] " -- 2.45.2 --=-=-=-- From unknown Sat Aug 09 01:11:43 2025 X-Loop: help-debbugs@gnu.org Subject: bug#71889: [PATCH] nnatom: Ensure some parsed values are one line Resent-From: Daniel Semyonov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 02 Jul 2024 21:25:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 71889 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: 71889@debbugs.gnu.org Received: via spool by 71889-submit@debbugs.gnu.org id=B71889.171995547310920 (code B ref 71889); Tue, 02 Jul 2024 21:25:01 +0000 Received: (at 71889) by debbugs.gnu.org; 2 Jul 2024 21:24:33 +0000 Received: from localhost ([127.0.0.1]:37960 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sOkzI-0002q4-TW for submit@debbugs.gnu.org; Tue, 02 Jul 2024 17:24:33 -0400 Received: from dsemy.com ([46.23.89.208]:23490) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sOkzG-0002pi-Vm for 71889@debbugs.gnu.org; Tue, 02 Jul 2024 17:24:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=dkim; bh=OwlaFD1TwgcXg ZU/FgB8eko+R+dSlGHyVwE+Sn6bXCU=; h=date:references:in-reply-to: subject:to:from; d=dsemy.com; b=VohOjbhSvX4OucZltuz4UVfkb2iZoxHg6JciD0 dS12eXWWWHRZOliGu2KPJi92iuiVZEqXTkwv5GjKtHLvksAjvT5G0w+KQmfnzVDrm9f7qe O1HXnwcYhiXcQRandUNwE/d3i3kMHOf4sd9NgtH5NfMI6SYn3nogC8t65cRVtdJdSp4rZi F255SlEhbBq/Lw3/+UssJrH2dGPwoQVkeH9Q5ncRqApYFQ1tm634O0NH3q7naNaYcOPr2B 9IUj9A8a7alDdzzHQZx6MvpVa9THq8zXt/89GvQ9mLWJ5nfPV6ZfY2+chQiocOf+Oi+eUJ SLrBH0gjmLz97q2nifS2vm9g== Received: from coldharbour ( [2a06:c701:4840:6800:1231:246:5c8b:b4ed]) by dsemy.com (OpenSMTPD) with ESMTPSA id 8231407a (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO) for <71889@debbugs.gnu.org>; Tue, 2 Jul 2024 23:24:23 +0200 (CEST) From: Daniel Semyonov In-Reply-To: <87zfr065kr.fsf@dsemy.com> (Daniel Semyonov's message of "Tue, 02 Jul 2024 02:44:04 +0300") References: <87zfr065kr.fsf@dsemy.com> Date: Wed, 03 Jul 2024 00:23:43 +0300 Message-ID: <87o77fjxnk.fsf@dsemy.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) >>>>> Daniel Semyonov writes: > Attached is a patch which ensures some values parsed by nnatom from Atom > feeds only contain a single line of whitespace-trimmed text. Just to clarify, this patch is intended to ensure values parsed from Atom feeds can be used by Gnus without issues. Without this patch feeds which contain multiple lines of text in some nodes can cause strange behavior in Gnus (though I haven't encountered any actual feeds like this, I had to construct one). This issue exists in both emacs-30 and the master branch. From unknown Sat Aug 09 01:11:43 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Daniel Semyonov Subject: bug#71889: closed (Re: bug#71889: [PATCH] nnatom: Ensure some parsed values are one line) Message-ID: References: <86plrq4ykl.fsf@gnu.org> <87zfr065kr.fsf@dsemy.com> X-Gnu-PR-Message: they-closed 71889 X-Gnu-PR-Package: emacs X-Gnu-PR-Keywords: patch Reply-To: 71889@debbugs.gnu.org Date: Sat, 06 Jul 2024 10:15:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1720260902-4353-1" This is a multi-part message in MIME format... ------------=_1720260902-4353-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #71889: [PATCH] nnatom: Ensure some parsed values are one line which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 71889@debbugs.gnu.org. --=20 71889: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D71889 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1720260902-4353-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 71889-done) by debbugs.gnu.org; 6 Jul 2024 10:14:33 +0000 Received: from localhost ([127.0.0.1]:45632 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sQ2R6-00017O-Lq for submit@debbugs.gnu.org; Sat, 06 Jul 2024 06:14:32 -0400 Received: from eggs.gnu.org ([209.51.188.92]:50184) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sQ2R5-00017B-0N for 71889-done@debbugs.gnu.org; Sat, 06 Jul 2024 06:14:31 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sQ2Qw-0001qC-56; Sat, 06 Jul 2024 06:14:22 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=/RxAdrwYeFzYVrRrSrApbgEwNvsEg89gdiTkQ7JVXtU=; b=aJjIxLP1kEkS Pu/d228qGQczaEdGlO/MWVU9forhHpvLjfDPQYC45JBRcgQJDW2z344tOMH9XSr6YJJ6dW77SHl8Y NTdtoeCigiQyX/Yl6qfjod2aDhJnuTbs7qfvyjINVJzE1ZuLCLtmQ64ixuKgnX4mzMKd5gJeHezTA 7TovQwSdjeEWHXaFRmarZQ17hS4qspsqM8MKyb/jvA33JzskdxtegM+xGrCRI/jJi92XuXk+p/RyX tMQCc8FPsj8voS8mxebht3iHhqe6jxPbhoR9ayqYwl0thCrq2hlZ+HC1D4EfHUjfEa7bmyJ8uHvi2 kRC/c8slx4iBKXXRpXSzaQ==; Date: Sat, 06 Jul 2024 13:14:18 +0300 Message-Id: <86plrq4ykl.fsf@gnu.org> From: Eli Zaretskii To: Daniel Semyonov In-Reply-To: <87o77fjxnk.fsf@dsemy.com> (bug-gnu-emacs@gnu.org) Subject: Re: bug#71889: [PATCH] nnatom: Ensure some parsed values are one line References: <87zfr065kr.fsf@dsemy.com> <87o77fjxnk.fsf@dsemy.com> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 71889-done Cc: 71889-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Date: Wed, 03 Jul 2024 00:23:43 +0300 > From: Daniel Semyonov via "Bug reports for GNU Emacs, > the Swiss army knife of text editors" > > >>>>> Daniel Semyonov writes: > > > Attached is a patch which ensures some values parsed by nnatom from Atom > > feeds only contain a single line of whitespace-trimmed text. > > Just to clarify, this patch is intended to ensure values parsed from > Atom feeds can be used by Gnus without issues. > Without this patch feeds which contain multiple lines of text in some > nodes can cause strange behavior in Gnus (though I haven't encountered > any actual feeds like this, I had to construct one). > > This issue exists in both emacs-30 and the master branch. Thanks, installed on the emacs-30 branch, and closing the bug. ------------=_1720260902-4353-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 1 Jul 2024 23:44:51 +0000 Received: from localhost ([127.0.0.1]:35127 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sOQhX-0004Hy-AI for submit@debbugs.gnu.org; Mon, 01 Jul 2024 19:44:51 -0400 Received: from lists.gnu.org ([209.51.188.17]:35676) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sOQhV-0004Hr-Jo for submit@debbugs.gnu.org; Mon, 01 Jul 2024 19:44:50 -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 1sOQhU-0008HC-HA for bug-gnu-emacs@gnu.org; Mon, 01 Jul 2024 19:44:48 -0400 Received: from dsemy.com ([46.23.89.208]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sOQhS-00039p-NZ for bug-gnu-emacs@gnu.org; Mon, 01 Jul 2024 19:44:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=dkim; bh=4US5cMPPPKavI CFyQxz2g4QQ84uqrgfqm1nZeui62Cw=; h=date:subject:to:from; d=dsemy.com; b=uc4fJlgoeYsSHyEshx3JjG6wHkvD2OFzqPlO3Jd0juI/FIN6mSkhPWnBKUDrjbIlXq84 zlq3qKw+Oj2sSF5Xl0A+RgcidAOP3OZ6jQOS6Y2fTybA70y8DPxtBFMgGeieg0WEgcow91 Vm1JxEga2E+FyDv+1WT1nCNi+6UINQ7DysgcX1JaEVz9FivoGiiPOQZoC6I+VyCVPmF/6r WtEBgnPp4aF8RGKLibziXEQCbzAhADbS4izZW+vDO1qqK9uoTYNZXwrkrjM0yQ7PPVdgcw N2PKPFBLnJ9OAgP0gFryC86Ombu5AQz41su49FuAri0y2HgRBs4zn6+9D5nXMScQ== Received: from coldharbour ( [2a06:c701:4840:6800:1231:246:5c8b:b4ed]) by dsemy.com (OpenSMTPD) with ESMTPSA id 6bc840c4 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO) for ; Tue, 2 Jul 2024 01:44:45 +0200 (CEST) From: Daniel Semyonov To: bug-gnu-emacs@gnu.org Subject: [PATCH] nnatom: Ensure some parsed values are one line Date: Tue, 02 Jul 2024 02:44:04 +0300 Message-ID: <87zfr065kr.fsf@dsemy.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=46.23.89.208; envelope-from=daniel@dsemy.com; helo=dsemy.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, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_FILL_THIS_FORM_SHORT=0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.4 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.4 (--) --=-=-= Content-Type: text/plain Tags: patch Hi, Attached is a patch which ensures some values parsed by nnatom from Atom feeds only contain a single line of whitespace-trimmed text. Daniel In GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.41, cairo version 1.18.0) of 2024-06-12 built on coldharbour Repository revision: 3905db6e3aa947b847c072259ad6d08c8a15e10e Repository branch: master System Description: Void Linux Configured using: 'configure -C --prefix=/opt/Emacs --without-x --with-pgtk --with-small-ja-dic --with-native-compilation 'CFLAGS=-march=native -O2'' --=-=-= Content-Type: text/patch Content-Disposition: attachment; filename=0001-nnatom-Ensure-some-parsed-values-are-one-line.patch >From 3fa370de964dbbaa89b4cce5baa0602951dabfcf Mon Sep 17 00:00:00 2001 From: Daniel Semyonov Date: Tue, 2 Jul 2024 02:15:24 +0300 Subject: [PATCH] nnatom: Ensure some parsed values are one line * lisp/gnus/nnatom.el (nnatom--dom-line): New function. (nnatom--read-title, nnatom--read-description) (nnatom--read-article-or-group-authors, nnatom--read-subject) (nnatom--read-id, nnatom--read-publish, nnatom--read-update) (nnatom--read-links): Read text using `nnatom--dom-line'. --- lisp/gnus/nnatom.el | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/lisp/gnus/nnatom.el b/lisp/gnus/nnatom.el index 13286159784..f6885abb634 100644 --- a/lisp/gnus/nnatom.el +++ b/lisp/gnus/nnatom.el @@ -108,15 +108,19 @@ nnatom--read-article (defvoo nnatom-read-article-function #'nnatom--read-article nil nnfeed-read-article-function) +(defun nnatom--dom-line (node) + "Return NODE's text as a single, whitespace-trimmed line." + (string-trim (replace-regexp-in-string "[\r\n]+" " " (dom-text node) t))) + (defun nnatom--read-title (group) "Return the title of GROUP, or nil." - (dom-text (dom-child-by-tag group 'title))) + (nnatom--dom-line (dom-child-by-tag group 'title))) (defvoo nnatom-read-title-function #'nnatom--read-title nil nnfeed-read-title-function) (defun nnatom--read-description (group) "Return the description of GROUP, or nil." - (dom-text (dom-child-by-tag group 'subtitle))) + (nnatom--dom-line (dom-child-by-tag group 'subtitle))) (defvoo nnatom-read-description-function #'nnatom--read-description nil nnfeed-read-description-function) @@ -125,9 +129,9 @@ nnatom--read-article-or-group-authors (when-let ((a (mapconcat (lambda (author) - (let* ((name (dom-text (dom-child-by-tag author 'name))) + (let* ((name (nnatom--dom-line (dom-child-by-tag author 'name))) (name (unless (string-blank-p name) name)) - (email (dom-text (dom-child-by-tag author 'email))) + (email (nnatom--dom-line (dom-child-by-tag author 'email))) (email (unless (string-blank-p email) email))) (or (and name email (format "%s <%s>" name email)) name email))) (dom-children (dom-child-by-tag article-or-group 'authors)) @@ -142,7 +146,7 @@ nnatom-read-group-author-function (defun nnatom--read-subject (article) "Return the subject of ARTICLE, or nil." - (dom-text (dom-child-by-tag article 'title))) + (nnatom--dom-line (dom-child-by-tag article 'title))) (defvoo nnatom-read-subject-function #'nnatom--read-subject nil nnfeed-read-subject-function) @@ -150,7 +154,7 @@ nnatom--read-id "Return the ID of ARTICLE. If the ARTICLE doesn't contain an ID but it does contain a subject, return the subject. Otherwise, return nil." - (or (dom-text (dom-child-by-tag article 'id)) + (or (nnatom--dom-line (dom-child-by-tag article 'id)) (nnatom--read-subject article))) (defvoo nnatom-read-id-function #'nnatom--read-id nil nnfeed-read-id-function) @@ -158,14 +162,14 @@ nnatom-read-id-function (defun nnatom--read-publish (article) "Return the date and time ARTICLE was published, or nil." (when-let (d (dom-child-by-tag article 'published)) - (date-to-time (dom-text d)))) + (date-to-time (nnatom--dom-line d)))) (defvoo nnatom-read-publish-date-function #'nnatom--read-publish nil nnfeed-read-publish-date-function) (defun nnatom--read-update (article) "Return the date and time of the last update to ARTICLE, or nil." (when-let (d (dom-child-by-tag article 'updated)) - (date-to-time (dom-text d)))) + (date-to-time (nnatom--dom-line d)))) (defvoo nnatom-read-update-date-function #'nnatom--read-update nil nnfeed-read-update-date-function) @@ -185,13 +189,13 @@ nnatom--read-links (("text/html") . ,(format "[%s] " src label))))) (when-let (((or (eq l 'author) (eq l 'contributor))) - (name (dom-text (dom-child-by-tag link 'name))) + (name (nnatom--dom-line (dom-child-by-tag link 'name))) (name (if (string-blank-p name) (concat "Author" (and (< 1 (cl-incf aut)) (format " %s" aut))) name)) - (uri (dom-text (dom-child-by-tag link 'uri))) + (uri (nnatom--dom-line (dom-child-by-tag link 'uri))) ((not (string-blank-p uri)))) `(((("text/plain") . ,(format "%s: %s\n" name uri)) (("text/html") . ,(format "[%s] " -- 2.45.2 --=-=-=-- ------------=_1720260902-4353-1--