From 6e2aed55bffce9a8ffcd5f9119ca96eec2846fc3 Mon Sep 17 00:00:00 2001 From: Bastien Guerry Date: Fri, 22 Aug 2014 15:38:47 +0200 Subject: [PATCH] ox-rss.el (org-rss-headline): Skip entries with no PUBDATE * contrib/lisp/ox-rss.el (org-rss-headline): Skip entries with no PUBDATE instead of throwing an error. Thanks to OSiUX for suggesting this. --- contrib/lisp/ox-rss.el | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/contrib/lisp/ox-rss.el b/contrib/lisp/ox-rss.el index 5cae28826..fddaa1df0 100644 --- a/contrib/lisp/ox-rss.el +++ b/contrib/lisp/ox-rss.el @@ -238,13 +238,12 @@ communication channel." (concat "sec-" (mapconcat 'number-to-string hl-number "-"))))) (category (org-rss-plain-text (or (org-element-property :CATEGORY headline) "") info)) - (pubdate - (let ((system-time-locale "C")) - (format-time-string - "%a, %d %b %Y %H:%M:%S %z" - (org-time-string-to-time - (or (org-element-property :PUBDATE headline) - (error "Missing PUBDATE property")))))) + (pubdate0 (org-element-property :PUBDATE headline)) + (pubdate (let ((system-time-locale "C")) + (if pubdate0 + (format-time-string + "%a, %d %b %Y %H:%M:%S %z" + (org-time-string-to-time pubdate0))))) (title (replace-regexp-in-string org-bracket-link-regexp (lambda (m) (or (match-string 3 m) @@ -264,18 +263,19 @@ communication channel." (org-element-property :CUSTOM_ID headline) publink) info)))) - (format - (concat - "\n" - "%s\n" - "%s\n" - "%s\n" - "%s\n" - "%s\n" - (org-rss-build-categories headline info) "\n" - "\n" - "\n") - title publink author guid pubdate contents)))) + (if (not pubdate0) "" ;; Skip entries with no PUBDATE prop + (format + (concat + "\n" + "%s\n" + "%s\n" + "%s\n" + "%s\n" + "%s\n" + (org-rss-build-categories headline info) "\n" + "\n" + "\n") + title publink author guid pubdate contents))))) (defun org-rss-build-categories (headline info) "Build categories for the RSS item."