emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Some %elements in org-html-postamble-format became too "generous


From: Nicolas Goaziou
Subject: Re: [O] Some %elements in org-html-postamble-format became too "generous"
Date: Sun, 07 Apr 2013 21:00:27 +0200

Hello,

Rick Frankel <address@hidden> writes:

> On Sun, Apr 07, 2013 at 08:32:34PM +0200, Nicolas Goaziou wrote:
>> Dieter Wilhelm <address@hidden> writes:
>> > Or just using a default time string format which is language
>> > independent, like %Y-%m-%d.
>> 
>> There's `org-html--timestamp-format', which is used for all timestamps
>> in preamble, postamble and metadata. It's clearly an internal variable.
>> I don't know if it is used because the format is required or because it
>> saves copying over the same format string.
>> 
>> Since I don't know the intent behind this, I can't tell if it could be
>> made a defcustom.
>
> It was created just localize the definition. I see no reason not to
> make it a defcustom.

Then what about this patch?


Regards,

-- 
Nicolas Goaziou
>From 91283eedf89bd8b74b68f127737478a7a9b4d670 Mon Sep 17 00:00:00 2001
From: Nicolas Goaziou <address@hidden>
Date: Sun, 7 Apr 2013 20:59:26 +0200
Subject: [PATCH] ox-html: Add defcustom for timestamps in metadata

* lisp/ox-html.el (org-html-metadata-timestamp-format): New variable,
  renamed from `org-html--timestamp-format'.
(org-html--build-meta-info, org-html-format-spec,
org-html--build-pre/postamble): Use new variable.
---
 lisp/ox-html.el | 23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/lisp/ox-html.el b/lisp/ox-html.el
index d09cc0f..3fe97dd 100644
--- a/lisp/ox-html.el
+++ b/lisp/ox-html.el
@@ -136,10 +136,6 @@
 (defvar org-html-format-table-no-css)
 (defvar htmlize-buffer-places)  ; from htmlize.el
 
-(defvar org-html--timestamp-format "%Y-%m-%d %a %H:%M"
-  "FORMAT used by `format-time-string' for timestamps in
-preamble, postamble and metadata.")
-
 (defvar org-html--pre/postamble-class "status"
   "CSS class used for pre/postamble")
 
@@ -912,6 +908,14 @@ org-info.js for your website."
               (list :tag "Postamble" (const :format "" postamble)
                     (string :tag "     id") (string :tag "element"))))
 
+(defcustom org-html-metadata-timestamp-format "%Y-%m-%d %a %H:%M"
+  "Format used for timestamps in preamble, postamble and metadata.
+See `format-time-string' for more information on its components."
+  :group 'org-export-html
+  :version "24.4"
+  :package-version '(Org . "8.0")
+  :type 'string)
+
 ;;;; Template :: Mathjax
 
 (defcustom org-html-mathjax-options
@@ -1432,7 +1436,7 @@ INFO is a plist used as a communication channel."
      (format
       (when :time-stamp-file
        (format-time-string
-        (concat "<!-- " org-html--timestamp-format " -->\n"))))
+        (concat "<!-- " org-html-metadata-timestamp-format " -->\n"))))
      (format
       "<meta http-equiv=\"Content-Type\" content=\"text/html;charset=%s\"/>\n"
       (or (and org-html-coding-system
@@ -1500,7 +1504,7 @@ INFO is a plist used as a communication channel."
 used in the preamble or postamble."
   `((?t . ,(org-export-data (plist-get info :title) info))
     (?d . ,(org-export-data (org-export-get-date info) info))
-    (?T . ,(format-time-string org-html--timestamp-format))
+    (?T . ,(format-time-string org-html-metadata-timestamp-format))
     (?a . ,(org-export-data (plist-get info :author) info))
     (?e . ,(mapconcat
            (lambda (e)
@@ -1509,7 +1513,7 @@ used in the preamble or postamble."
            ", "))
     (?c . ,(plist-get info :creator))
     (?C . ,(let ((file (plist-get info :input-file)))
-            (format-time-string org-html--timestamp-format
+            (format-time-string org-html-metadata-timestamp-format
                                 (if file (nth 5 (file-attributes file))
                                   (current-time)))))
     (?v . ,(or org-html-validation-link ""))))
@@ -1552,10 +1556,9 @@ communication channel."
                      (format
                       "<p class=\"date\">%s: %s</p>\n"
                       (org-html--translate "Created" info)
-                      (format-time-string org-html--timestamp-format)))
+                      (format-time-string org-html-metadata-timestamp-format)))
                    (when (plist-get info :with-creator)
-                     (format "<p class=\"creator\">%s</p>\n"
-                             creator))
+                     (format "<p class=\"creator\">%s</p>\n" creator))
                    (format "<p class=\"xhtml-validation\">%s</p>\n"
                            validation-link))))
                (t (format-spec
-- 
1.8.2


reply via email to

[Prev in Thread] Current Thread [Next in Thread]