emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Robert H. Klein" <roklein@roklein.de>
To: Kaushal Modi <kaushal.modi@gmail.com>
Cc: emacs-org list <emacs-orgmode@gnu.org>
Subject: Re: Conditionally formatting org-html-postamble-format
Date: Wed, 27 Jan 2016 19:26:00 +0100	[thread overview]
Message-ID: <20160127192600.08cdad14@lt70.mpip-mainz.mpg.de> (raw)
In-Reply-To: <CAFyQvY3Pxvz_wCOa4T8Ho7CfSqksW6tzPWoe=F_8O78DtYVEpA@mail.gmail.com>

Hi,

Kaushal Modi <kaushal.modi@gmail.com> 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	other threads:[~2016-01-27 18:26 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-26 21:46 Conditionally formatting org-html-postamble-format Kaushal Modi
2016-01-27 18:26 ` Robert H. Klein [this message]
2016-01-27 18:35   ` Kaushal Modi
2016-01-27 19:51     ` Nick Dokos
2016-01-27 19:55     ` Robert H. Klein
2016-01-28  4:36       ` Kaushal Modi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160127192600.08cdad14@lt70.mpip-mainz.mpg.de \
    --to=roklein@roklein.de \
    --cc=emacs-orgmode@gnu.org \
    --cc=kaushal.modi@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).