[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Orgmode] [PATCH 3/4] Unescape protected entities defined in `xml-entity
From: |
David Maus |
Subject: |
[Orgmode] [PATCH 3/4] Unescape protected entities defined in `xml-entity-alist'. |
Date: |
Sat, 19 Jun 2010 16:25:40 +0200 |
* org-feed.el (org-feed-unescape): New function. Unescape
protected entities.
(org-feed-parse-atom-entry): Use function for atom:content
type text and html.
---
lisp/org-feed.el | 15 +++++++++++++--
1 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/lisp/org-feed.el b/lisp/org-feed.el
index b0373e5..2621008 100644
--- a/lisp/org-feed.el
+++ b/lisp/org-feed.el
@@ -267,6 +267,17 @@ have been saved."
(defvar org-feed-buffer "*Org feed*"
"The buffer used to retrieve a feed.")
+(defun org-feed-unescape (s)
+ "Unescape protected entities in S."
+ (let ((re (concat "&\\("
+ (mapconcat (lambda (e)
+ (car e)) xml-entity-alist "\\|")
+ "\\);")))
+ (while (string-match re s)
+ (setq s (replace-match
+ (cdr (assoc (match-string 1 s) xml-entity-alist)) nil nil s)))
+ s))
+
;;;###autoload
(defun org-feed-update-all ()
"Get inbox items from all feeds in `org-feed-alist'."
@@ -647,10 +658,10 @@ formatted as a string, not the original XML data."
(cond
((string= type "text")
;; We like plain text.
- (setq entry (plist-put entry :description (car (xml-node-children
content)))))
+ (setq entry (plist-put entry :description (org-feed-unescape (car
(xml-node-children content))))))
((string= type "html")
;; TODO: convert HTML to Org markup.
- (setq entry (plist-put entry :description (car (xml-node-children
content)))))
+ (setq entry (plist-put entry :description (org-feed-unescape (car
(xml-node-children content))))))
((string= type "xhtml")
;; TODO: convert XHTML to Org markup.
(setq entry (plist-put entry :description (prin1-to-string
(xml-node-children content)))))
--
1.7.1
- [Orgmode] org-feed not working for codeproject, zwz, 2010/06/18
- Re: [Orgmode] org-feed not working for codeproject, David Maus, 2010/06/19
- [Orgmode] Re: org-feed not working for codeproject, zwz, 2010/06/19
- [Orgmode] [PATCH 0/4] org-feed: Improve feed parsing, David Maus, 2010/06/19
- [Orgmode] [PATCH 1/4] Respect possible XML namespace of rss:item elements., David Maus, 2010/06/19
- [Orgmode] [PATCH 2/4] Ignore case of rss element names., David Maus, 2010/06/19
- [Orgmode] [PATCH 3/4] Unescape protected entities defined in `xml-entity-alist'.,
David Maus <=
- [Orgmode] [PATCH 4/4] Unescape rss element content., David Maus, 2010/06/19
- [Orgmode] [PATCH] Declare variable `xml-entity-alist' for byte compiler., David Maus, 2010/06/19
- [Orgmode] [PATCH] Remove superfluous lambda., David Maus, 2010/06/19