From c4367808f7a377c08bca89081f1ab106a79d3029 Mon Sep 17 00:00:00 2001 From: Simon Nicolussi Date: Sat, 15 Jan 2022 21:15:11 +0100 Subject: [PATCH] Replace some entities if a title's type is (X)HTML Atom titles with type "html" or "xhtml" might contain arbitrary HTML content, but most commonly they only include HTML/XML entities, and typically only numeric references. --- elfeed.el | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/elfeed.el b/elfeed.el index bbfef26..b5b2247 100644 --- a/elfeed.el +++ b/elfeed.el @@ -272,6 +272,7 @@ If PROTOCOL is nil, returns URL." (elfeed-feed-author feed) (elfeed--atom-authors-to-plist authors)) (cl-loop for entry in (xml-query-all* (feed entry) xml) collect (let* ((title (or (xml-query* (title *) entry) "")) + (title-type (or (xml-query* (title :type) entry) "")) (xml-base (elfeed-update-location xml-base (xml-query* (:base) (list entry)))) (anylink (xml-query* (link :href) entry)) @@ -308,7 +309,10 @@ If PROTOCOL is nil, returns URL." for length = (xml-query* (:length) wrap) collect (list href type length))) (db-entry (elfeed-entry--create - :title (elfeed-cleanup title) + :title (elfeed-cleanup + (if (string-match-p "html" title-type) + (xml-substitute-special title) + title)) :feed-id feed-id :id (cons namespace (elfeed-cleanup id)) :link (elfeed-cleanup link)