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.
This commit is contained in:
Bastien Guerry 2014-08-22 15:38:47 +02:00
parent e7df9bc5ae
commit 6e2aed55bf

View file

@ -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"))
(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
(or (org-element-property :PUBDATE headline)
(error "Missing PUBDATE property"))))))
(org-time-string-to-time pubdate0)))))
(title (replace-regexp-in-string
org-bracket-link-regexp
(lambda (m) (or (match-string 3 m)
@ -264,6 +263,7 @@ communication channel."
(org-element-property :CUSTOM_ID headline)
publink)
info))))
(if (not pubdate0) "" ;; Skip entries with no PUBDATE prop
(format
(concat
"<item>\n"
@ -275,7 +275,7 @@ communication channel."
(org-rss-build-categories headline info) "\n"
"<description><![CDATA[%s]]></description>\n"
"</item>\n")
title publink author guid pubdate contents))))
title publink author guid pubdate contents)))))
(defun org-rss-build-categories (headline info)
"Build categories for the RSS item."