소스 검색

ox-rss.el: Set the PUBDATE property value as an Org time-stamp

* ox-rss.el (org-rss-headline): Convert the PUBDATE property
value to a RFC 822 time string.
(org-rss-add-pubdate-property): Set the PUBDATE property value
as an Org time-stamp, so that users can edit it easily.
Bastien Guerry 12 년 전
부모
커밋
6155faa84b
1개의 변경된 파일9개의 추가작업 그리고 4개의 파일을 삭제
  1. 9 4
      contrib/lisp/ox-rss.el

+ 9 - 4
contrib/lisp/ox-rss.el

@@ -233,7 +233,13 @@ communication channel."
 		 (concat "sec-" (mapconcat 'number-to-string hl-number "-")))))
 	   (category (org-rss-plain-text
 		      (or (org-element-property :CATEGORY headline) "") info))
-	   (pubdate (org-element-property :PUBDATE headline))
+	   (pubdate
+	    (let ((system-time-locale "C"))
+	      (format-time-string
+	       "%a, %d %h %Y %H:%M:%S %Z"
+	       (org-time-string-to-time
+		(or (org-element-property :PUBDATE headline)
+		    (error "Missing PUBDATE property"))))))
 	   (title (org-rss-plain-text
 		   (org-element-property :raw-value headline) info))
 	   (publink
@@ -383,9 +389,8 @@ information."
 	   (unless (org-entry-get (point) "PUBDATE")
 	     (setq msg t)
 	     (org-set-property
-	      "PUBDATE"
-	      (let ((system-time-locale "C"))
-		(format-time-string "%a, %d %h %Y %H:%M:%S %Z")))))))
+	      "PUBDATE" (format-time-string
+			 (cdr org-time-stamp-formats)))))))
      nil nil 'comment 'archive)
     (when msg
       (message "Property PUBDATE added to top-level entries in %s"