ox-publish: Fix prefix for some variables

* lisp/ox-publish.el (org-publish-sitemap-sort-files,
  org-publish-sitemap-sort-folders, org-publish-sitemap-ignore-case,
  org-publish-sitemap-requested, org-publish-sitemap-date-format,
  org-publish-sitemap-file-entry-format): Set prefix to
  "org-publish-sitemap" instead of "org-sitemap".
(org-publish-compare-directory-files, org-publish-get-base-files-1,
org-publish-projects, org-publish-format-file-entry): Use new prefix.
This commit is contained in:
Nicolas Goaziou 2013-08-08 16:21:53 +02:00
parent ab8bfb8460
commit 74750b0839
1 changed files with 33 additions and 31 deletions

View File

@ -383,19 +383,19 @@ This splices all the components into the list."
(push p rtn)))
(nreverse (delete-dups (delq nil rtn)))))
(defvar org-sitemap-sort-files)
(defvar org-sitemap-sort-folders)
(defvar org-sitemap-ignore-case)
(defvar org-sitemap-requested)
(defvar org-sitemap-date-format)
(defvar org-sitemap-file-entry-format)
(defvar org-publish-sitemap-sort-files)
(defvar org-publish-sitemap-sort-folders)
(defvar org-publish-sitemap-ignore-case)
(defvar org-publish-sitemap-requested)
(defvar org-publish-sitemap-date-format)
(defvar org-publish-sitemap-file-entry-format)
(defun org-publish-compare-directory-files (a b)
"Predicate for `sort', that sorts folders and files for sitemap."
(let ((retval t))
(when (or org-sitemap-sort-files org-sitemap-sort-folders)
(when (or org-publish-sitemap-sort-files org-publish-sitemap-sort-folders)
;; First we sort files:
(when org-sitemap-sort-files
(case org-sitemap-sort-files
(when org-publish-sitemap-sort-files
(case org-publish-sitemap-sort-files
(alphabetically
(let* ((adir (file-directory-p a))
(aorg (and (string-match "\\.org$" a) (not adir)))
@ -405,7 +405,7 @@ This splices all the components into the list."
(org-publish-find-title a)) a))
(B (if borg (concat (file-name-directory b)
(org-publish-find-title b)) b)))
(setq retval (if org-sitemap-ignore-case
(setq retval (if org-publish-sitemap-ignore-case
(not (string-lessp (upcase B) (upcase A)))
(not (string-lessp B A))))))
((anti-chronologically chronologically)
@ -414,17 +414,17 @@ This splices all the components into the list."
(A (+ (lsh (car adate) 16) (cadr adate)))
(B (+ (lsh (car bdate) 16) (cadr bdate))))
(setq retval
(if (eq org-sitemap-sort-files 'chronologically) (<= A B)
(if (eq org-publish-sitemap-sort-files 'chronologically) (<= A B)
(>= A B)))))))
;; Directory-wise wins:
(when org-sitemap-sort-folders
(when org-publish-sitemap-sort-folders
;; a is directory, b not:
(cond
((and (file-directory-p a) (not (file-directory-p b)))
(setq retval (equal org-sitemap-sort-folders 'first)))
(setq retval (equal org-publish-sitemap-sort-folders 'first)))
;; a is not a directory, but b is:
((and (not (file-directory-p a)) (file-directory-p b))
(setq retval (equal org-sitemap-sort-folders 'last))))))
(setq retval (equal org-publish-sitemap-sort-folders 'last))))))
retval))
(defun org-publish-get-base-files-1
@ -457,7 +457,7 @@ matching the regexp SKIP-DIR when recursing through BASE-DIR."
(or (file-directory-p file)
(and match (string-match match file))))
(directory-files base-dir t)))))
(if (not org-sitemap-requested) all-files
(if (not org-publish-sitemap-requested) all-files
(sort all-files 'org-publish-compare-directory-files)))))
(defun org-publish-get-base-files (project &optional exclude-regexp)
@ -472,15 +472,15 @@ matching filenames."
(extension (or (plist-get project-plist :base-extension) "org"))
;; sitemap-... variables are dynamically scoped for
;; org-publish-compare-directory-files:
(org-sitemap-requested
(org-publish-sitemap-requested
(plist-get project-plist :auto-sitemap))
(sitemap-filename
(or (plist-get project-plist :sitemap-filename) "sitemap.org"))
(org-sitemap-sort-folders
(org-publish-sitemap-sort-folders
(if (plist-member project-plist :sitemap-sort-folders)
(plist-get project-plist :sitemap-sort-folders)
org-publish-sitemap-sort-folders))
(org-sitemap-sort-files
(org-publish-sitemap-sort-files
(cond ((plist-member project-plist :sitemap-sort-files)
(plist-get project-plist :sitemap-sort-files))
;; For backward compatibility:
@ -488,18 +488,19 @@ matching filenames."
(if (plist-get project-plist :sitemap-alphabetically)
'alphabetically nil))
(t org-publish-sitemap-sort-files)))
(org-sitemap-ignore-case
(org-publish-sitemap-ignore-case
(if (plist-member project-plist :sitemap-ignore-case)
(plist-get project-plist :sitemap-ignore-case)
org-publish-sitemap-sort-ignore-case))
(match (if (eq extension 'any) "^[^\\.]"
(concat "^[^\\.].*\\.\\(" extension "\\)$"))))
;; Make sure `org-sitemap-sort-folders' has an accepted value
(unless (memq org-sitemap-sort-folders '(first last))
(setq org-sitemap-sort-folders nil))
;; Make sure `org-publish-sitemap-sort-folders' has an accepted
;; value.
(unless (memq org-publish-sitemap-sort-folders '(first last))
(setq org-publish-sitemap-sort-folders nil))
(setq org-publish-temp-files nil)
(if org-sitemap-requested
(if org-publish-sitemap-requested
(pushnew (expand-file-name (concat base-dir sitemap-filename))
org-publish-temp-files))
(org-publish-get-base-files-1 base-dir recurse match
@ -678,10 +679,10 @@ If `:auto-sitemap' is set, publish the sitemap too. If
"sitemap.org"))
(sitemap-function (or (plist-get project-plist :sitemap-function)
'org-publish-org-sitemap))
(org-sitemap-date-format
(org-publish-sitemap-date-format
(or (plist-get project-plist :sitemap-date-format)
org-publish-sitemap-date-format))
(org-sitemap-file-entry-format
(org-publish-sitemap-file-entry-format
(or (plist-get project-plist :sitemap-file-entry-format)
org-publish-sitemap-file-entry-format))
(preparation-function
@ -775,7 +776,7 @@ Default for SITEMAP-FILENAME is 'sitemap.org'."
;; This is common to 'flat and 'tree
(let ((entry
(org-publish-format-file-entry
org-sitemap-file-entry-format file project-plist))
org-publish-sitemap-file-entry-format file project-plist))
(regexp "\\(.*\\)\\[\\([^][]+\\)\\]\\(.*\\)"))
(cond ((string-match-p regexp entry)
(string-match regexp entry)
@ -791,11 +792,12 @@ Default for SITEMAP-FILENAME is 'sitemap.org'."
(or visiting (kill-buffer sitemap-buffer))))
(defun org-publish-format-file-entry (fmt file project-plist)
(format-spec fmt
`((?t . ,(org-publish-find-title file t))
(?d . ,(format-time-string org-sitemap-date-format
(org-publish-find-date file)))
(?a . ,(or (plist-get project-plist :author) user-full-name)))))
(format-spec
fmt
`((?t . ,(org-publish-find-title file t))
(?d . ,(format-time-string org-publish-sitemap-date-format
(org-publish-find-date file)))
(?a . ,(or (plist-get project-plist :author) user-full-name)))))
(defun org-publish-find-title (file &optional reset)
"Find the title of FILE in project."