emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/webfeeder 4e980b2 17/22: RSS: Only include author if an


From: Pierre Neidhardt
Subject: [elpa] externals/webfeeder 4e980b2 17/22: RSS: Only include author if an email address is found in the string
Date: Tue, 26 Mar 2019 07:10:03 -0400 (EDT)

branch: externals/webfeeder
commit 4e980b262db619a5ea5f776be6bddeede8c5d7db
Author: Pierre Neidhardt <address@hidden>
Commit: Pierre Neidhardt <address@hidden>

    RSS: Only include author if an email address is found in the string
---
 webfeeder.el | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/webfeeder.el b/webfeeder.el
index 853be21..b05332d 100644
--- a/webfeeder.el
+++ b/webfeeder.el
@@ -297,7 +297,18 @@ The date is set to epoch if the item date is nil."
   (concat
    "<item>\n"
    (when (webfeeder-item-author item)
-     (concat "  <author>" (webfeeder-item-author item) "</author>\n"))
+     ;; RSS <author> tag must start with the email.  If no e-mail is found, we
+     ;; skip the tag altogether.  Since it's hard to parse email addresses, we
+     ;; use `mail-extract-address-components' which expects the "NAME <EMAIL>"
+     ;; format.
+     (let ((name+addr (mail-extract-address-components (webfeeder-item-author 
item))))
+       (when (cadr name+addr)
+         (concat "  <author>"
+                 (cadr name+addr)
+                 (if (car name+addr)
+                     (format " (%s)" (car name+addr))
+                   "")
+                 "</author>\n"))))
    "  <title>" (webfeeder-item-title item) "</title>\n"
    "  <description><![CDATA[" (webfeeder-item-body item) "]]></description>\n"
    (when (webfeeder-item-categories item)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]