ox-publish: Fix "bad timestamp" error with some DATE values
* lisp/ox-publish.el (org-publish-find-date): Fix "bad timestamp" error with some DATE values: :date property in communication channel is no longer a string.
This commit is contained in:
parent
67cf80ae9a
commit
e01daa00be
|
@ -810,22 +810,27 @@ Default for SITEMAP-FILENAME is 'sitemap.org'."
|
||||||
|
|
||||||
(defun org-publish-find-date (file)
|
(defun org-publish-find-date (file)
|
||||||
"Find the date of FILE in project.
|
"Find the date of FILE in project.
|
||||||
If FILE provides a #+date keyword use it else use the file
|
If FILE provides a DATE keyword use it else use the file system's
|
||||||
system's modification time.
|
modification time. Return time in `current-time' format."
|
||||||
|
|
||||||
It returns time in `current-time' format."
|
|
||||||
(let* ((org-inhibit-startup t)
|
(let* ((org-inhibit-startup t)
|
||||||
(visiting (find-buffer-visiting file))
|
(visiting (find-buffer-visiting file))
|
||||||
(file-buf (or visiting (find-file-noselect file nil)))
|
(file-buf (or visiting (find-file-noselect file nil)))
|
||||||
(date (plist-get
|
(date (plist-get
|
||||||
(with-current-buffer file-buf
|
(with-current-buffer file-buf
|
||||||
(org-mode)
|
(org-mode)
|
||||||
(org-export--get-inbuffer-options))
|
(org-export-get-environment))
|
||||||
:date)))
|
:date)))
|
||||||
(unless visiting (kill-buffer file-buf))
|
(unless visiting (kill-buffer file-buf))
|
||||||
(if date (org-time-string-to-time date)
|
;; DATE is either a timestamp object or a secondary string. If it
|
||||||
(when (file-exists-p file)
|
;; is a timestamp or if the secondary string contains a timestamp,
|
||||||
(nth 5 (file-attributes file))))))
|
;; convert it to internal format. Otherwise, use FILE
|
||||||
|
;; modification time.
|
||||||
|
(cond ((eq (org-element-type date) 'timestamp)
|
||||||
|
(org-time-string-to-time (org-element-interpret-data date)))
|
||||||
|
((let ((ts (and (consp date) (assq 'timestamp date))))
|
||||||
|
(and ts (org-string-nw-p (org-element-interpret-data ts)))))
|
||||||
|
((file-exists-p file) (nth 5 (file-attributes file)))
|
||||||
|
(t (error "No such file: \"%s\"" file)))))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue