emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] Conditionally formatting org-html-postamble-format


From: Robert H. Klein
Subject: Re: [O] Conditionally formatting org-html-postamble-format
Date: Wed, 27 Jan 2016 19:26:00 +0100

Hi,

Kaushal Modi <address@hidden> wrote:

> Hi,
> 
> I have the org-html-postamble-format set to the below:
> 
> (setq org-html-postamble-format
>                   `(("en"
>                      ,(concat "Exported using "
>                               ;; "%c" is replaced with
> `org-html-creator-string'
>                               ;; Emacs <VERSION> (Org mode <VERSION>)
>                               "<div style=\"display: inline\"
> class=\"creator\">"  
>                               "%c</div> "
>                               "by %a. — "
>                               "<div style=\"display: inline\"
> class=\"date\">"  
>                               "%d</div>"))))
> 
> 
> It works great except for the cases where I have set a document
> author to nothing using
> 
> #+AUTHOR:
> 
> What would be the best way to set the postamble so that the "by %a"
> portion does not get printed if the %a value is "".
> 
> Right now, if the author is nil, the postamble gets exported as:
> 
> Exported using
> Emacs <http://www.gnu.org/software/emacs/> 25.0.50.1 (Org
> <http://orgmode.org/> mode 8.3.3)
>  by . —
> Jan 26 2016, Tue


how about using a postamble function instead of
html-postamble-format, something like

(let ((author (car (plist-get info :author))))
  (when (not (equal author ""))
    "by " author ". "))
" - "

instead of "by %a. - "

and similar for the rest of the %-thingies.

Note, you'll probably have to inspect the plist, the (car ...) I'm
using in some project for getting the title.

Best regards
Robert



reply via email to

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