emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* modify postamble in html export
@ 2013-09-19 12:19 pw
  2013-09-19 14:49 ` Eric Abrahamsen
  0 siblings, 1 reply; 7+ messages in thread
From: pw @ 2013-09-19 12:19 UTC (permalink / raw)
  To: emacs-orgmode

Hi,

I want to have a postamble in html with just the date (and without hours).

I already delete other informations in the postamble with these 
variables into my .emacs :
  '(org-export-author-info nil)
  '(org-export-creator-info nil)
  '(org-html-validation-link nil)

Now I have only the date left in the postamble but I want to change the 
format.

The default is : "Created: 2013-09-19 jeu. 14:09" and I want "Last 
update : 19 sept. 2013"

To do this I tried to set this variable :
  '(org-export-date-timestamp-format "%d %h %y")

But it is not working (and I have no idea how to put the "Last update :").

Could you indicate me how to achieve this. An issue is also I don't want 
to put this date format in all org-mode (I want to keep the default 
format for task and other stuff).

bye
pw

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: modify postamble in html export
  2013-09-19 12:19 pw
@ 2013-09-19 14:49 ` Eric Abrahamsen
  0 siblings, 0 replies; 7+ messages in thread
From: Eric Abrahamsen @ 2013-09-19 14:49 UTC (permalink / raw)
  To: emacs-orgmode

pw <pw@riseup.net> writes:

> Hi,
>
> I want to have a postamble in html with just the date (and without hours).
>
> I already delete other informations in the postamble with these
> variables into my .emacs :
>  '(org-export-author-info nil)
>  '(org-export-creator-info nil)
>  '(org-html-validation-link nil)
>
> Now I have only the date left in the postamble but I want to change
> the format.
>
> The default is : "Created: 2013-09-19 jeu. 14:09" and I want "Last
> update : 19 sept. 2013"
>
> To do this I tried to set this variable :
>  '(org-export-date-timestamp-format "%d %h %y")
>
> But it is not working (and I have no idea how to put the "Last update :").
>
> Could you indicate me how to achieve this. An issue is also I don't
> want to put this date format in all org-mode (I want to keep the
> default format for task and other stuff).

You can override the whole thing by re-defining the `org-html-postable'
variable. Set it to a function which returns the string you want:

(defun my-org-html-postamble ()
  (format "Last update : %s" (format-time-string "%d %b %Y")))

(setq org-html-postamble 'my-org-html-postamble)

I didn't test that, but something like that ought to work.

HTH,
Eric

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: modify postamble in html export
@ 2013-09-20 13:17 pw
  2013-09-20 15:25 ` Nicolas Goaziou
  2013-09-21  4:23 ` Eric Abrahamsen
  0 siblings, 2 replies; 7+ messages in thread
From: pw @ 2013-09-20 13:17 UTC (permalink / raw)
  To: eric; +Cc: emacs-orgmode

> You can override the whole thing by re-defining the `org-html-postable'
> variable. Set it to a function which returns the string you want:
>
> (defun my-org-html-postamble ()
>   (format "Last update : %s" (format-time-string "%d %b %Y")))
>
> (setq org-html-postamble 'my-org-html-postamble)
>
> I didn't test that, but something like that ought to work.

Thanks!

I tried to paste your code into my .emacs and I received the following 
error when publishing :

"org-html--build-pre/postamble: Wrong number of arguments: (lambda nil 
(format "Last update : %s" (format-time-string "%d %b %Y"))), 1"

I don't know where is the problem. I tried then to do the same by 
modifying the variable "Org Export HTML Postamble Format". The default 
format is :

'(("en" "<p class=\"author\">Author: %a (%e)</p>\n<p 
class=\"date\">Date: %d</p>\n<p class=\"creator\">%c</p>\n<p 
class=\"xhtml-validation\">%v</p>"))

So I changed it to (with the idea to change the string format (%s) later 
if working) :

'(("en"<p class=\"date\">Last update: %s</p>"))

(which add to my .emacs :  '(org-html-postamble-format (quote (("en" "<p 
class=\"date\">Last update: %s</p>"))))

But it does not change at all the postamble ""Created: 2013-09-19 jeu. 
14:09"".

So I'm stuck!
pw

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: modify postamble in html export
  2013-09-20 13:17 modify postamble in html export pw
@ 2013-09-20 15:25 ` Nicolas Goaziou
  2013-09-21  4:23 ` Eric Abrahamsen
  1 sibling, 0 replies; 7+ messages in thread
From: Nicolas Goaziou @ 2013-09-20 15:25 UTC (permalink / raw)
  To: pw; +Cc: eric, emacs-orgmode

Hello,

pw <pw@riseup.net> writes:

>> You can override the whole thing by re-defining the `org-html-postable'
>> variable. Set it to a function which returns the string you want:
>>
>> (defun my-org-html-postamble ()
>>   (format "Last update : %s" (format-time-string "%d %b %Y")))
>>
>> (setq org-html-postamble 'my-org-html-postamble)
>>
>> I didn't test that, but something like that ought to work.
>
> Thanks!
>
> I tried to paste your code into my .emacs and I received the following
> error when publishing :
>
> "org-html--build-pre/postamble: Wrong number of arguments: (lambda nil
> (format "Last update : %s" (format-time-string "%d %b %Y"))), 1"
>
> I don't know where is the problem.

According to `org-html-postamble' docstring, the function has to accept
one argument.

