From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Robert H. Klein" Subject: Re: Conditionally formatting org-html-postamble-format Date: Wed, 27 Jan 2016 19:26:00 +0100 Message-ID: <20160127192600.08cdad14@lt70.mpip-mainz.mpg.de> References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:58574) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aOUnB-0003dS-Vw for emacs-orgmode@gnu.org; Wed, 27 Jan 2016 13:26:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aOUn7-0000hd-0N for emacs-orgmode@gnu.org; Wed, 27 Jan 2016 13:26:09 -0500 Received: from mout.kundenserver.de ([217.72.192.74]:49390) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aOUn6-0000eh-Nz for emacs-orgmode@gnu.org; Wed, 27 Jan 2016 13:26:04 -0500 In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Kaushal Modi Cc: emacs-org list Hi, Kaushal Modi wrote: > Hi, >=20 > I have the org-html-postamble-format set to the below: >=20 > (setq org-html-postamble-format > `(("en" > ,(concat "Exported using " > ;; "%c" is replaced with > `org-html-creator-string' > ;; Emacs (Org mode ) > "
class=3D\"creator\">" =20 > "%c
" > "by %a. =E2=80=94 " > "
class=3D\"date\">" =20 > "%d
")))) >=20 >=20 > It works great except for the cases where I have set a document > author to nothing using >=20 > #+AUTHOR: >=20 > 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 "". >=20 > Right now, if the author is nil, the postamble gets exported as: >=20 > Exported using > Emacs 25.0.50.1 (Org > mode 8.3.3) > by . =E2=80=94 > 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