Fix a recent regression in Newsticker

* lisp/net/newst-backend.el (newsticker--parse-text-container):
New function.
(newsticker--parse-atom-1.0): Use it.  (Bug#79617)
This commit is contained in:
LdBeth 2025-10-19 00:11:52 +08:00 committed by Eli Zaretskii
parent 4ec24ce2a1
commit 6cb8a67e4b

View file

@ -1107,6 +1107,15 @@ same as in `newsticker--parse-atom-1.0'."
(xml-node-children node))))
(or new-item new-feed)))
(defun newsticker--parse-text-container (node)
"Handle content according to ``type'' attirbute."
(let ((content (car (xml-node-children node))))
(if (string= "html" (xml-get-attribute node 'type))
;; element contains entity escaped html
content
;; plain text or xhtml
(newsticker--unxml content))))
(defun newsticker--unxml (node)
"Reverse parsing of an xml string.
Restore an xml-string from a an xml NODE that was returned by xml-parse..."
@ -1159,23 +1168,14 @@ URL `http://www.atompub.org/2005/08/17/draft-ietf-atompub-format-11.html'"
name time (xml-get-children topnode 'entry)
;; title-fn
(lambda (node)
(car (xml-node-children
(car (xml-get-children node 'title)))))
(newsticker--parse-text-container
(car (xml-get-children node 'title))))
;; desc-fn
(lambda (node)
;; unxml the content or the summary node. Atom
;; allows for integrating (x)html into the atom
;; structure but we need the raw html string.
;; e.g. https://www.heise.de/open/news/news-atom.xml
;; https://feeds.feedburner.com/ru_nix_blogs
(or (newsticker--unxml
(car (xml-node-children
(car (xml-get-children node 'content)))))
(newsticker--unxml
(car (xml-node-children
(car (xml-get-children node 'summary)))))
(car (xml-node-children
(car (xml-get-children node 'summary))))))
(or (newsticker--parse-text-container
(car (xml-get-children node 'content)))
(newsticker--parse-text-container
(car (xml-get-children node 'summary)))))
;; link-fn
(lambda (node)
(xml-get-attribute