> I tried then to do the same by modifying the variable "Org Export HTML
> Postamble Format". The default format is :
>
> '(("en" "<p class=\"author\">Author: %a (%e)</p>\n<p
> class=\"date\">Date: %d</p>\n<p class=\"creator\">%c</p>\n<p
> class=\"xhtml-validation\">%v</p>"))
>
> So I changed it to (with the idea to change the string format (%s)
> later if working) :
>
> '(("en"<p class=\"date\">Last update: %s</p>"))
>
> (which add to my .emacs :  '(org-html-postamble-format (quote (("en"
> "<p class=\"date\">Last update: %s</p>"))))
>
> But it does not change at all the postamble ""Created: 2013-09-19 jeu.
> 14:09"".
>
> So I'm stuck!

Again, according to `org-html-postamble' docstring, you need to set that
variable to t in order to use `org-html-postamble-format'. Then, by
looking at `org-html-postamble-format' docstring, you can see that only
%t, %a, %e, %d, %c, %v, %T and %C are allowed as format characters.

HTH,


Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: modify postamble in html export
  2013-09-20 13:17 modify postamble in html export pw
  2013-09-20 15:25 ` Nicolas Goaziou
@ 2013-09-21  4:23 ` Eric Abrahamsen
  2013-09-21  9:00   ` pw
  1 sibling, 1 reply; 7+ messages in thread
From: Eric Abrahamsen @ 2013-09-21  4:23 UTC (permalink / raw)
  To: emacs-orgmode

pw <pw@riseup.net> writes:

>> You can override the whole thing by re-defining the `org-html-postable'
>> variable. Set it to a function which returns the string you want:
>>
>> (defun my-org-html-postamble ()
>>   (format "Last update : %s" (format-time-string "%d %b %Y")))
>>
>> (setq org-html-postamble 'my-org-html-postamble)
>>
>> I didn't test that, but something like that ought to work.
>
> Thanks!
>
> I tried to paste your code into my .emacs and I received the following
> error when publishing :
>
> "org-html--build-pre/postamble: Wrong number of arguments: (lambda nil
> (format "Last update : %s" (format-time-string "%d %b %Y"))), 1"

Whoops, that's what I get for posting untested code... As Nicholas
points out the function should take an argument, but in your simplest
case you can ignore it:

(defun my-org-html-postamble (plist)
  (format "Last update : %s" (format-time-string "%d %b %Y")))

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: modify postamble in html export
  2013-09-21  4:23 ` Eric Abrahamsen
@ 2013-09-21  9:00   ` pw
  2013-09-21  9:25     ` Eric Abrahamsen
  0 siblings, 1 reply; 7+ messages in thread
From: pw @ 2013-09-21  9:00 UTC (permalink / raw)
  To: Eric Abrahamsen; +Cc: emacs-orgmode

Le 21/09/2013 06:23, Eric Abrahamsen a écrit :
> Whoops, that's what I get for posting untested code... As Nicholas
> points out the function should take an argument, but in your simplest
> case you can ignore it:
>
> (defun my-org-html-postamble (plist)
>    (format "Last update : %s" (format-time-string "%d %b %Y")))

Thanks.

I tried this new code (by pasting it into .emacs). But I have the 
default postamble in the result.

I tried then to achieve the same but by using org-customization which 
put into .emacs this :

'(org-html-postamble t)
'(org-html-postamble-format (quote (("en" "Last update : %d"))))

If it was working I would try to modify %d to have a %d %b %Y format. 
But  for now I have only "Last update : " without time...

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: modify postamble in html export
  2013-09-21  9:00   ` pw
@ 2013-09-21  9:25     ` Eric Abrahamsen
  0 siblings, 0 replies; 7+ messages in thread
From: Eric Abrahamsen @ 2013-09-21  9:25 UTC (permalink / raw)
  To: pw; +Cc: emacs-orgmode


On 09/21/13 17:00 PM, pw wrote:
> Le 21/09/2013 06:23, Eric Abrahamsen a écrit :
>> Whoops, that's what I get for posting untested code... As Nicholas
>> points out the function should take an argument, but in your simplest
>> case you can ignore it:
>>
>> (defun my-org-html-postamble (plist)
>>    (format "Last update : %s" (format-time-string "%d %b %Y")))
>
> Thanks.
>
> I tried this new code (by pasting it into .emacs). But I have the
> default postamble in the result.
>
> I tried then to achieve the same but by using org-customization which
> put into .emacs this :
>
> '(org-html-postamble t)
> '(org-html-postamble-format (quote (("en" "Last update : %d"))))
>
> If it was working I would try to modify %d to have a %d %b %Y format.
> But  for now I have only "Last update : " without time...

I finally actually tried this myself... I'm guessing that your problems
are coming from pasting things without actually eval'ing them. I put
this in scratch:

(defun my-org-html-postamble (plist)
  (format "Last update : %s" (format-time-string "%d %b %Y")))
(setq org-html-postamble 'my-org-html-postamble)

And hit "C-x C-e" after both statements, and a test document exported
with the proper postamble:

<div id="postamble" class="status">
Last update : 21 Sep 2013
</div>

Can you make sure you've evaluated the forms?

I would have thought your org-customizations above would work, but
there are multiple ways to solve this problem, and perhaps you've got
competing solutions. Try reloading org, or worst case restarting emacs?

Eric

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2013-09-21  9:25 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-20 13:17 modify postamble in html export pw
2013-09-20 15:25 ` Nicolas Goaziou
2013-09-21  4:23 ` Eric Abrahamsen
2013-09-21  9:00   ` pw
2013-09-21  9:25     ` Eric Abrahamsen
  -- strict thread matches above, loose matches on Subject: below --
2013-09-19 12:19 pw
2013-09-19 14:49 ` Eric Abrahamsen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).