Function: org-publish-find-date

org-publish-find-date is a byte-compiled function defined in ox-publish.el.gz.

Signature

(org-publish-find-date FILE PROJECT)

Documentation

Find the date of FILE in PROJECT.

This function assumes FILE is either a directory or an Org file. If FILE is an Org file and provides a DATE keyword use it. In any other case use the file system's modification time. Return time in current-time format.

Source Code

;; Defined in /usr/src/emacs/lisp/org/ox-publish.el.gz
(defun org-publish-find-date (file project)
  "Find the date of FILE in PROJECT.
This function assumes FILE is either a directory or an Org file.
If FILE is an Org file and provides a DATE keyword use it.  In
any other case use the file system's modification time.  Return
time in `current-time' format."
  (let ((file (org-publish--expand-file-name file project)))
    (or (org-publish-cache-get-file-property file :date nil t)
	(org-publish-cache-set-file-property
	 file :date
	 (if (file-directory-p file)
	     (file-attribute-modification-time (file-attributes file))
	   (let ((date (org-publish-find-property file :date project)))
	     ;; DATE is a secondary string.  If it contains
	     ;; a time-stamp, convert it to internal format.
	     ;; Otherwise, use FILE modification time.
	     (cond ((let ((ts (and (consp date) (assq 'timestamp date))))
		      (and ts
			   (let ((value (org-element-interpret-data ts)))
			     (and (org-string-nw-p value)
				  (org-time-string-to-time value))))))
		   ((file-exists-p file)
		    (file-attribute-modification-time (file-attributes file)))
		   (t (error "No such file: \"%s\"" file)))))))))