From 04fc260c5af5c992db43e4689d9775667554be5d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Fr=C3=A9d=C3=A9ric=20Perrin?= Date: Sat, 5 Feb 2011 16:12:03 +0100 Subject: [PATCH] Add the mandatory DIV element around XHTML entries. --- atom.el | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/atom.el b/atom.el index 693c606..51c9d7d 100644 --- a/atom.el +++ b/atom.el @@ -276,15 +276,18 @@ Atom feed. CONTENT must be a string." (insert "
") (insert string) (insert "
") - (xml-parse-region (point-min) (point-max)))) + ;; `xml-parse-region' doesn't require that the XML parsed be enclosed in a + ;; root node, and accordingly, returns a list of elements. We are only + ;; interested in the first one, the DIV we just inserted. + (car (xml-parse-region (point-min) (point-max))))) (defun atom-massage-xhtml (content) "Massage CONTENT so it can be used as an XHTML fragment in an Atom feed." - `(((type . "xhtml")) - ,@(or (and (stringp content) - (atom-string-to-xml content)) - content))) + (list '((type . "xhtml")) + (or (and (stringp content) + (atom-string-to-xml content)) + `(div ((xmlns . "http://www.w3.org/1999/xhtml\">")) ,@content)))) (defun atom-massage-author (author) "Return an XML node representing the author. AUTHOR can be: @@ -337,10 +340,14 @@ CREATION-DATE of the entry, and the domain part of LINK." (url-recreate-url url-base)))) (defun xml-node-as-text (node) - "Return a string representing NODEn, an XML structure." + "Return a string representing NODE, an XML structure." (with-temp-buffer (xml-print (xml-node-children node)) (buffer-string))) +(defun xml-node-create (name attrlist childlist) + "Create a new XML node." + (list name attrlist . childlist)) + (provide 'atom) ;;; atom.el ends here -- 2.43.0