浏览代码

Better sitemap formating

Hi,

Here's a patch that make the sitemap entry formating coherent with the
new html-pre/postamble one.

While here I was trying to add some documentation about this feature in
org.texi but I end up copy/pasting or paraphrasing the docstring of
correspondant customs. Is it acceptable for the documentation or plain
useless?

>From 766b0db7d0189d2edb0d8799c3424d62f9ac4e47 Mon Sep 17 00:00:00 2001
From: Manuel Giraud <manuel.giraud@univ-nantes.fr>
Date: Fri, 11 Feb 2011 15:32:58 +0100
Subject: [PATCH] org-publish.el: sitemap formating coherent with new preamble

Adopt downcase for format directive to be coherent with the new
pre/postamble formating.

Use `format-spec' function instead of `org-replace-escapes'.
Manuel Giraud 15 年之前
父节点
当前提交
dbb46ae6b1
共有 1 个文件被更改,包括 10 次插入11 次删除
  1. 10 11
      lisp/org-publish.el

+ 10 - 11
lisp/org-publish.el

@@ -55,6 +55,7 @@
   (require 'cl))
   (require 'cl))
 (require 'org)
 (require 'org)
 (require 'org-exp)
 (require 'org-exp)
+(require 'format-spec)
 
 
 (eval-and-compile
 (eval-and-compile
   (unless (fboundp 'declare-function)
   (unless (fboundp 'declare-function)
@@ -271,13 +272,13 @@ in the sitemap."
   :group 'org-publish
   :group 'org-publish
   :type 'string)
   :type 'string)
 
 
-(defcustom org-publish-sitemap-file-entry-format "%T"
+(defcustom org-publish-sitemap-file-entry-format "%t"
   "How a sitemap file entry is formated.
   "How a sitemap file entry is formated.
 You could use brackets to delimit on what part the link will be.
 You could use brackets to delimit on what part the link will be.
 
 
-%T is the title.
-%A is the author.
-%D is the date formated using `org-publish-sitemap-date-format'."
+%t is the title.
+%a is the author.
+%d is the date formated using `org-publish-sitemap-date-format'."
   :group 'org-publish
   :group 'org-publish
   :type 'string)
   :type 'string)
 
 
@@ -816,13 +817,11 @@ Default for SITEMAP-FILENAME is 'sitemap.org'."
     (or visiting (kill-buffer sitemap-buffer))))
     (or visiting (kill-buffer sitemap-buffer))))
 
 
 (defun org-publish-format-file-entry (fmt file project-plist)
 (defun org-publish-format-file-entry (fmt file project-plist)
-  (org-replace-escapes fmt
-		       (list (cons "%T" (org-publish-find-title file))
-			     (cons "%D" (format-time-string 
-					 sitemap-date-format 
-					 (org-publish-find-date file)))
-			     (cons "%A" (or (plist-get project-plist :author)
-					    user-full-name)))))
+  (format-spec fmt
+	     `((?t . ,(org-publish-find-title file))
+	       (?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)
   "Find the title of FILE in project."
   "Find the title of FILE in project."