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 20:55:36 +0100 Message-ID: <20160127205536.5fb468ca@lt70.mpip-mainz.mpg.de> References: <20160127192600.08cdad14@lt70.mpip-mainz.mpg.de> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:55472) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aOWBs-000280-AU for emacs-orgmode@gnu.org; Wed, 27 Jan 2016 14:55:45 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aOWBn-0005p2-7F for emacs-orgmode@gnu.org; Wed, 27 Jan 2016 14:55:44 -0500 Received: from mout.kundenserver.de ([212.227.126.135]:57132) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aOWBm-0005ov-Tw for emacs-orgmode@gnu.org; Wed, 27 Jan 2016 14:55:39 -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, > Thanks for the reply. > > > how about using a postamble function instead of > > html-postamble-format > > Does it mean that I need to look into modifying the > org-html--build-pre/postamble function? > > If so, I will start looking into it but it will take a while as it > full of elisp that I have never used (until today maybe): > format-spec, plist-get and a lot of assoc's and assq's :) No, I have two functions, one for the preamble, one for the postamble, both returning a string. In the project alist I set :html-preamble and :html-postamble to those functions (beware of typos): ;; pre- and postamble for html export (defun linux-e-preamble (info) (with-temp-buffer (insert-file-contents "~/linuxdocs/html/preamble.html") (let ((title (car (plist-get info :title)))) (when title (if (stringp title) (let ((case-fold-search t)) ; case-insensitive (goto-char (point-min)) (while (search-forward "" nil t) (replace-match title)))))) (buffer-string))) (defun linux-e-postamble (info) (with-temp-buffer (insert-file-contents "~/linuxdocs/html/postamble.html") (buffer-string))) ;; add linux to org-publish-poject-alist (add-to-list 'org-publish-project-alist '("linux-e-html" :base-directory "~/linuxdocs" :base-extension "org" :publishing-directory "~/public_html/linuxdocs" :publishing-function org-html-publish-to-html :html-head "" :html-head-include-default-style nil :html-head-include-scripts nil :html-preamble linux-e-preamble :html-postamble linux-e-postamble )) Best regards Robert