Function: org-publish--sitemap-files-to-lisp

org-publish--sitemap-files-to-lisp is a byte-compiled function defined in ox-publish.el.gz.

Signature

(org-publish--sitemap-files-to-lisp FILES PROJECT STYLE FORMAT-ENTRY)

Documentation

Represent FILES as a parsed plain list.

FILES is the list of files in the site map. PROJECT is the current project. STYLE determines is either list or tree. FORMAT-ENTRY is a function called on each file which should return a string. Return value is a list as returned by org-list-to-lisp.

Source Code

;; Defined in /usr/src/emacs/lisp/org/ox-publish.el.gz
;;; Site map generation

(defun org-publish--sitemap-files-to-lisp (files project style format-entry)
  "Represent FILES as a parsed plain list.
FILES is the list of files in the site map.  PROJECT is the
current project.  STYLE determines is either `list' or `tree'.
FORMAT-ENTRY is a function called on each file which should
return a string.  Return value is a list as returned by
`org-list-to-lisp'."
  (let ((root (expand-file-name
	       (file-name-as-directory
		(org-publish-property :base-directory project)))))
    (pcase style
      (`list
       (cons 'unordered
	     (mapcar
	      (lambda (f)
		(list (funcall format-entry
			       (file-relative-name f root)
			       style
			       project)))
	      files)))
      (`tree
       (letrec ((files-only (cl-remove-if #'directory-name-p files))
		(directories (cl-remove-if-not #'directory-name-p files))
		(subtree-to-list
		 (lambda (dir)
		   (cons 'unordered
			 (nconc
			  ;; Files in DIR.
			  (mapcar
			   (lambda (f)
			     (list (funcall format-entry
					    (file-relative-name f root)
					    style
					    project)))
			   (cl-remove-if-not
			    (lambda (f) (string= dir (file-name-directory f)))
			    files-only))
			  ;; Direct sub-directories.
			  (mapcar
			   (lambda (sub)
			     (list (funcall format-entry
					    (file-relative-name sub root)
					    style
					    project)
				   (funcall subtree-to-list sub)))
			   (cl-remove-if-not
			    (lambda (f)
			      (string=
			       dir
			       ;; Parent directory.
			       (file-name-directory (directory-file-name f))))
			    directories)))))))
	 (funcall subtree-to-list root)))
      (_ (user-error "Unknown site-map style: `%s'" style)))))