From mboxrd@z Thu Jan 1 00:00:00 1970 From: Vincent Beffara Subject: Re: Create preamble from an .org file ? Date: Wed, 28 Mar 2012 18:06:31 +0200 Message-ID: <4F733707.7000306@ens-lyon.fr> References: <87k4254wbm.fsf@altern.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Return-path: Received: from eggs.gnu.org ([208.118.235.92]:46866) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SCvOs-0006tN-31 for emacs-orgmode@gnu.org; Wed, 28 Mar 2012 12:07:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SCvOi-0008OS-7c for emacs-orgmode@gnu.org; Wed, 28 Mar 2012 12:07:05 -0400 Received: from plane.gmane.org ([80.91.229.3]:33688) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SCvOi-0008OG-0g for emacs-orgmode@gnu.org; Wed, 28 Mar 2012 12:06:56 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1SCvOf-0002P6-Jq for emacs-orgmode@gnu.org; Wed, 28 Mar 2012 18:06:53 +0200 Received: from cxr69-3-82-225-61-110.fbx.proxad.net ([82.225.61.110]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 28 Mar 2012 18:06:53 +0200 Received: from vbeffara by cxr69-3-82-225-61-110.fbx.proxad.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 28 Mar 2012 18:06:53 +0200 In-Reply-To: <87k4254wbm.fsf@altern.org> 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: emacs-orgmode@gnu.org Hi, >> How do I do that? Maybe a dedicated .org file for the navigation bar is >> not the right way to do, is there a better one? > > Since you only need to export your preamble in HTML once, I'd rather use > `org-export-html-preamble' and set it to the HTML string you want. Thanks for the tip. In terms of time spent to build a web page, that would have been the wise thing to do. However, I wanted something more modular, say being able to add a few pages without having to tweak the variable each time, and so on. So in the mean time I cobbled something together, which works for me and feels a bit more flexible if I want to modify the navigation bar in the page: (defun my-org-publish-org-to-html (plist filename pubdir) (org-pop-to-buffer-same-window (find-file "~/Boulot/org/web/preamble.org")) (let* ((preamble (org-export-as-html 3 nil nil 'string t)) (plist (plist-put plist :html-preamble preamble))) (org-publish-org-to-html plist filename pubdir))) (Everything is hard-coded, it should use the :base-directory and test whether :html-preamble is equal to 'file or something, and it does not feel optimal at all, if only because it exports the preamble once for every file - that's more like a proof-of-concept ...) The file .../preamble.org contains a few links and contact info, and the line to #+INCLUDE: the sitemap. Works reasonably well :-) and it could be something that others would find useful. Thanks again, Cheers, /vincent