Browse Source

Fix bug: fetch the updated title of a page when creating the sitemap.

* org-publish.el (org-publish-cache-ctime-of-src): improve
docstring.
(org-publish-find-title): New option to explicitly reset the
title in the cache.
(org-publish-format-file-entry): Use this new option.

Thanks to Jonathan Bisson for reporting this.
Bastien Guerry 14 years ago
parent
commit
4b8d74150f
1 changed files with 4 additions and 6 deletions
  1. 4 6
      lisp/org-publish.el

+ 4 - 6
lisp/org-publish.el

@@ -818,15 +818,15 @@ Default for SITEMAP-FILENAME is 'sitemap.org'."
 
 (defun org-publish-format-file-entry (fmt file project-plist)
   (format-spec fmt
-	     `((?t . ,(org-publish-find-title file))
+	     `((?t . ,(org-publish-find-title file t))
 	       (?d . ,(format-time-string sitemap-date-format 
 					  (org-publish-find-date file)))
 	       (?a . ,(or (plist-get project-plist :author) user-full-name)))))
 			    
-(defun org-publish-find-title (file)
+(defun org-publish-find-title (file &optional reset)
   "Find the title of FILE in project."
   (or
-   (org-publish-cache-get-file-property file :title nil t)
+   (and (not reset) (org-publish-cache-get-file-property file :title nil t))
    (let* ((visiting (find-buffer-visiting file))
 	 (buffer (or visiting (find-file-noselect file)))
 	 title)
@@ -1149,7 +1149,7 @@ Returns value on success, else nil."
   (puthash key value org-publish-cache))
 
 (defun org-publish-cache-ctime-of-src (filename)
-  "Get the files ctime as integer."
+  "Get the FILENAME ctime as an integer."
   (let ((src-attr (file-attributes (if (stringp (file-symlink-p filename))
 				       (file-symlink-p filename)
 				     filename))))
@@ -1157,8 +1157,6 @@ Returns value on success, else nil."
      (lsh (car (nth 5 src-attr)) 16)
      (cadr (nth 5 src-attr)))))
 
-
-
 (provide 'org-publish)
 
 ;; arch-tag: 72807f3c-8af0-4a6b-8dca-c3376eb25adb