|
@@ -405,11 +405,9 @@ definition."
|
|
|
(defun org-publish--expand-file-name (file project)
|
|
|
"Return full file name for FILE in PROJECT.
|
|
|
When FILE is a relative file name, it is expanded according to
|
|
|
-project base directory. Always return the true name of the file,
|
|
|
-ignoring symlinks."
|
|
|
- (file-truename
|
|
|
- (if (file-name-absolute-p file) file
|
|
|
- (expand-file-name file (org-publish-property :base-directory project)))))
|
|
|
+project base directory."
|
|
|
+ (if (file-name-absolute-p file) file
|
|
|
+ (expand-file-name file (org-publish-property :base-directory project))))
|
|
|
|
|
|
(defun org-publish-expand-projects (projects-alist)
|
|
|
"Expand projects in PROJECTS-ALIST.
|
|
@@ -436,10 +434,32 @@ This splices all the components into the list."
|
|
|
(match (if (eq extension 'any) ""
|
|
|
(format "^[^\\.].*\\.\\(%s\\)$" extension)))
|
|
|
(base-files
|
|
|
- (cl-remove-if #'file-directory-p
|
|
|
- (if (org-publish-property :recursive project)
|
|
|
- (directory-files-recursively base-dir match)
|
|
|
- (directory-files base-dir t match t)))))
|
|
|
+ (cond ((not (file-exists-p base-dir)) nil)
|
|
|
+ ((not (org-publish-property :recursive project))
|
|
|
+ (cl-remove-if #'file-directory-p
|
|
|
+ (directory-files base-dir t match t)))
|
|
|
+ (t
|
|
|
+ ;; Find all files recursively. Unlike to
|
|
|
+ ;; `directory-files-recursively', we follow symlinks
|
|
|
+ ;; to other directories.
|
|
|
+ (letrec ((files nil)
|
|
|
+ (walk-tree
|
|
|
+ (lambda (dir depth)
|
|
|
+ (when (> depth 100)
|
|
|
+ (error "Apparent cycle of symbolic links for %S"
|
|
|
+ base-dir))
|
|
|
+ (dolist (f (file-name-all-completions "" dir))
|
|
|
+ (pcase f
|
|
|
+ ((or "./" "../") nil)
|
|
|
+ ((pred directory-name-p)
|
|
|
+ (funcall walk-tree
|
|
|
+ (expand-file-name f dir)
|
|
|
+ (1+ depth)))
|
|
|
+ ((pred (string-match match))
|
|
|
+ (push (expand-file-name f dir) files))
|
|
|
+ (_ nil)))
|
|
|
+ files)))
|
|
|
+ (funcall walk-tree base-dir 0))))))
|
|
|
(org-uniquify
|
|
|
(append
|
|
|
;; Files from BASE-DIR. Apply exclusion filter before adding
|
|
@@ -468,13 +488,13 @@ This splices all the components into the list."
|
|
|
"Return a project that FILENAME belongs to.
|
|
|
When UP is non-nil, return a meta-project (i.e., with a :components part)
|
|
|
publishing FILENAME."
|
|
|
- (let* ((filename (file-truename filename))
|
|
|
+ (let* ((filename (expand-file-name filename))
|
|
|
(project
|
|
|
(cl-some
|
|
|
(lambda (p)
|
|
|
;; Ignore meta-projects.
|
|
|
(unless (org-publish-property :components p)
|
|
|
- (let ((base (file-truename
|
|
|
+ (let ((base (expand-file-name
|
|
|
(org-publish-property :base-directory p))))
|
|
|
(cond
|
|
|
;; Check if FILENAME is explicitly included in one
|
|
@@ -499,9 +519,7 @@ publishing FILENAME."
|
|
|
;; Check if FILENAME belong to project's base
|
|
|
;; directory, or some of its sub-directories
|
|
|
;; if :recursive in non-nil.
|
|
|
- ((org-publish-property :recursive p)
|
|
|
- (and (file-in-directory-p filename base) p))
|
|
|
- ((file-equal-p base (file-name-directory filename)) p)
|
|
|
+ ((member filename (org-publish-get-base-files p)) p)
|
|
|
(t nil)))))
|
|
|
org-publish-project-alist)))
|
|
|
(cond
|
|
@@ -557,7 +575,7 @@ Return output file name."
|
|
|
`(:crossrefs
|
|
|
,(org-publish-cache-get-file-property
|
|
|
;; Normalize file names in cache.
|
|
|
- (file-truename filename) :crossrefs nil t)
|
|
|
+ (expand-file-name filename) :crossrefs nil t)
|
|
|
:filter-final-output
|
|
|
(org-publish--store-crossrefs
|
|
|
org-publish-collect-index
|
|
@@ -1009,7 +1027,7 @@ PARENT is a reference to the headline, if any, containing the
|
|
|
original index keyword. When non-nil, this reference is a cons
|
|
|
cell. Its CAR is a symbol among `id', `custom-id' and `name' and
|
|
|
its CDR is a string."
|
|
|
- (let ((file (file-truename (plist-get info :input-file))))
|
|
|
+ (let ((file (expand-file-name (plist-get info :input-file))))
|
|
|
(org-publish-cache-set-file-property
|
|
|
file :index
|
|
|
(delete-dups
|
|
@@ -1118,7 +1136,7 @@ a plist.
|
|
|
This function is meant to be used as a final output filter. See
|
|
|
`org-publish-org-to'."
|
|
|
(org-publish-cache-set-file-property
|
|
|
- (file-truename (plist-get info :input-file))
|
|
|
+ (expand-file-name (plist-get info :input-file))
|
|
|
:crossrefs
|
|
|
;; Update `:crossrefs' so as to remove unused references and search
|
|
|
;; cells. Actually used references are extracted from
|
|
@@ -1163,7 +1181,7 @@ references with `org-export-get-reference'."
|
|
|
file)
|
|
|
"MissingReference"))
|
|
|
(t
|
|
|
- (let* ((filename (file-truename file))
|
|
|
+ (let* ((filename (expand-file-name file))
|
|
|
(crossrefs
|
|
|
(org-publish-cache-get-file-property filename :crossrefs nil t))
|
|
|
(cells
|